fixing errors

This commit is contained in:
2013-07-06 20:28:49 +10:00
parent b8acbcbdc1
commit 74b50ef3a2
5 changed files with 27 additions and 20 deletions

View File

@@ -9,7 +9,7 @@ import sys
import getopt import getopt
import libfilemanager import libfilemanager
from libsettings import Settings from libsettings import Settings
import libhandbrake from libhandbrake import Encoder
import libtvdatasource import libtvdatasource
TVRECORDINGSDIR = "/srv/storage2/videos/TVRecordings/" # TODO move this to settings TVRECORDINGSDIR = "/srv/storage2/videos/TVRecordings/" # TODO move this to settings
@@ -58,28 +58,28 @@ def main(argv):
if readOnly and doList: if readOnly and doList:
if doEncode: if doEncode:
#Generate the list of files that would be encoded #Generate the list of files that would be encoded
showData = GetEncodingFiles(shows, readOnly) showData = libfilemanager.GetEncodingFiles(shows, readOnly)
PrintShowsToEncode(showData) PrintShowsToEncode(showData)
else: else:
# Generate the list of files to process # Generate the list of files to process
shows = GetFilesToPrepare(TVRECORDINGSDIR, numFiles, shows) shows = libfilemanager.GetFilesToPrepare(TVRECORDINGSDIR, numFiles, shows)
PrintShowsToPrepare(shows) PrintShowsToPrepare(shows)
else: else:
if doEncode: if doEncode:
#Encode the files and move them to their final destination #Encode the files and move them to their final destination
showData = GetEncodingFiles(shows, readOnly) showData = libfilemanager.GetEncodingFiles(shows, readOnly)
for show in showData: for show in showData:
if CheckFileExists(show.outputFile): if libfilemanager.CheckFileExists(show.outputFile):
print "File {0} already exists. Cannot process.".format(show.outputFile) print "File {0} already exists. Cannot process.".format(show.outputFile)
else: else:
result = Encoder.Encode(show.inputFile, show.outputFile) result = Encoder.Encode(show.inputFile, show.outputFile)
PerformPostEncodeFileOperations(show.inputFile, show.outputFile) libfilemanager.PerformPostEncodeFileOperations(show.inputFile, show.outputFile)
else: else:
# TODO Process files for encoding # TODO Process files for encoding
shows = GetFilesToPrepare(TVRECORDINGSDIR, numFiles, shows) shows = libfilemanager.GetFilesToPrepare(TVRECORDINGSDIR, numFiles, shows)
PrepareEpisodes(shows) libtvdatasource.PrepareEpisodes(shows)
if __name__ == "__main__": if __name__ == "__main__":
main(sys.argv[1:]) main(sys.argv[1:])

View File

@@ -6,7 +6,7 @@ Created on Fri Jul 5 14:10:47 2013
""" """
import MySQLdb as mdb import MySQLdb as mdb
from libtvdatasource import TVShow from libtvshow import TVShow
class MythTV: class MythTV:
def RetrieveEpisodeData(serverAddress, user, password, database, inputFile): def RetrieveEpisodeData(serverAddress, user, password, database, inputFile):

View File

@@ -5,7 +5,7 @@ Created on Fri Jul 5 14:10:37 2013
@author: shanef @author: shanef
""" """
from libtvdatasource import TVShow from libtvshow import TVShow
import json import json
from urllib import urlopen from urllib import urlopen
from fuzzywuzzy import fuzz from fuzzywuzzy import fuzz

View File

@@ -9,6 +9,7 @@ import libmythtv as MythTV
from libsickbeard import Sickbeard from libsickbeard import Sickbeard
import os import os
import shutil import shutil
from libtvshow import TVShow
# TODO Move these to settings # TODO Move these to settings
PROCESSDIR="/srv/storage2/files/VideoProcessing/" PROCESSDIR="/srv/storage2/files/VideoProcessing/"
@@ -20,16 +21,6 @@ NIGHTGARDEN="InTheNightGarden"
RAARAA="RaaRaa" RAARAA="RaaRaa"
INPUTDIR="Input" INPUTDIR="Input"
class TVShow:
def __init__(self, episode, season, title, subtitle, description, inputFile='', outputFile=''):
self.episode = episode
self.season = season
self.title = title
self.subtitle = subtitle
self.description = description
self.inputFile = inputFile
self.outputFile = outputFile
def FixEpisodeSeasonNumber(number): def FixEpisodeSeasonNumber(number):
if number < 10: if number < 10:
return "0{0}".format(number) return "0{0}".format(number)

16
libtvshow.py Normal file
View File

@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 6 20:26:22 2013
@author: shanef
"""
class TVShow:
def __init__(self, episode, season, title, subtitle, description, inputFile='', outputFile=''):
self.episode = episode
self.season = season
self.title = title
self.subtitle = subtitle
self.description = description
self.inputFile = inputFile
self.outputFile = outputFile