mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2024-11-27 23:13:07 +01:00
Add support for archives
This commit is contained in:
parent
46d006f82e
commit
16a52340de
@ -19,6 +19,10 @@ exists() {
|
|||||||
command -v "$1" >/dev/null
|
command -v "$1" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_exists() {
|
||||||
|
exists "$@" || exit 127
|
||||||
|
}
|
||||||
|
|
||||||
send_image() {
|
send_image() {
|
||||||
path="$(printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g')"
|
path="$(printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g')"
|
||||||
printf '{ "action": "add", "identifier": "preview", "x": %d, "y": %d, "width": %d, "height": %d, "scaler": "contain", "scaling_position_x": 0.5, "scaling_position_y": 0.5, "path": "%s"}\n' "$x" "$y" "$w" "$h" "$path" > "$fifo"
|
printf '{ "action": "add", "identifier": "preview", "x": %d, "y": %d, "width": %d, "height": %d, "scaler": "contain", "scaling_position_x": 0.5, "scaling_position_y": 0.5, "path": "%s"}\n' "$x" "$y" "$w" "$h" "$path" > "$fifo"
|
||||||
|
3
prev/atool.sh
Normal file
3
prev/atool.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
check_exists atool
|
||||||
|
|
||||||
|
atool -l -- "$f" | cut -d ' ' -f 6-
|
48
previews.h
48
previews.h
@ -44,6 +44,54 @@ Preview b_previews[] = {
|
|||||||
PR(NULL, "text", "x-diff", colordiff),
|
PR(NULL, "text", "x-diff", colordiff),
|
||||||
PR(NULL, "text", "x-patch", colordiff),
|
PR(NULL, "text", "x-patch", colordiff),
|
||||||
|
|
||||||
|
PR("tar.gz", NULL, NULL, atool),
|
||||||
|
PR("tgz", NULL, NULL, atool),
|
||||||
|
PR("tgz", NULL, NULL, atool),
|
||||||
|
PR("tar.gz", NULL, NULL, atool),
|
||||||
|
PR("tgz", NULL, NULL, atool),
|
||||||
|
PR("tar.bz", NULL, NULL, atool),
|
||||||
|
PR("tbz", NULL, NULL, atool),
|
||||||
|
PR("tar.bz2", NULL, NULL, atool),
|
||||||
|
PR("tbz2", NULL, NULL, atool),
|
||||||
|
PR("tar.Z", NULL, NULL, atool),
|
||||||
|
PR("tZ", NULL, NULL, atool),
|
||||||
|
PR("tar.lzo", NULL, NULL, atool),
|
||||||
|
PR("tzo", NULL, NULL, atool),
|
||||||
|
PR("tar.lz", NULL, NULL, atool),
|
||||||
|
PR("tlz", NULL, NULL, atool),
|
||||||
|
PR("tar.xz", NULL, NULL, atool),
|
||||||
|
PR("txz", NULL, NULL, atool),
|
||||||
|
PR("tar.7z", NULL, NULL, atool),
|
||||||
|
PR("t7z", NULL, NULL, atool),
|
||||||
|
PR("tar", NULL, NULL, atool),
|
||||||
|
PR("zip", NULL, NULL, atool),
|
||||||
|
PR("jar", NULL, NULL, atool),
|
||||||
|
PR("war", NULL, NULL, atool),
|
||||||
|
PR("rar", NULL, NULL, atool),
|
||||||
|
PR("lha", NULL, NULL, atool),
|
||||||
|
PR("lzh", NULL, NULL, atool),
|
||||||
|
PR("7z", NULL, NULL, atool),
|
||||||
|
PR("alz", NULL, NULL, atool),
|
||||||
|
PR("ace", NULL, NULL, atool),
|
||||||
|
PR("a", NULL, NULL, atool),
|
||||||
|
PR("arj", NULL, NULL, atool),
|
||||||
|
PR("arc", NULL, NULL, atool),
|
||||||
|
PR("rpm", NULL, NULL, atool),
|
||||||
|
PR("deb", NULL, NULL, atool),
|
||||||
|
PR("cab", NULL, NULL, atool),
|
||||||
|
PR("gz", NULL, NULL, atool),
|
||||||
|
PR("bz", NULL, NULL, atool),
|
||||||
|
PR("bz2", NULL, NULL, atool),
|
||||||
|
PR("Z", NULL, NULL, atool),
|
||||||
|
PR("lzma", NULL, NULL, atool),
|
||||||
|
PR("lzo", NULL, NULL, atool),
|
||||||
|
PR("lz", NULL, NULL, atool),
|
||||||
|
PR("xz", NULL, NULL, atool),
|
||||||
|
PR("rz", NULL, NULL, atool),
|
||||||
|
PR("lrz", NULL, NULL, atool),
|
||||||
|
PR("7z", NULL, NULL, atool),
|
||||||
|
PR("cpio", NULL, NULL, atool),
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* vim: set nowrap: */
|
/* vim: set nowrap: */
|
||||||
|
Loading…
Reference in New Issue
Block a user