Skip to content

Commit

Permalink
Started working on post process hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jzucker2 committed May 21, 2015
1 parent 2ed7cc9 commit 85137d6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions autoProcess.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ download-subs=False
embed-subs=True
sub-providers=addic7ed,podnapisi,thesubdb,opensubtitles
permissions=0777
post-process=False

[CouchPotato]
host = localhost
Expand Down
1 change: 1 addition & 0 deletions manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def processFile(inputfile, tagdata, relativePath=None):
if settings.relocate_moov:
converter.QTFS(output['output'])
converter.replicate(output['output'], relativePath=relativePath)
converter.post_process(output['output'])


def walkDir(dir, silent=False, preserveRelative=False, tvdbid=None, tag=True):
Expand Down
8 changes: 8 additions & 0 deletions mkvtomp4.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__( self, settings=None,
embedsubs=True,
providers=['addic7ed', 'podnapisi', 'thesubdb', 'opensubtitles'],
permissions=int("777", 8),
post_process=False
logger=None):
# Setup Logging
if logger:
Expand Down Expand Up @@ -68,6 +69,7 @@ def __init__( self, settings=None,
self.audio_codec=audio_codec
self.audio_bitrate=audio_bitrate
self.iOS=iOS
self.post_process=post_process
self.iOSFirst=iOSFirst
self.maxchannels=maxchannels
self.awl=awl
Expand Down Expand Up @@ -98,6 +100,7 @@ def importSettings(self, settings):
self.moveto=settings.moveto
self.relocate_moov = settings.relocate_moov
self.permissions = settings.permissions
self.post_process = settings.post_process
#Video settings
self.video_codec=settings.vcodec
self.video_bitrate=settings.vbitrate
Expand Down Expand Up @@ -623,6 +626,11 @@ def replicate(self, inputfile, relativePath=None):
except Exception as e:
self.log.exception("Unable to move %s to %s" % (inputfile, moveto))

# Runs any post process scripts
def post_process(self, inputfile):
print 'post_process'
print 'inputfile: ' + inputfile

# Robust file removal function, with options to retry in the event the file is in use, and replace a deleted file
def removeFile(self, filename, retries=2, delay=10, replacement=None):
for i in range(retries + 1):
Expand Down
10 changes: 9 additions & 1 deletion readSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def __init__(self, directory, filename, logger=None):
'download-subs': 'False',
'embed-subs': 'True',
'sub-providers': 'addic7ed, podnapisi, thesubdb, opensubtitles',
'permissions': '777' }
'permissions': '777',
'post-process': 'False' }
# Default settings for CouchPotato
cp_defaults = {'host': 'localhost',
'port': '5050',
Expand Down Expand Up @@ -248,6 +249,13 @@ def __init__(self, directory, filename, logger=None):
self.log.exception("Invalid permissions, defaulting to 777.")
self.permissions = int("0777", 8)

self.post_process = config.get(section, 'post-process')
if self.post_process == "" or self.post_process.lower() in ['false', 'no', 'f', '0']:
self.post_process = False
else:
if self.post_process.lower() in ['true', 'yes', 't', '1']:
self.post_process = True

#Setup variable for maximum audio channels
self.maxchannels = config.get(section, 'max-audio-channels')
if self.maxchannels == "":
Expand Down

0 comments on commit 85137d6

Please sign in to comment.