mirror of
https://github.com/9001/copyparty.git
synced 2025-11-24 07:23:22 -07:00
Merge 425060b552 into 77f74ddb2f
This commit is contained in:
commit
5a7e5c2ac5
|
|
@ -100,7 +100,7 @@ ICV_EXTS = set(zsg.split(","))
|
||||||
zsg = "3gp,asf,av1,avc,avi,flv,m4v,mjpeg,mjpg,mkv,mov,mp4,mpeg,mpeg2,mpegts,mpg,mpg2,mts,nut,ogm,ogv,rm,vob,webm,wmv"
|
zsg = "3gp,asf,av1,avc,avi,flv,m4v,mjpeg,mjpg,mkv,mov,mp4,mpeg,mpeg2,mpegts,mpg,mpg2,mts,nut,ogm,ogv,rm,vob,webm,wmv"
|
||||||
VCV_EXTS = set(zsg.split(","))
|
VCV_EXTS = set(zsg.split(","))
|
||||||
|
|
||||||
zsg = "aif,aiff,alac,ape,flac,m4a,mp3,oga,ogg,opus,tak,tta,wav,wma,wv,cbz,epub"
|
zsg = "aif,aiff,alac,ape,flac,m4a,mp3,oga,ogg,opus,tak,tta,wav,wma,wv"
|
||||||
ACV_EXTS = set(zsg.split(","))
|
ACV_EXTS = set(zsg.split(","))
|
||||||
|
|
||||||
zsg = "nohash noidx xdev xvol"
|
zsg = "nohash noidx xdev xvol"
|
||||||
|
|
@ -1502,7 +1502,7 @@ class Up2k(object):
|
||||||
unreg: list[str] = []
|
unreg: list[str] = []
|
||||||
files: list[tuple[int, int, str]] = []
|
files: list[tuple[int, int, str]] = []
|
||||||
fat32 = True
|
fat32 = True
|
||||||
cv = vcv = acv = ""
|
cv = ecv = icv = vcv = acv = othcv = ""
|
||||||
e_d = {}
|
e_d = {}
|
||||||
|
|
||||||
th_cvd = self.args.th_coversd
|
th_cvd = self.args.th_coversd
|
||||||
|
|
@ -1602,23 +1602,69 @@ class Up2k(object):
|
||||||
if sz:
|
if sz:
|
||||||
liname = iname.lower()
|
liname = iname.lower()
|
||||||
ext = liname.rsplit(".", 1)[-1]
|
ext = liname.rsplit(".", 1)[-1]
|
||||||
if (
|
thumbable: set[str] = set()
|
||||||
liname in th_cvds
|
(
|
||||||
or (not cv and ext in ICV_EXTS and not iname.startswith("."))
|
fmt_pil,
|
||||||
) and (
|
fmt_vips,
|
||||||
not cv
|
fmt_raw,
|
||||||
or liname not in th_cvds
|
fmt_ffi,
|
||||||
or cv.lower() not in th_cvds
|
fmt_ffv,
|
||||||
or th_cvd.index(liname) < th_cvd.index(cv.lower())
|
fmt_ffa,
|
||||||
):
|
) = [
|
||||||
cv = iname
|
set(y.split(","))
|
||||||
elif not vcv and ext in VCV_EXTS and not iname.startswith("."):
|
for y in [
|
||||||
vcv = iname
|
self.args.th_r_pil,
|
||||||
elif not acv and ext in ACV_EXTS and not iname.startswith("."):
|
self.args.th_r_vips,
|
||||||
acv = iname
|
self.args.th_r_raw,
|
||||||
|
self.args.th_r_ffi,
|
||||||
|
self.args.th_r_ffv,
|
||||||
|
self.args.th_r_ffa,
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
if "pil" in self.args.th_dec:
|
||||||
|
thumbable |= fmt_pil
|
||||||
|
|
||||||
|
if "vips" in self.args.th_dec:
|
||||||
|
thumbable |= fmt_vips
|
||||||
|
|
||||||
|
if "raw" in self.args.th_dec:
|
||||||
|
thumbable |= fmt_raw
|
||||||
|
|
||||||
|
if "ff" in self.args.th_dec:
|
||||||
|
for zss in [fmt_ffi, fmt_ffv, fmt_ffa]:
|
||||||
|
thumbable |= zss
|
||||||
|
|
||||||
|
|
||||||
|
# thumbnail priority:
|
||||||
|
# 1. external cover in th_cvd (--th-covers) (priority: in the order specified in config)
|
||||||
|
# 2. the first image file (ICV_EXTS) we find
|
||||||
|
# 3. the first video file (VCV_EXTS) we find
|
||||||
|
# 4. the first audio file (ACV_EXTS) we find (might be album art, might be spectrogram)
|
||||||
|
# 5. the first file we find that we can generate a thumbnail for at all
|
||||||
|
# 6. no cover (fallback to text)
|
||||||
|
# 7. dotfiles, except as external cover
|
||||||
|
|
||||||
if not cv:
|
if not cv:
|
||||||
cv = vcv or acv
|
if liname in th_cvds:
|
||||||
|
# does this external cover filename have higher priority than the new one?
|
||||||
|
index = th_cvd.index(liname)
|
||||||
|
if index == 0:
|
||||||
|
cv = iname # this is the highest priority filename, stop looking
|
||||||
|
elif index < th_cvd.index(cv.lower()):
|
||||||
|
ecv = iname
|
||||||
|
elif not iname.startswith("."):
|
||||||
|
# only try new files if we didnt already find one of the same or higher priority
|
||||||
|
if (not (ecv or icv)) and ext in ICV_EXTS:
|
||||||
|
icv = iname
|
||||||
|
elif (not (ecv or icv or vcv)) and ext in VCV_EXTS:
|
||||||
|
vcv = iname
|
||||||
|
elif (not (ecv or icv or vcv or acv)) and ext in ACV_EXTS:
|
||||||
|
acv = iname
|
||||||
|
elif (not (ecv or icv or vcv or acv or othcv)) and ext in thumbable:
|
||||||
|
othcv = iname
|
||||||
|
|
||||||
|
cv = cv or icv or vcv or acv or othcv
|
||||||
|
|
||||||
if not self.args.no_dirsz:
|
if not self.args.no_dirsz:
|
||||||
tnf += len(files)
|
tnf += len(files)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue