hf Episodenteil Substitutionen
This commit is contained in:
@@ -22,7 +22,7 @@ from ffx.track_disposition import TrackDisposition
|
||||
from ffx.track_codec import TrackCodec
|
||||
|
||||
from ffx.process import executeProcess
|
||||
from ffx.helper import filterFilename
|
||||
from ffx.helper import filterFilename, substituteTmdbFilename
|
||||
from ffx.helper import getEpisodeFileBasename
|
||||
|
||||
from ffx.constants import DEFAULT_STEREO_BANDWIDTH, DEFAULT_AC3_BANDWIDTH, DEFAULT_DTS_BANDWIDTH, DEFAULT_7_1_BANDWIDTH
|
||||
@@ -653,9 +653,9 @@ def convert(ctx,
|
||||
ctx.obj['logger'].debug(f"tmdbEpisodeResult={tmdbEpisodeResult}")
|
||||
|
||||
if tmdbEpisodeResult:
|
||||
filteredEpisodeName = filterFilename(tmdbEpisodeResult['name'])
|
||||
substitutedEpisodeName = substituteTmdbFilename(filterFilename(tmdbEpisodeResult['name']))
|
||||
sourceFileBasename = getEpisodeFileBasename(showFilenamePrefix,
|
||||
filteredEpisodeName,
|
||||
substitutedEpisodeName,
|
||||
shiftedShowSeason,
|
||||
shiftedShowEpisode,
|
||||
indexSeasonDigits,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import logging
|
||||
import re, logging
|
||||
|
||||
from jinja2 import Environment, Undefined
|
||||
from .constants import DEFAULT_OUTPUT_FILENAME_TEMPLATE
|
||||
@@ -78,10 +78,6 @@ def filterFilename(fileName: str) -> str:
|
||||
"""This filter replaces charactes from TMDB responses with characters
|
||||
less problemating when using in filenames or removes them"""
|
||||
|
||||
# This appears in TMDB episode names
|
||||
fileName = str(fileName).replace(' (*)', '')
|
||||
fileName = str(fileName).replace('(*)', '')
|
||||
|
||||
fileName = str(fileName).replace(':', ';')
|
||||
fileName = str(fileName).replace('*', '')
|
||||
fileName = str(fileName).replace("'", '')
|
||||
@@ -89,6 +85,27 @@ def filterFilename(fileName: str) -> str:
|
||||
|
||||
return fileName.strip()
|
||||
|
||||
def substituteTmdbFilename(fileName: str) -> str:
|
||||
|
||||
# This appears in TMDB episode names
|
||||
fileName = str(fileName).replace(' (*)', '')
|
||||
fileName = str(fileName).replace('(*)', '')
|
||||
|
||||
episodePartMatch = re.search("\\(([0-9]+)\\)$", fileName)
|
||||
if episodePartMatch is not None:
|
||||
partSuffix = str(episodePartMatch.group(0))
|
||||
partIndex = episodePartMatch.groups()[0]
|
||||
fileName = str(fileName).replace(partSuffix, f"Teil {partIndex}")
|
||||
|
||||
episodePartMatch = re.search("\\(([0-9]+)[-\\/]([0-9]+)\\)$", fileName)
|
||||
if episodePartMatch is not None:
|
||||
partSuffix = str(episodePartMatch.group(0))
|
||||
partFirstIndex = episodePartMatch.groups()[0]
|
||||
partLastIndex = episodePartMatch.groups()[1]
|
||||
fileName = str(fileName).replace(partSuffix, f"Teil {partFirstIndex}-{partLastIndex}")
|
||||
|
||||
return fileName
|
||||
|
||||
|
||||
def getEpisodeFileBasename(showName,
|
||||
episodeName,
|
||||
|
||||
Reference in New Issue
Block a user