Skip to content

Commit

Permalink
Use built-in binding to determine file format
Browse files Browse the repository at this point in the history
  • Loading branch information
nattadasu committed Dec 10, 2024
1 parent f696153 commit 727e9a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions modules/filespec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
}
{"]["}{crc32.upper()}{"]"}
{
def known_ext = ["ass", "srt", "ssa", "vtt", "ttml"]
def langcode = [
"name": "." + lang.name,
"iso3b": "." + lang.ISO3B,
Expand All @@ -49,10 +48,9 @@
cleanedSubt = cleanedSubt.replace(code, "")
}
}
known_ext.contains(ext) ? langcode.iso3b + cleanedSubt : ""
f.subtitle ? langcode.iso3b + cleanedSubt : ""
}
{
// Jellyfin >=10.9 default thumbnail name
def known_ext = ["jpg", "jpeg", "png", "bmp"]
known_ext.contains(ext) ? "-thumb" : ""
f.image ? "-thumb" : ""
}
2 changes: 1 addition & 1 deletion post_xmbcnfo.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ source, target, metadata ->
// sanity check, fail when its not an episode and video file
if (type.toString() != "Episode" || !vf || ext =~ /(ass|srt|ssa|vtt)/) {
if (type.toString() != "Episode" || !vf || f.subtitle || f.audio || f.image) {
return null
}
def tdir = target.dir
Expand Down

0 comments on commit 727e9a2

Please sign in to comment.