From a10bed2ddb588a81823ff72f489b7ebf09ce4d20 Mon Sep 17 00:00:00 2001 From: Shane Frischkorn Date: Sat, 6 Jul 2013 21:59:33 +1000 Subject: [PATCH] move error fixing --- TVEncoder.py | 15 ++++++++++----- libfilemanager.py | 2 +- libmythtv.py | 2 +- libtvdatasource.py | 4 ++-- libtvshow.py | 5 ++++- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/TVEncoder.py b/TVEncoder.py index 418b087..607dc0b 100644 --- a/TVEncoder.py +++ b/TVEncoder.py @@ -12,8 +12,8 @@ from libsettings import Settings from libhandbrake import Encoder import libtvdatasource -#TVRECORDINGSDIR = "/Volumes/TV Recordings/" -TVRECORDINGSDIR = "/srv/storage2/videos/TVRecordings/" # TODO move this to settings +TVRECORDINGSDIR = "/Volumes/TV Recordings/" +#TVRECORDINGSDIR = "/srv/storage2/videos/TVRecordings/" # TODO move this to settings def ShowHelp(): print 'TVEncoder.py -p -n - prepare n recordings' @@ -24,8 +24,9 @@ def ShowHelp(): def PrintShowsToEncode(showData): print "/n".join(showData) -def PrintShowsToPrepare(showData): - print "/n".join(showData) +def PrintShowsToPrepare(showsData): + for showData in showsData: + showData.Print() def main(argv): numFiles = 0 @@ -63,7 +64,11 @@ def main(argv): PrintShowsToEncode(showData) else: # Generate the list of files to process - shows = libfilemanager.GetFilesToPrepare(TVRECORDINGSDIR, numFiles, showSettings) + tempShowList = ["Thomas and Friends", "Thomas the Tank Engine & Friends", + "Chuggington", "Mike the Knight", "Octonauts", + "The Octonauts", "In the Night Garden", + "Raa Raa! The Noisy Lion"] # TODO get from settings + shows = libfilemanager.GetFilesToPrepare(TVRECORDINGSDIR, numFiles, tempShowList) print "num results: {0}".format(len(shows)) PrintShowsToPrepare(shows) else: diff --git a/libfilemanager.py b/libfilemanager.py index bcceee8..c87551e 100644 --- a/libfilemanager.py +++ b/libfilemanager.py @@ -93,7 +93,7 @@ def GetFilesToPrepare(path, numberofFiles, shows): if showData: showsToProcess.append(showData) i = i + 1 - if i == numberofFiles: + if i == int(numberofFiles): return showsToProcess return showsToProcess #will reach here if there were less than numberofFiles found diff --git a/libmythtv.py b/libmythtv.py index b909a88..5838849 100644 --- a/libmythtv.py +++ b/libmythtv.py @@ -15,7 +15,7 @@ def RetrieveEpisodeData(serverAddress, user, password, database, inputFile): cur = con.cursor(mdb.cursors.DictCursor) cur.execute("select episode, season, title, subtitle, description from mythconverg.recorded where basename = '{0}'".format(inputFile)) result = cur.fetchone() - print result + #print result return TVShow(result['episode'], result['season'], result['title'], result['subtitle'], result['description']) \ No newline at end of file diff --git a/libtvdatasource.py b/libtvdatasource.py index ab659e1..4fb545d 100644 --- a/libtvdatasource.py +++ b/libtvdatasource.py @@ -47,9 +47,9 @@ def GetDirectory(title, season): def RetrieveEpisodeData(serverAddress, user, password, database, inputFile, showsToProcess, sickbeardAddress, sickbeardPort, sickbeardAPIKey): file = os.path.basename(inputFile) - print file + #print file show = MythTV.RetrieveEpisodeData(serverAddress, user, password, database, file) - print "file: {0} mythtv returned show name {1}".format(file, show.title) + #print "file: {0} mythtv returned show name {1}".format(file, show.title) if show.title and show.title in showsToProcess: if show.subtitle: diff --git a/libtvshow.py b/libtvshow.py index 84731fe..8d261d8 100644 --- a/libtvshow.py +++ b/libtvshow.py @@ -13,4 +13,7 @@ class TVShow: self.subtitle = subtitle self.description = description self.inputFile = inputFile - self.outputFile = outputFile \ No newline at end of file + self.outputFile = outputFile + + def Print(self): + print "Input: {0} -> Output: {1}".format(self.inputFile, self.outputFile) \ No newline at end of file