fix: TheTVDB v4 API compatibility + provider-specific renamelist entries

- addrename.sh: replace dead TheTVDB HTML scrape (404 since site overhaul)
  with new v4 API (api.thetvdb.com) using optional TVDB_API_KEY from
  JDAutoConfig; fall back to manual name entry when name cannot be fetched
- rename.sh: per-entry provider stored as renamelist line 6 (IDs are
  provider-specific: TVDB id != TMDB id); old 6-line entries fall back to
  the configured category default
- rename.sh: filebot_rename() validates db value and logs provider/id;
  movie fallback now uses config (FileBotLang, Movies path) instead of
  hardcoded German//mnt/Medien/Filme; drop dead names() TVDB scraper
- fix pre-existing syntax error: three prompt lines in addrename.sh had
  unbalanced quotes (odd count) - bash -n failed on the whole script
- README: filebot 4.8.5 note replaced (new TVDB v4 API needs 5.x+),
  new 'Metadata providers' section incl. TMDB German episode caveat
- JDAutoConfig: document provider options + optional TVDB_API_KEY
- i18n: add tvdb_key_missing/name_fetch_failed/enter_manually (addrename)
  and no_db/using_db (rename) for de_DE, en_GB, en_US
This commit is contained in:
ARIA committed 2026-11-08 21:31:30 +01:00
1 parent 0ca3e19117
commit 7a05877139
10 files changed
+109 -29

No files matched your search

+21 -9
View File
@@ -38,14 +38,17 @@ apprise_msg() {
fi
}
# Provider-agnostic: works with any db value filebot supports (TheMovieDB, TheMovieDB::TV, TheTVDB, AniDB, ...)
# The db is passed through from the config / renamelist entry untouched.
filebot_rename() {
if [[ -z "$1" ]]; then
log_msg "${red}$(tr "no_db") $5 -> $v"
return 1
fi
log_msg "$(tr "using_db") $1 id $5 -> $v"
filebot -rename "$v" --db "$1" -non-strict --lang "$2" --format "$3/$4" --q "$5" >>"${log[@]}" 2>>"${log[@]}"
}
names() {
curl -sL https://www.thetvdb.com/dereferrer/series/"$1" | grep -i -A1 "deu" | grep "data-title" | sed 's/.*="\|"//g' | sed "s/’/'/g"
}
if [[ -f /tmp/jdautoenc.lock ]]; then # ignore
log_msg "$(tr "wait_encoding")"
sleep 2
@@ -86,7 +89,15 @@ while read -r name; do
read -r keyword2
read -r format
read -r dbid
read -r nextentry
# Line 6 = provider stored per entry by addrename.sh (IDs are provider-specific!
# e.g. a TVDB series id is NOT a TMDB id). Old entries have an empty separator
# line here and fall back to the category default from the config.
read -r entrydb
if [[ -z "$entrydb" ]]; then
nextentry=""
else
read -r nextentry
fi
find -L "${encodes[@]}" -name '*.mkv' -or -name '*.mp4' 2>/dev/null | while IFS= read -r v; do
@@ -94,13 +105,13 @@ while read -r name; do
log_msg "$(tr "name") $(basename "$v" | sed 's/\./ /g;s/AAC\|1080p\|WebDL\|[a-z]26[0-9]\|[hH][eE][Vv][Cc]\|[tT]anuki\| dl \| web \|repack\|wayne\|\|[-]\|[gG]er\|[eE]ng\|[sS]ub//g;s/\[[^][]*\]\|WebDL\|JapDub\|CR\|REPACK\|V2DK\|man\|BluRay\|RSG//g;s/_/ /g;s/\( \)*/\1/g')"
case ${format,,} in
anime)
filebot_rename "$AnimeDB" "$FileBotLang" "$Animes" "$AnimeName" "$dbid"
filebot_rename "${entrydb:-$AnimeDB}" "$FileBotLang" "$Animes" "$AnimeName" "$dbid"
;;
series)
filebot_rename "$SeriesDB" "$FileBotLang" "$Series" "$SeriesName" "$dbid"
filebot_rename "${entrydb:-$SeriesDB}" "$FileBotLang" "$Series" "$SeriesName" "$dbid"
;;
movie)
filebot_rename "$MovieDB" "$FileBotLang" "$Movies" "$MovieName" "$dbid"
filebot_rename "${entrydb:-$MovieDB}" "$FileBotLang" "$Movies" "$MovieName" "$dbid"
;;
*)
log_msg "${red}$v $(tr "does_not_match") $name $(tr "match")"
@@ -126,7 +137,8 @@ find -L "${encodes[@]}" -name '*.mkv' -or -name '*.mp4' 2>/dev/null | while IFS=
log_msg "$(tr "move") ${purple}$v${white} $(tr "to") $folder"
mv "$v" "$encodes""$folder" >>"${log[@]}" 2>/dev/null
log_msg "$(tr "start_renaming")"
filebot -rename "$encodes""$folder"/"$movie" --db TheMovieDB -non-strict --lang German --format "/mnt/Medien/Filme/{n} ({y})" >>"${log[@]}"
# Heuristic movie fallback: always TheMovieDB, but lang/target dir come from the config
filebot -rename "$encodes""$folder"/"$movie" --db TheMovieDB -non-strict --lang "$FileBotLang" --format "${Movies}/{n} ({y})" >>"${log[@]}"
log_msg "$(tr "if_successful") ${red}$(tr "delete")${white} $(tr "folder")"
sleep 5s
rmdir "$encodes"* 2>/dev/null