From patchwork Tue Jun 29 19:06:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Raghav Gururajan X-Patchwork-Id: 30789 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CB65227BC85; Tue, 29 Jun 2021 21:04:32 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 960E927BC84 for ; Tue, 29 Jun 2021 21:04:29 +0100 (BST) Received: from localhost ([::1]:49176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJy8-0001yc-KU for patchwork@mira.cbaines.net; Tue, 29 Jun 2021 16:04:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyJ4Y-0006I3-IU for guix-patches@gnu.org; Tue, 29 Jun 2021 15:07:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyJ4Y-0008Ss-Bg for guix-patches@gnu.org; Tue, 29 Jun 2021 15:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lyJ4Y-0005Ts-7m for guix-patches@gnu.org; Tue, 29 Jun 2021 15:07:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49238] [PATCH v2 1/2] gnu: Add python-ueberzug. References: In-Reply-To: Resent-From: Raghav Gururajan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Jun 2021 19:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49238 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 49238@debbugs.gnu.org Cc: Raghav Gururajan , jgart , LibreMiami Received: via spool by 49238-submit@debbugs.gnu.org id=B49238.162499360021031 (code B ref 49238); Tue, 29 Jun 2021 19:07:02 +0000 Received: (at 49238) by debbugs.gnu.org; 29 Jun 2021 19:06:40 +0000 Received: from localhost ([127.0.0.1]:55416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyJ4B-0005T3-P8 for submit@debbugs.gnu.org; Tue, 29 Jun 2021 15:06:40 -0400 Received: from out0.migadu.com ([94.23.1.103]:37238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyJ49-0005St-CU for 49238@debbugs.gnu.org; Tue, 29 Jun 2021 15:06:38 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raghavgururajan.name; s=key1; t=1624993595; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SS6mRWwlF5qrCkD/Rd4rI8eUiqFiCJBe14wp4AwLyLI=; b=K1nF/Qi4gQNyA9cMGfu3bZ84FFZFqARHPgZO9qQpwTia3DSPnFT1Rs+qwDb8TiVQfmFM3M 2gT/nwVScWPF9n5sVRM35olctAPR6edRmP0uhIC30vps3XZ1jBu9Y7NmJDxF6UwGiaQiXw dz3WLcbI1wsqo99uRVj7M6LF4xI3uN5jeVF3AyBx8dUBThXma2AG08lzd6NcowHttSBkOj AO/yyZf3SaIF9um2a79QgSn6KIILjOeZRR+EWy1gUjFuJDINlHCajxZuelxwftyxnC1EIS uHHS++zKJmsLy0+Kd8ZOmJvD/ATXfQOZF78fsoZcqwONyyDqKsT7dQXKwnVQCw== Date: Tue, 29 Jun 2021 15:06:16 -0400 Message-Id: <20210629190617.3116-1-rg@raghavgururajan.name> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: rg@raghavgururajan.name X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Raghav Gururajan X-ACL-Warn: , Raghav Gururajan via Guix-patches X-Patchwork-Original-From: Raghav Gururajan via Guix-patches via From: Raghav Gururajan X-getmail-retrieved-from-mailbox: Patches From: LibreMiami * gnu/packages/python-xyz.scm (python-ueberzug): New variable. Co-authored-by: Raghav Gururajan Co-authored-by: jgart --- gnu/packages/python-xyz.scm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 1aa53b7825..f0fbe91b73 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -101,6 +101,7 @@ ;;; Copyright © 2021 LibreMiami ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Raghav Gururajan +;;; Copyright © 2021 jgart ;;; Copyright © 2021 Danial Behzadi ;;; ;;; This file is part of GNU Guix. @@ -221,6 +222,42 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-26)) +(define-public python-ueberzug + (package + (name "python-ueberzug") + (version "18.1.9") + (source + (origin + (method url-fetch) + (uri (pypi-uri "ueberzug" version)) + (sha256 + (base32 + "1hxd45dnwa9yv908acarr98n2drmar66wzq9z2qd3irj24srzr3w")))) + (build-system python-build-system) + (inputs + `(("libx11" ,libx11) + ("libxext" ,libxext))) + (propagated-inputs + `(("python-attrs" ,python-attrs) + ("python-docopt" ,python-docopt) + ("python-pillow" ,python-pillow) + ("python-xlib" ,python-xlib))) + (home-page "https://github.com/seebye/ueberzug") + (synopsis "Command line util to display images in combination with X11") + (description "Überzug is a command line util which allows to draw images on +terminals by using child windows. The advantages of using Überzug are: +@itemize +@item No race conditions as a new window is created to display images. +@item Expose events will be processed, so images will be redrawn on switch +workspaces. +@item Tmux support (excluding multi pane windows). +@item Terminals without the WINDOWID environment variable are supported. +@item Chars are used as position - and size unit. +@item No memory leak (/ unlimited cache). +@end itemize") + (license license:gpl3+))) + + (define-public python-fire (package (name "python-fire") From patchwork Tue Jun 29 19:06:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Raghav Gururajan X-Patchwork-Id: 30788 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E63E327BC78; Tue, 29 Jun 2021 21:04:21 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 9806F27BC81 for ; Tue, 29 Jun 2021 21:04:20 +0100 (BST) Received: from localhost ([::1]:48448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJxz-0001TE-HG for patchwork@mira.cbaines.net; Tue, 29 Jun 2021 16:04:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyJ4Y-0006I4-Vf for guix-patches@gnu.org; Tue, 29 Jun 2021 15:07:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43873) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyJ4Y-0008Sx-Of for guix-patches@gnu.org; Tue, 29 Jun 2021 15:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lyJ4Y-0005Tz-Kz for guix-patches@gnu.org; Tue, 29 Jun 2021 15:07:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49238] [PATCH v2 2/2] gnu: Add ytfzf. Resent-From: Raghav Gururajan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Jun 2021 19:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49238 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 49238@debbugs.gnu.org Cc: Raghav Gururajan , jgart , LibreMiami Received: via spool by 49238-submit@debbugs.gnu.org id=B49238.162499360821049 (code B ref 49238); Tue, 29 Jun 2021 19:07:02 +0000 Received: (at 49238) by debbugs.gnu.org; 29 Jun 2021 19:06:48 +0000 Received: from localhost ([127.0.0.1]:55418 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyJ4G-0005TN-3Y for submit@debbugs.gnu.org; Tue, 29 Jun 2021 15:06:48 -0400 Received: from out0.migadu.com ([94.23.1.103]:37246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyJ49-0005Sv-HH for 49238@debbugs.gnu.org; Tue, 29 Jun 2021 15:06:39 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raghavgururajan.name; s=key1; t=1624993596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f4JkvLVGBhKE5gUZbxpFKR4GcsrEMXOiSXE9L3zRpuk=; b=iv/pG9npbK2tdlQrpTet+U1cNO/iZwCiHvc4cddSTSW//F+leAvrLGT/71ph1cfCfjsyL+ xpLKihMtN4dbt04FxHIkiPjGf5lMhUTkdund9M3EGrDHmnriaAzbnszYU+Cbmk9rxGnLvG Wl1vLr9m2JV+RBazsiq3cnBaSuOi6fqA0vsPj213TjswMnN1ezXFH6DtmANMolsTat7021 2ij4EfOrvrX42BBZsmdeb9npQgBNLYol/MJKpR0h1O+Y0vvhVIXErZO3+Lb+Hg+Yu4lwts rSPGpCw0dU5N36RH42dTE2QXOo8wiJcN1rHwE9FC1ABbsur9rNTT1IyuA/FBbQ== Date: Tue, 29 Jun 2021 15:06:17 -0400 Message-Id: <20210629190617.3116-2-rg@raghavgururajan.name> In-Reply-To: <20210629190617.3116-1-rg@raghavgururajan.name> References: <20210629190617.3116-1-rg@raghavgururajan.name> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: rg@raghavgururajan.name X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Raghav Gururajan X-ACL-Warn: , Raghav Gururajan via Guix-patches X-Patchwork-Original-From: Raghav Gururajan via Guix-patches via From: Raghav Gururajan X-getmail-retrieved-from-mailbox: Patches From: LibreMiami * gnu/packages/image-viewers.scm (ytfzf): New variable. Co-authored-by: Raghav Gururajan Co-authored-by: jgart --- gnu/local.mk | 2 + gnu/packages/image-viewers.scm | 102 ++++++ gnu/packages/patches/ytfzf-programs.patch | 372 ++++++++++++++++++++++ gnu/packages/patches/ytfzf-updates.patch | 41 +++ 4 files changed, 517 insertions(+) create mode 100644 gnu/packages/patches/ytfzf-programs.patch create mode 100644 gnu/packages/patches/ytfzf-updates.patch diff --git a/gnu/local.mk b/gnu/local.mk index 6b9202cba1..919a0d4a34 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1858,6 +1858,8 @@ dist_patch_DATA = \ %D%/packages/patches/xsane-support-ipv6.patch \ %D%/packages/patches/xsane-tighten-default-umask.patch \ %D%/packages/patches/yggdrasil-extra-config.patch \ + %D%/packages/patches/ytfzf-programs.patch \ + %D%/packages/patches/ytfzf-updates.patch \ %D%/packages/patches/ytnef-CVE-2021-3403.patch \ %D%/packages/patches/ytnef-CVE-2021-3404.patch \ %D%/packages/patches/zstd-CVE-2021-24031_CVE-2021-24032.patch \ diff --git a/gnu/packages/image-viewers.scm b/gnu/packages/image-viewers.scm index f01b6a614a..e6c8cfbe8c 100644 --- a/gnu/packages/image-viewers.scm +++ b/gnu/packages/image-viewers.scm @@ -18,6 +18,8 @@ ;;; Copyright © 2021 Rovanion Luckey ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021 Stefan Reichör +;;; Copyright © 2021 Raghav Gururajan +;;; Copyright © 2021 jgart ;;; ;;; This file is part of GNU Guix. ;;; @@ -46,6 +48,7 @@ #:use-module (guix build-system python) #:use-module (gnu packages autotools) #:use-module (gnu packages algebra) + #:use-module (gnu packages base) #:use-module (gnu packages boost) #:use-module (gnu packages check) #:use-module (gnu packages compression) @@ -64,6 +67,7 @@ #:use-module (gnu packages image-processing) #:use-module (gnu packages imagemagick) #:use-module (gnu packages maths) + #:use-module (gnu packages ncurses) #:use-module (gnu packages perl) #:use-module (gnu packages perl-check) #:use-module (gnu packages photo) @@ -71,10 +75,108 @@ #:use-module (gnu packages python) #:use-module (gnu packages python-xyz) #:use-module (gnu packages qt) + #:use-module (gnu packages suckless) + #:use-module (gnu packages terminals) + #:use-module (gnu packages video) + #:use-module (gnu packages web) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xorg) #:use-module (gnu packages)) +(define-public ytfzf + (package + (name "ytfzf") + (version "1.2.0") + (home-page "https://github.com/pystardust/ytfzf") + (source + (origin + (method git-fetch) + (uri + (git-reference + (url home-page) + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "00d416qb4109pm77ikhnmds8qng90ni2jan9kdnxz7b6sh5f61nz")) + (patches + (search-patches + ;; Pre-requisite for 'patch' phase. + "ytfzf-programs.patch" + ;; Disables self-update. + "ytfzf-updates.patch")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ; no test suite + #:modules + ((guix build gnu-build-system) + (guix build utils) + (srfi srfi-26)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch + (lambda* (#:key inputs outputs #:allow-other-keys) + ;; Use correct $PREFIX path. + (substitute* "Makefile" + (("/usr/bin") + (format #f "~a/bin" + (assoc-ref outputs "out")))) + ;; Use absolute path to referenced programs. + (substitute* "ytfzf" + (("@catimg@") + (format #f "~a/bin/catimg" + (assoc-ref inputs "catimg"))) + (("@chafa@") + (format #f "~a/bin/chafa" + (assoc-ref inputs "chafa"))) + (("@curl@") + (format #f "~a/bin/curl" + (assoc-ref inputs "curl"))) + (("@dmenu@") + (format #f "~a/bin/dmenu" + (assoc-ref inputs "dmenu"))) + (("@fzf@") + (format #f "~a/bin/fzf" + (assoc-ref inputs "fzf"))) + (("@jp2a@") + (format #f "~a/bin/jp2a" + (assoc-ref inputs "jp2a"))) + (("@jq@") + (format #f "~a/bin/jq" + (assoc-ref inputs "jq"))) + (("@mpv@") + (format #f "~a/bin/mpv" + (assoc-ref inputs "mpv"))) + (("@notify-send@") + (format #f "~a/bin/notify-send" + (assoc-ref inputs "libnotify"))) + (("@tput@") + (format #f "~a/bin/tput" + (assoc-ref inputs "ncurses"))) + (("@ueberzug@") + (format #f "~a/bin/ueberzug" + (assoc-ref inputs "python-ueberzug"))) + (("@youtube-dl@") + (format #f "~a/bin/youtube-dl" + (assoc-ref inputs "youtube-dl")))))) + (delete 'configure)))) ;no configure script + (inputs + `(("catimg" ,catimg) + ("chafa" ,chafa) + ("curl" ,curl) + ("dmenu" ,dmenu) + ("fzf" ,fzf) + ("jp2a" ,jp2a) + ("jq" ,jq) + ("libnotify" ,libnotify) + ("mpv" ,mpv) + ("ncurses" ,ncurses) + ("python-ueberzug" ,python-ueberzug) + ("youtube-dl" ,youtube-dl))) + (synopsis "Find and watch PeerTube or YouTube videos from the terminal") + (description "@code{ytfzf} is a POSIX script that helps you find PeerTube or +YouTube videos without requiring API and opens/downloads them using mpv/ytdl.") + (license license:gpl3+))) + (define-public feh (package (name "feh") diff --git a/gnu/packages/patches/ytfzf-programs.patch b/gnu/packages/patches/ytfzf-programs.patch new file mode 100644 index 0000000000..efcd70823a --- /dev/null +++ b/gnu/packages/patches/ytfzf-programs.patch @@ -0,0 +1,372 @@ +From 8a796549d756a40a174954d2858d4c5042e3808f Mon Sep 17 00:00:00 2001 +From: LibreMiami +Date: Sat, 26 Jun 2021 20:23:11 -0400 +Subject: [PATCH 1/2] Modify the strings of referenced programs. + +Pattern the strings of referenced programs, so that they can be easily +substituted with absolute paths using a custom-phase. +--- + ytfzf | 110 +++++++++++++++++++++++++++++----------------------------- + 1 file changed, 55 insertions(+), 55 deletions(-) + +diff --git a/ytfzf b/ytfzf +index f4d2e0d..2d917df 100755 +--- a/ytfzf ++++ b/ytfzf +@@ -49,19 +49,19 @@ cache_dir=${YTFZF_CACHE-${cache_dir-$HOME/.cache/ytfzf}} + #video type preference (mp4/1080p, mp4/720p, etc..) + video_pref=${YTFZF_PREF-${video_pref-}} + #the menu to use instead of fzf when -D is specified +-external_menu=${YTFZF_EXTMENU-${external_menu-dmenu -i -l 30 -p Search:}} ++external_menu=${YTFZF_EXTMENU-${external_menu-@dmenu@ -i -l 30 -p Search:}} + #number of columns (characters on a line) the external menu can have + #necessary for formatting text for external menus + external_menu_len=${YTFZF_EXTMENU_LEN-${external_menu_len-220}} + #player settings (players need to support streaming with youtube-dl) + #player to use for watching the video +-video_player=${YTFZF_PLAYER-${video_player-mpv}} ++video_player=${YTFZF_PLAYER-${video_player-@mpv@}} + #if YTFZF_PREF is specified, use this player instead +-video_player_format=${YTFZF_PLAYER_FORMAT-${video_player_format-mpv --ytdl-format=}} ++video_player_format=${YTFZF_PLAYER_FORMAT-${video_player_format-@mpv@ --ytdl-format=}} + #player to use for audio only +-audio_player=${YTFZF_AUDIO_PLAYER-${audio_player-mpv --no-video}} ++audio_player=${YTFZF_AUDIO_PLAYER-${audio_player-@mpv@ --no-video}} + #the command to use for displaying thumbnails +-thumb_disp_method=${YTFZF_THUMB_DISP_METHOD-${thumb_disp_method-ueberzug}} ++thumb_disp_method=${YTFZF_THUMB_DISP_METHOD-${thumb_disp_method-@ueberzug@}} + #Storing the argument and location for autogenerated subtitles + [ -z "$YTFZF_SUBT_NAME" ] && YTFZF_SUBT_NAME="" + #Stores the language for the auto genereated subtitles +@@ -177,12 +177,12 @@ dep_ck () { + done + unset Dep + } +-dep_ck "jq" "youtube-dl" "curl" ++dep_ck "@jq@" "@youtube-dl@" "@curl@" + + + #only check for mpv if $YTFZF_PLAYER is set to it + #don't check $YTFZF_PLAYER as it could be multiple commands +-[ "$video_player" = "mpv" ] && dep_ck "mpv" ++[ "$video_player" = "@mpv@" ] && dep_ck "@mpv@" + + ############################ + # Help Texts # +@@ -326,8 +326,8 @@ print_info () { + } + + print_error () { +- [ $ext_menu_notifs -eq 1 ] && notify-send "error" "$*" || printf "\033[31m$*\033[0m" >&2 +- [ $ext_menu_notifs -eq 1 ] && notify-send "Check for new versions and report at: https://github.com/pystardust/ytfzf\n" || printf "Check for new versions and report at: https://github.com/pystardust/ytfzf\n" >&2 ++ [ $ext_menu_notifs -eq 1 ] && @notify-send@ "error" "$*" || printf "\033[31m$*\033[0m" >&2 ++ [ $ext_menu_notifs -eq 1 ] && @notify-send@ "Check for new versions and report at: https://github.com/pystardust/ytfzf\n" || printf "Check for new versions and report at: https://github.com/pystardust/ytfzf\n" >&2 + } + + ############################ +@@ -398,8 +398,8 @@ format_fzf () { + format_menu () { + if [ "$is_ext_menu" -eq 0 ]; then + #dep_ck fzf here because it is only necessary to use here +- dep_ck "fzf" +- menu_command='column -t -s "$tab_space" | fzf -m --bind change:top --tabstop=1 --layout=reverse --delimiter="$tab_space" --nth=1,2 --expect="$shortcuts" $FZF_DEFAULT_OPTS' ++ dep_ck "@fzf@" ++ menu_command='column -t -s "$tab_space" | @fzf@ -m --bind change:top --tabstop=1 --layout=reverse --delimiter="$tab_space" --nth=1,2 --expect="$shortcuts" $FZF_DEFAULT_OPTS' + format_fzf + else + # Dmenu doesn't render tabs so removing it +@@ -462,7 +462,7 @@ WIDTH=$FZF_PREVIEW_COLUMNS + HEIGHT=$FZF_PREVIEW_LINES + start_ueberzug () { + [ -e $FIFO ] || { mkfifo "$FIFO" || exit 1 ; } +- ueberzug layer --parser json --silent < "$FIFO" & ++ @ueberzug@ layer --parser json --silent < "$FIFO" & + exec 3>"$FIFO" + } + stop_ueberzug () { +@@ -476,12 +476,12 @@ preview_img () { + shorturl=${args##*${tab_space}|} + shorturl="${shorturl%% *}" + +- json_obj=$(printf "%s" "$videos_json" | jq '.[]|select( .videoID == "'"$shorturl"'")') ++ json_obj=$(printf "%s" "$videos_json" | @jq@ '.[]|select( .videoID == "'"$shorturl"'")') + + + IFS=$tab_space read -r title channel duration views date description <<-EOF + $( +- printf "%s" "$json_obj" | jq -r \ ++ printf "%s" "$json_obj" | @jq@ -r \ + ' + [.title,.channel,.duration,.views,.date,.description]|@tsv + ' +@@ -530,31 +530,31 @@ preview_img () { + } > "$FIFO" ;; + catimg) + printf "\n" +- catimg -w "$((thumb_width * 2))" "$IMAGE" ;; ++ @catimg@ -w "$((thumb_width * 2))" "$IMAGE" ;; + jp2a) + printf "\n" +- jp2a --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=24 "$IMAGE" ;; ++ @jp2a@ --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=24 "$IMAGE" ;; + jp2a-8) + printf "\n" +- jp2a --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=8 "$IMAGE" ;; ++ @jp2a@ --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=8 "$IMAGE" ;; + jp2a-4) + printf "\n" +- jp2a --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=4 "$IMAGE" ;; ++ @jp2a@ --size="${thumb_width}x$((thumb_height / 2))" --colors --color-depth=4 "$IMAGE" ;; + jp2a-gray|jp2a-grey) + printf "\n" +- jp2a --size="${thumb_width}x$((thumb_height / 2))" "$IMAGE" ;; ++ @jp2a@ --size="${thumb_width}x$((thumb_height / 2))" "$IMAGE" ;; + chafa) + printf "\n" +- chafa --size="${thumb_width}x${thumb_height}" "$IMAGE" ;; ++ @chafa@ --size="${thumb_width}x${thumb_height}" "$IMAGE" ;; + chafa-gray|chafa-grey) + printf "\n" +- chafa --size="${thumb_width}x${thumb_height}" --colors=2 "$IMAGE" ;; ++ @chafa@ --size="${thumb_width}x${thumb_height}" --colors=2 "$IMAGE" ;; + chafa-4) + printf "\n" +- chafa --size="${thumb_width}x${thumb_height}" --colors=16 "$IMAGE" ;; ++ @chafa@ --size="${thumb_width}x${thumb_height}" --colors=16 "$IMAGE" ;; + chafa-8) + printf "\n" +- chafa --size="${thumb_width}x${thumb_height}" --colors=256 "$IMAGE" ;; ++ @chafa@ --size="${thumb_width}x${thumb_height}" --colors=256 "$IMAGE" ;; + custom) + if ! function_exists "handle_display_img"; then + printf "\033[031mERROR[#07]: \033[0m\033[1mhandle_display_img\033[0m is not defined" >&2 +@@ -585,17 +585,17 @@ download_thumbnails () { + if [ "$thumbnail_quality" -eq 1 ]; then + image_download () { + # higher quality images +- curl -s "$Url" -G --data-urlencode "sqp=" > "$thumb_dir/$Name.png" ++ @curl@ -s "$Url" -G --data-urlencode "sqp=" > "$thumb_dir/$Name.png" + } + else + image_download () { +- curl -s "$Url" > "$thumb_dir/$Name.png" ++ @curl@ -s "$Url" > "$thumb_dir/$Name.png" + } + fi + + print_info "Downloading Thumbnails...\n" + thumb_urls=$(printf "%s" "$*" |\ +- jq -r '.[]|[.thumbs,.videoID]|@tsv' ) ++ @jq@ -r '.[]|[.thumbs,.videoID]|@tsv' ) + + while IFS=$tab_space read -r Url Name; do + sleep 0.001 +@@ -668,7 +668,7 @@ get_yt_html () { + link=$1 + query=$2 + printf "%s" "$( +- curl "$link" -s \ ++ @curl@ "$link" -s \ + -G --data-urlencode "search_query=$query" \ + -G --data-urlencode "sp=$sp" \ + -H 'Authority: www.youtube.com' \ +@@ -684,7 +684,7 @@ get_video_data () { + # outputs tab and pipe separated fields: title, channel, view count, video length, video upload date, and the video id/url + # from the videos_json + printf "%s" "$*" |\ +- jq -r '.[]| "\(.title)'"$tab_space"'|\(.channel)'"$tab_space"'|\(.views)'"$tab_space"'|\(.duration)'"$tab_space"'|\(.date)'"$tab_space"'|\(.videoID)"' ++ @jq@ -r '.[]| "\(.title)'"$tab_space"'|\(.channel)'"$tab_space"'|\(.views)'"$tab_space"'|\(.duration)'"$tab_space"'|\(.date)'"$tab_space"'|\(.videoID)"' + } + + scrape_channel () { +@@ -723,7 +723,7 @@ scrape_channel () { + + #gets a list of videos + videos_json=$(printf "%s" "$yt_json" |\ +- jq '[ .contents | ..|.gridVideoRenderer? | ++ @jq@ '[ .contents | ..|.gridVideoRenderer? | + select(. !=null) | + { + title: .title.runs[0].text, +@@ -736,7 +736,7 @@ scrape_channel () { + } + ]') + +- videos_json=$(printf "%s" "$videos_json" | jq '.[0:'$sub_link_count']') ++ videos_json=$(printf "%s" "$videos_json" | @jq@ '.[0:'$sub_link_count']') + printf "%s\n" "$videos_json" >> "$tmp_video_json_file" + #checks if it's empty in case it was defined in a config function eg: on_get_search + [ -z "$videos_data" ] && videos_data=$(get_video_data "$videos_json") +@@ -768,11 +768,11 @@ get_trending_url_data () { + scrape_pt () { + #gets a list of videos + pt_json=$( +- curl \ ++ @curl@ \ + -s "https://sepiasearch.org/api/v1/search/videos" \ + -G --data-urlencode "search=$*") + videos_json=$(printf "%s" "$pt_json" |\ +- jq '[ .data | .[] | ++ @jq@ '[ .data | .[] | + { + title: .name, + channel: .channel.displayName, +@@ -829,7 +829,7 @@ scrape_yt () { + fi + + #gets a list of videos +- videos_json=$(printf "%s" "$yt_json" | jq '[ .contents| ++ videos_json=$(printf "%s" "$yt_json" | @jq@ '[ .contents| + ..|.videoRenderer? | + select(. !=null) | + { +@@ -844,7 +844,7 @@ scrape_yt () { + } + ]') + +- playlist_json=$(printf "%s" "$yt_json" | jq '[ .contents| ++ playlist_json=$(printf "%s" "$yt_json" | @jq@ '[ .contents| + ..|.playlistRenderer? | + select(. !=null) | + { +@@ -919,16 +919,16 @@ user_selection () { + + #show thumbnail menu + elif [ "$show_thumbnails" -eq 1 ] ; then +- dep_ck "ueberzug" "fzf" ++ dep_ck "@ueberzug@" "@fzf@" + export YTFZF_THUMB_DISP_METHOD="$thumb_disp_method" +- [ "$thumb_disp_method" = "ueberzug" ] && start_ueberzug ++ [ "$thumb_disp_method" = "@ueberzug@" ] && start_ueberzug + #thumbnails only work in fzf, use fzf +- menu_command="fzf -m --tabstop=1 --bind change:top --delimiter=\"$tab_space\" \ ++ menu_command="@fzf@ -m --tabstop=1 --bind change:top --delimiter=\"$tab_space\" \ + --nth=1,2 --expect='$shortcuts' $FZF_DEFAULT_OPTS \ + --layout=reverse --preview \"sh $0 -U {}\" \ + --preview-window \"$PREVIEW_SIDE:50%:noborder:wrap\"" + selected_data=$( title_len=200 video_menu "$videos_data" ) +- [ "$thumb_disp_method" = "ueberzug" ] && stop_ueberzug ++ [ "$thumb_disp_method" = "@ueberzug@" ] && stop_ueberzug + # Deletes thumbnails if no video is selected + [ -z "$selected_data" ] && clean_up + #show regular menu +@@ -988,7 +988,7 @@ format_user_selection () { + 11) selected_urls=$selected_urls$new_line'https://www.youtube.com/watch?v='$surl ;; + 34) selected_urls=$selected_urls$new_line'https://www.youtube.com/playlist?list='$surl ;; + 36) +- selected_urls=$selected_urls$new_line"$(printf "%s" "$videos_json" | jq '.[].url' | grep -F "$surl" | tr -d '"')" ;; ++ selected_urls=$selected_urls$new_line"$(printf "%s" "$videos_json" | @jq@ '.[].url' | grep -F "$surl" | tr -d '"')" ;; + *) continue ;; + esac + refined_selected_data=$refined_selected_data$new_line$(printf '%s' "$videos_data" | grep "|$surl" ) +@@ -1014,7 +1014,7 @@ print_data () { + get_video_format () { + # select format if flag given + [ $show_format -eq 0 ] && return +- formats=$(youtube-dl -F "$(printf "$selected_urls")") ++ formats=$(@youtube-dl@ -F "$(printf "$selected_urls")") + line_number=$(printf "$formats" | grep -n '.*extension resolution.*' | cut -d: -f1) + quality=$(printf "$formats \n1 2 xAudio" | awk -v lineno=$line_number 'FNR > lineno {print $3}' | sort -n | awk -F"x" '{print $2 "p"}' | uniq | sed -e "s/Audiop/Audio/" -e "/^p$/d" | eval "$menu_command" | sed "s/p//g") + [ -z "$quality" ] && exit; +@@ -1026,9 +1026,9 @@ get_video_format () { + get_sub_lang () { + if [ $auto_caption -eq 1 ]; then + #Gets the auto generated subs and stores them in a file +- sub_list=$(youtube-dl --list-subs --write-auto-sub "$selected_urls" | sed '/Available subtitles/,$d' | awk '{print $1}' | sed '1d;2d;3d') ++ sub_list=$(@youtube-dl@ --list-subs --write-auto-sub "$selected_urls" | sed '/Available subtitles/,$d' | awk '{print $1}' | sed '1d;2d;3d') + if [ -n "$sub_list" ]; then +- [ -n "$selected_sub" ] || selected_sub=$(printf "$sub_list" | eval "$menu_command") && youtube-dl --sub-lang $selected_sub --write-auto-sub --skip-download "$selected_urls" -o /tmp/ytfzf && YTFZF_SUBT_NAME="--sub-file=/tmp/ytfzf.$selected_sub.vtt" || printf "Auto generated subs not available." ++ [ -n "$selected_sub" ] || selected_sub=$(printf "$sub_list" | eval "$menu_command") && @youtube-dl@ --sub-lang $selected_sub --write-auto-sub --skip-download "$selected_urls" -o /tmp/ytfzf && YTFZF_SUBT_NAME="--sub-file=/tmp/ytfzf.$selected_sub.vtt" || printf "Auto generated subs not available." + fi + unset sub_list + fi +@@ -1064,9 +1064,9 @@ open_player () { + fi + elif [ $is_download -eq 1 ]; then + if [ -z "$video_pref" ]; then +- youtube-dl "$@" "$YTFZF_SUBT_NAME" ++ @youtube-dl@ "$@" "$YTFZF_SUBT_NAME" + else +- youtube-dl -f "$video_pref" "$@" $YTFZF_SUBT_NAME || video_pref= open_player "$@" ++ @youtube-dl@ -f "$video_pref" "$@" $YTFZF_SUBT_NAME || video_pref= open_player "$@" + fi + fi + } +@@ -1200,7 +1200,7 @@ search_history_menu () { + #when using an external menu, the search history will be done there + choice=$( printf "%s\n" "$search_history" | eval "$external_menu" ) + else +- choice="$( printf "%s\n" "$search_history" | fzf --prompt="$search_history_prompt" --print-query --no-multi -d '\t' --with-nth=2.. --expect='alt-enter' --bind='tab:replace-query' )" ++ choice="$( printf "%s\n" "$search_history" | @fzf@ --prompt="$search_history_prompt" --print-query --no-multi -d '\t' --with-nth=2.. --expect='alt-enter' --bind='tab:replace-query' )" + fi + + # first line is the fzf query (what the user types in fzf) +@@ -1244,7 +1244,7 @@ search_history_menu () { + + #if downloading, say Downloading not currently playing + [ $is_download -eq 1 ] && title="Downloading" || title="Currently playing" +- notify-send "$title" "$message" -i "$video_thumb" ++ @notify-send@ "$title" "$message" -i "$video_thumb" + + unset message video_thumb title + } +@@ -1262,7 +1262,7 @@ EOF + update_ytfzf () { + branch="$1" + updatefile="/tmp/ytfzf-update" +- curl -L "https://raw.githubusercontent.com/pystardust/ytfzf/$branch/ytfzf" -o "$updatefile" ++ @curl@ -L "https://raw.githubusercontent.com/pystardust/ytfzf/$branch/ytfzf" -o "$updatefile" + + if sed -n '1p' < "$updatefile" | grep -q '#!/bin/sh'; then + chmod 755 "$updatefile" +@@ -1346,10 +1346,10 @@ create_subs () { + : > "$config_dir/subscriptions" + + # check how many subscriptions there are in the file +- sublength=$( jq '. | length' < "$yt_sub_import_file" ) ++ sublength=$( @jq@ '. | length' < "$yt_sub_import_file" ) + + for i in $(seq $((sublength - 1))); do +- channelInfo=$(jq --argjson index ${i} '[ "https://www.youtube.com/channel/" + .[$index].snippet.resourceId.channelId + "/videos", "#" + .[$index].snippet.title ]' < "$yt_sub_import_file") ++ channelInfo=$(@jq@ --argjson index ${i} '[ "https://www.youtube.com/channel/" + .[$index].snippet.resourceId.channelId + "/videos", "#" + .[$index].snippet.title ]' < "$yt_sub_import_file") + printf "%s\n" "$(printf "%s" "$channelInfo" | tr -d '[]"\n,')" >> "$subscriptions_file" + done + exit +@@ -1486,8 +1486,8 @@ parse_opt () { + exit ;; + version) + printf "\033[1mytfzf:\033[0m %s\n" "$YTFZF_VERSION" +- printf "\033[1myoutube-dl:\033[0m %s\n" "$(youtube-dl --version)" +- command -v "fzf" 1>/dev/null && printf "\033[1mfzf:\033[0m %s\n" "$(fzf --version)" ++ printf "\033[1myoutube-dl:\033[0m %s\n" "$(@youtube-dl@ --version)" ++ command -v "@fzf@" 1>/dev/null && printf "\033[1mfzf:\033[0m %s\n" "$(@fzf@ --version)" + exit ;; + + subt) +@@ -1559,19 +1559,19 @@ done + shift $((OPTIND-1)) + + #only apply to ext_menu since they dont have a terminal to print to +-[ $is_ext_menu -eq 1 ] && command -v notify-send 1>/dev/null 2>&1 && ext_menu_notifs=1 || ext_menu_notifs=0 ++[ $is_ext_menu -eq 1 ] && command -v @notify-send@ 1>/dev/null 2>&1 && ext_menu_notifs=1 || ext_menu_notifs=0 + + #used for thumbnail previews in ueberzug + if [ $is_ext_menu -eq 0 ]; then +- export TTY_LINES=$(tput lines) +- export TTY_COLS=$(tput cols) ++ export TTY_LINES=$(@tput@ lines) ++ export TTY_COLS=$(@tput@ cols) + fi + + #if both are true, it defaults to using fzf, and if fzf isnt installed it will throw an error + #so print this error instead and set $show_thumbnails to 0 + if [ $is_ext_menu -eq 1 ] && [ $show_thumbnails -eq 1 ]; then + [ $ext_menu_notifs -eq 1 ] &&\ +- notify-send "warning" "Currently thumbnails do not work in external menus" ||\ ++ @notify-send@ "warning" "Currently thumbnails do not work in external menus" ||\ + printf "\033[33mWARNING: Currently thumbnails do not work in external menus\033[0m\n" >&2 + show_thumbnails=0 + fi +-- +2.32.0 + diff --git a/gnu/packages/patches/ytfzf-updates.patch b/gnu/packages/patches/ytfzf-updates.patch new file mode 100644 index 0000000000..3cdc12b015 --- /dev/null +++ b/gnu/packages/patches/ytfzf-updates.patch @@ -0,0 +1,41 @@ +From 374bd725ad5e52931d9ffeb1563ba31eb298aa5c Mon Sep 17 00:00:00 2001 +From: LibreMiami +Date: Sat, 26 Jun 2021 20:34:39 -0400 +Subject: [PATCH 2/2] Disable updates within the application. + +--- + ytfzf | 18 ++---------------- + 1 file changed, 2 insertions(+), 16 deletions(-) + +diff --git a/ytfzf b/ytfzf +index 2d917df..7b0b227 100755 +--- a/ytfzf ++++ b/ytfzf +@@ -1260,22 +1260,8 @@ EOF + } + + update_ytfzf () { +- branch="$1" +- updatefile="/tmp/ytfzf-update" +- @curl@ -L "https://raw.githubusercontent.com/pystardust/ytfzf/$branch/ytfzf" -o "$updatefile" +- +- if sed -n '1p' < "$updatefile" | grep -q '#!/bin/sh'; then +- chmod 755 "$updatefile" +- [ "$(uname)" = "Darwin" ] && prefix="/usr/local/bin" || prefix="/usr/bin" +- function_exists "sudo" && doasroot="sudo" || doasroot="doas" +- $doasroot cp "$updatefile" "$prefix/ytfzf" +- unset prefix doasroot +- else +- printf "%bFailed to update ytfzf. Try again later.%b" "$c_red" "$c_reset" +- fi +- +- rm "$updatefile" +- exit 0 ++ printf "%bUpdates have to be installed with Guix.%b\n" "$c_red" "$c_reset" ++ exit 1 + } + + #gives a value to sort by (this will give the unix time the video was uploaded) +-- +2.32.0 +