diff options
Diffstat (limited to 'modules/by-name/lf/lf/ctpv/prev/application')
14 files changed, 297 insertions, 0 deletions
diff --git a/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh b/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh new file mode 100644 index 00000000..5f4baac7 --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh @@ -0,0 +1,11 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" + +. %HELPERS + +atool --list -- "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix new file mode 100644 index 00000000..befed06c --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix @@ -0,0 +1,89 @@ +{pkgs, ...}: { + soispha.programs.lf.ctpv.previewers = { + atool = { + previewer = ./atool.sh; + matches.mime = [ + "application/gzip" + "application/java-archive" + "application/vnd.debian.binary-package" + "application/x-7z-compressed" + "application/x-bzip2" + "application/x-rar" + "application/x-tar" + "application/x-xz" + "application/zip" + "application/zlib" + ]; + + matches.extension = [ + "7z" + "Z" + "a" + "ace" + "alz" + "arc" + "arj" + "bz" + "bz2" + "cab" + "cpio" + "deb" + "gz" + "jar" + "lha" + "lrz" + "lz" + "lzh" + "lzma" + "lzo" + "rar" + "rpm" + "rz" + "t7z" + "tZ" + "tar" + "tar.7z" + "tar.Z" + "tar.bz" + "tar.bz2" + "tar.gz" + "tar.lz" + "tar.lzo" + "tar.xz" + "tbz" + "tbz2" + "tgz" + "tlz" + "txz" + "tzo" + "war" + "xz" + "zip" + ]; + dependencies = [ + pkgs.atool + + # archive tools + pkgs.archiver # for arc + pkgs.arj + pkgs.cpio + pkgs.dpkg + pkgs.file + pkgs.gnutar + pkgs.gzip + pkgs.lzop + pkgs.p7zip + pkgs.pbzip2 + pkgs.plzip + pkgs.rpm + pkgs.unzip + pkgs.xz + pkgs.zip + + # Unfree stuff + # pkgs.lha + # pkgs.rar + ]; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix new file mode 100644 index 00000000..00c7e389 --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: { + soispha.programs.lf.ctpv.previewers = { + dll = { + previewer = ./dll.sh; + matches.mime = [ + "application/vnd.microsoft.portable-executable" + ]; + priority = 1; + dependencies = [ + pkgs.tinyxxd + ]; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh b/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh new file mode 100644 index 00000000..678506eb --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh @@ -0,0 +1,19 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +w="$w" +# shellcheck disable=SC2269 +e="$e" +# shellcheck disable=SC2269 +m="$m" +# shellcheck disable=SC2269 +h="$h" + +. %HELPERS + +preview_xxd "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix new file mode 100644 index 00000000..33c51352 --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix @@ -0,0 +1,14 @@ +{pkgs, ...}: { + soispha.programs.lf.ctpv.previewers = { + epub = { + previewer = ./epub.sh; + matches.mime = ["application/epub+zip"]; + matches.extension = ["epub"]; + priority = 1; + dependencies = with pkgs; [ + bk + epub-thumbnailer + ]; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh b/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh new file mode 100644 index 00000000..703e7dad --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh @@ -0,0 +1,27 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +w="$w" +# shellcheck disable=SC2269 +e="$e" +# shellcheck disable=SC2269 +m="$m" +# shellcheck disable=SC2269 +h="$h" +# shellcheck disable=SC2269 +cache_f="$cache_f" + +. %HELPERS + +epub() { + epub-thumbnailer "$f" "$cache_f" 20000 +} + +convert_and_show_image epub + +bk --meta "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix new file mode 100644 index 00000000..b27e3ef9 --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix @@ -0,0 +1,12 @@ +{pkgs, ...}: { + soispha.programs.lf.ctpv.previewers = { + pdf = { + previewer = ./pdf.sh; + matches.mime = ["application/pdf"]; + priority = 1; + dependencies = [ + pkgs.poppler_utils # for `pdftoppm` + ]; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh b/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh new file mode 100644 index 00000000..2f807b1a --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh @@ -0,0 +1,22 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +cache_f="$cache_f" + +. %HELPERS + +pdf() { + pdftoppm -f 1 -l 1 \ + -scale-to-x 1920 \ + -scale-to-y -1 \ + -singlefile \ + -jpeg \ + -- "$f" "$cache_f" && mv -- "$cache_f.jpg" "$cache_f" +} + +convert_and_show_image pdf diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix new file mode 100644 index 00000000..c219a1ed --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix @@ -0,0 +1,17 @@ +{pkgs, ...}: { + soispha.programs.lf.ctpv.previewers = { + pgp = { + previewer = ./pgp.sh; + matches.extension = ["gpg" "asc" "key" "pgp" "sig"]; + matches.mime = [ + "application/pgp-encrypted" + "application/pgp-keys" + "application/pgp-signature" + ]; + priority = 1; + dependencies = [ + pkgs.sequoia-sq + ]; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh b/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh new file mode 100644 index 00000000..a4eefd96 --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh @@ -0,0 +1,13 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +w="$w" + +. %HELPERS + +hide_script_env sq inspect --certifications -- "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix new file mode 100644 index 00000000..54b8c29e --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix @@ -0,0 +1,13 @@ +{pkgs, ...}: { + soispha.programs.lf.ctpv.previewers = { + sqlite = { + previewer = ./sqlite.sh; + matches.mime = ["application/vnd.sqlite3"]; + priority = 1; + dependencies = [ + pkgs.sqlite + pkgs.bat + ]; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh new file mode 100644 index 00000000..07e77a93 --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh @@ -0,0 +1,22 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +w="$w" + +. %HELPERS + +echo "SQLite database. Schema:" +echo + +sqlite3 "$f" ".schema --indent" | bat \ + --color always \ + --style plain \ + --paging never \ + --language SQL \ + --terminal-width "$w" \ + --wrap character diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix new file mode 100644 index 00000000..504623a0 --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix @@ -0,0 +1,11 @@ +{pkgs, ...}: { + soispha.programs.lf.ctpv.previewers = { + torrent = { + previewer = ./torrent.sh; + matches.mime = ["application/x-bittorrent"]; + dependencies = [ + pkgs.transmission_4 # for `transmission-show` + ]; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh new file mode 100644 index 00000000..16cfcbcd --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh @@ -0,0 +1,13 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +cache_f="$cache_f" + +. %HELPERS + +transmission-show -- "$f" |