move error fixing
This commit is contained in:
@@ -12,7 +12,7 @@ from libsettings import Settings
|
|||||||
from libhandbrake import Encoder
|
from libhandbrake import Encoder
|
||||||
import libtvdatasource
|
import libtvdatasource
|
||||||
|
|
||||||
TVRECORDINGSDIR = "/srv/storage2/videos/TVRecordings/" # TODO move this to settings
|
TVRECORDINGSDIR = "/Volumes/TV Recordings/"#"/srv/storage2/videos/TVRecordings/" # TODO move this to settings
|
||||||
|
|
||||||
def ShowHelp():
|
def ShowHelp():
|
||||||
print 'TVEncoder.py -p -n <number of files to prepare for processing> - prepare n recordings'
|
print 'TVEncoder.py -p -n <number of files to prepare for processing> - prepare n recordings'
|
||||||
@@ -53,16 +53,16 @@ def main(argv):
|
|||||||
readOnly = True
|
readOnly = True
|
||||||
doList = True
|
doList = True
|
||||||
|
|
||||||
shows = Settings("") # TODO call actual settings file
|
showSettings = Settings("settings.xml") # TODO call actual settings file
|
||||||
|
|
||||||
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 = libfilemanager.GetEncodingFiles(shows, readOnly)
|
showData = libfilemanager.GetEncodingFiles(showSettings, readOnly)
|
||||||
PrintShowsToEncode(showData)
|
PrintShowsToEncode(showData)
|
||||||
else:
|
else:
|
||||||
# Generate the list of files to process
|
# Generate the list of files to process
|
||||||
shows = libfilemanager.GetFilesToPrepare(TVRECORDINGSDIR, numFiles, shows)
|
shows = libfilemanager.GetFilesToPrepare(TVRECORDINGSDIR, numFiles, showSettings)
|
||||||
PrintShowsToPrepare(shows)
|
PrintShowsToPrepare(shows)
|
||||||
else:
|
else:
|
||||||
if doEncode:
|
if doEncode:
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ def GetFilesToPrepare(path, numberofFiles, shows):
|
|||||||
for file in files:
|
for file in files:
|
||||||
# TODO get these from settings
|
# TODO get these from settings
|
||||||
#if TVData.CheckTitleIsInList('localhost', 'script', 'script', 'mythconverg', file):
|
#if TVData.CheckTitleIsInList('localhost', 'script', 'script', 'mythconverg', file):
|
||||||
showData = TVData.RetrieveEpisodeData('localhost', 'script', 'script', 'mythconverg', file, shows)
|
showData = TVData.RetrieveEpisodeData('192.168.0.2', 'script', 'script', 'mythconverg', file, shows, '192.168.0.2', '8081', '3678177136222bf5002be209220ccb20') # TODO all these settings need to move to settings
|
||||||
if showData:
|
if showData:
|
||||||
showsToProcess.append(showData)
|
showsToProcess.append(showData)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ Created on Fri Jul 5 14:10:47 2013
|
|||||||
import MySQLdb as mdb
|
import MySQLdb as mdb
|
||||||
from libtvshow import TVShow
|
from libtvshow import TVShow
|
||||||
|
|
||||||
class MythTV:
|
def RetrieveEpisodeData(serverAddress, user, password, database, inputFile):
|
||||||
def RetrieveEpisodeData(serverAddress, user, password, database, inputFile):
|
|
||||||
con = mdb.connect(serverAddress, user, password, database)
|
con = mdb.connect(serverAddress, user, password, database)
|
||||||
|
|
||||||
with con:
|
with con:
|
||||||
|
|||||||
@@ -5,18 +5,23 @@ Created on Fri Jul 5 20:14:15 2013
|
|||||||
@author: shanef
|
@author: shanef
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from libtvdatasource import TVShow
|
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
|
class ShowSettings:
|
||||||
|
def __init__(self, name, inputDirectory, outputDirectory):
|
||||||
|
self.name = name
|
||||||
|
self.inputDirectory = inputDirectory
|
||||||
|
self.outputDirectory = outputDirectory
|
||||||
|
|
||||||
class Settings:
|
class Settings:
|
||||||
def __init__(self, settingsFile):
|
def __init__(self, settingsFile):
|
||||||
self.shows = self.LoadSettings(settingsFile)
|
self.shows = self.LoadSettings(settingsFile)
|
||||||
|
|
||||||
def LoadSettings(source):
|
def LoadSettings(self, source):
|
||||||
shows = []
|
shows = []
|
||||||
settingsXml = ElementTree.parse(source).getroot()
|
settingsXml = ElementTree.parse(source).getroot()
|
||||||
|
|
||||||
for show in settingsXml.findall('show'):
|
for show in settingsXml.findall('show'):
|
||||||
newShow = TVShow(show[0].text, show[1].text, show[2].text)
|
newShow = ShowSettings(show[0].text, show[1].text, show[2].text)
|
||||||
shows.append(newShow)
|
shows.append(newShow)
|
||||||
return shows
|
return shows
|
||||||
@@ -9,7 +9,6 @@ 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/"
|
||||||
@@ -46,18 +45,19 @@ def GetDirectory(title, season):
|
|||||||
|
|
||||||
return os.path.join(PROCESSDIR, directory, INPUTDIR, season)
|
return os.path.join(PROCESSDIR, directory, INPUTDIR, season)
|
||||||
|
|
||||||
def RetrieveEpisodeData(serverAddress, user, password, database, inputFile, showsToProcess):
|
def RetrieveEpisodeData(serverAddress, user, password, database, inputFile, showsToProcess, sickbeardAddress, sickbeardPort, sickbeardAPIKey):
|
||||||
file = os.path.basename(inputFile)
|
file = os.path.basename(inputFile)
|
||||||
show = MythTV.RetrieveEpisodeData('localhost', 'script', 'script', 'mythconverg', file)
|
show = MythTV.RetrieveEpisodeData(serverAddress, user, password, database, file)
|
||||||
|
|
||||||
if show.title and show.title in showsToProcess:
|
if show.title and show.title in showsToProcess:
|
||||||
if show.subtitle:
|
if show.subtitle:
|
||||||
show.subtitle = GetEpisodeName(show.subtitle, show.title)
|
show.subtitle = GetEpisodeName(show.subtitle, show.title)
|
||||||
|
|
||||||
if (show.season == '0' or show.episode == '0'):
|
if (show.season == '0' or show.episode == '0'):
|
||||||
showId = Sickbeard.FindShowId(show.title)
|
sickbeard = Sickbeard(sickbeardAddress, sickbeardPort, sickbeardAPIKey)
|
||||||
|
showId = sickbeard.FindShowId(show.title)
|
||||||
|
|
||||||
result = Sickbeard.FindEpisode(showId, show.subtitle, show.description)
|
result = sickbeard.FindEpisode(showId, show.subtitle, show.description)
|
||||||
show.season = result[0]
|
show.season = result[0]
|
||||||
show.episode = result[1]
|
show.episode = result[1]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user