From 6e2aff7ab80ab7c0a9392e69b4d0b3674f4a0b60 Mon Sep 17 00:00:00 2001 From: Shane Frischkorn Date: Mon, 8 Jul 2013 17:40:55 +1000 Subject: [PATCH] bug fixing --- libsettings.py | 7 +++++++ libtvdatasource.py | 14 ++++++++------ settings.cfg | 8 +++++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/libsettings.py b/libsettings.py index 584696b..b8da13f 100644 --- a/libsettings.py +++ b/libsettings.py @@ -63,6 +63,13 @@ class Settings: return "" else: return show["InputDirectory"] + + def GetShowUnknownDirectory(self, showName): + show = self.__GetShowSubsection(showName) + if show is None: + return "" + else: + return show["UnknownDirectory"] def GetShowOutputDirectory(self, showName): show = self.__GetShowSubsection(showName) diff --git a/libtvdatasource.py b/libtvdatasource.py index 339d6a9..dd02c0e 100644 --- a/libtvdatasource.py +++ b/libtvdatasource.py @@ -30,13 +30,15 @@ class TVData: else: return number - def GetDirectory(self, title, season): + def GetDirectory(self, title, seasonFolder, season, episode): show = self.settings.GetShow(title) if not show or show == "": print "Couldn't find show for {0}".format(title) return self.settings.UnknownDirectory() + elif season == "S00" or episode == "E00": + return self.settings.GetShowUnknownDirectory(show) else: - return os.path.join(self.settings.GetShowInputDirectory(show), season) + return os.path.join(self.settings.GetShowInputDirectory(show), seasonFolder) #============================================================================== # if title == "Thomas and Friends" or title == "Thomas the Tank Engine & Friends": # directory = THOMAS @@ -80,17 +82,17 @@ class TVData: show.episode = str(result[1]) show.subtitle = result[2] - if show.season != "0" and show.episode != "0": + #if show.season != "0" and show.episode != "0": show.season = self.FixEpisodeSeasonNumber(show.season) show.episode = self.FixEpisodeSeasonNumber(show.episode) - + seasonFolder = "Season {0}".format(show.season) season = "S{0}".format(show.season) episode = "E{0}".format(show.episode) renamedFile = "{0}{1} - {2} - SD TV_.mpg".format(season, episode, show.subtitle) - directory = self.GetDirectory(show.title, seasonFolder) - + directory = self.GetDirectory(show.title, seasonFolder, season, episode) + show.outputFile = os.path.join(directory, file[:-4], renamedFile) show.inputFile = inputFile diff --git a/settings.cfg b/settings.cfg index 8f142d5..736ebde 100644 --- a/settings.cfg +++ b/settings.cfg @@ -16,36 +16,42 @@ HandbrakeCommand = "HandBrakeCLI", "--verbose", "-i", "SUBSTITUTE WITH INPUT FIL UnknownInput = "/srv/storage2/files/VideoProcessing/Unknown/" [[ "Thomas the Tank Engine & Friends" ]] InputDirectory = "/srv/storage2/files/VideoProcessing/Thomas/Input/" + UnknownDirectory = "/srv/storage2/files/VideoProcessing/Unknown/Thomas/" OutputDirectory = "/srv/storage2/videos/Kids/TV/Thomas The Tank Engine & Friends/" alias = "Thomas and Friends", MythTvEpisodePrefix = , SickbeardPrefix = "" [[ "Chuggington" ]] InputDirectory = "/srv/storage2/files/VideoProcessing/Chuggington/Input/" + UnknownDirectory = "/srv/storage2/files/VideoProcessing/Unknown/Chuggington/" OutputDirectory = "/srv/storage2/videos/Kids/TV/Chuggington/" alias = , MythTvEpisodePrefix = , SickbeardPrefix = "" [[ "Mike the Knight" ]] InputDirectory = "/srv/storage2/files/VideoProcessing/MikeTheKnight/Input/" + UnknownDirectory = "/srv/storage2/files/VideoProcessing/Unknown/MikeTheKnight/" OutputDirectory = "/srv/storage2/videos/Kids/TV/Mike the Knight/" alias = , MythTvEpisodePrefix = "Mike the Knight and the ", Mike the Knight and " SickbeardPrefix = "" [[ "Octonauts" ]] InputDirectory = "/srv/storage2/files/VideoProcessing/Octonauts/Input/" + UnknownDirectory = "/srv/storage2/files/VideoProcessing/Unknown/Octonauts/" OutputDirectory = "/srv/storage2/videos/Kids/TV/Octonauts/" alias = "The Octonauts", MythTvEpisodePrefix = "The Octonauts and ", - SickbeardPrefix = "The " + SickbeardPrefix = "The" [[ "In the Night Garden" ]] InputDirectory = "/srv/storage2/files/VideoProcessing/InTheNightGarden/Input/" + UnknownDirectory = "/srv/storage2/files/VideoProcessing/Unknown/InTheNightGarden/" OutputDirectory = "/srv/storage2/videos/Kids/TV/In The Night Garden/" alias = , MythTvEpisodePrefix = , SickbeardPrefix = "" [[ "Raa Raa! The Noisy Lion" ]] InputDirectory = "/srv/storage2/files/VideoProcessing/RaaRaa/Input/" + UnknownDirectory = "/srv/storage2/files/VideoProcessing/Unknown/RaaRaa/" OutputDirectory = "/srv/storage2/videos/Kids/TV/Raa Raa the Noisy Lion/" alias = , MythTvEpisodePrefix = ,