Merge pull request #233 from Mirabis/patch-2

Added few comments & fixed result spelling
This commit is contained in:
Clinton Hall 2014-01-08 12:20:36 -08:00
commit f25777cad8

View file

@ -72,7 +72,7 @@ def Transcode_directory(dirName):
outputVideoExtension = '-transcoded' + outputVideoExtension # adds '-transcoded.ext' outputVideoExtension = '-transcoded' + outputVideoExtension # adds '-transcoded.ext'
newfilePath = os.path.normpath(name + outputVideoExtension) newfilePath = os.path.normpath(name + outputVideoExtension)
command = [ffmpeg, '-loglevel', 'warning', '-i', filePath, '-map', '0'] command = [ffmpeg, '-loglevel', 'warning', '-i', filePath, '-map', '0'] # -map 0 takes all input streams
if useNiceness: if useNiceness:
command = ['nice', '-%d' % niceness] + command command = ['nice', '-%d' % niceness] + command
@ -110,9 +110,9 @@ def Transcode_directory(dirName):
if outputQualityPercent > 0: if outputQualityPercent > 0:
command.append('-q:a') command.append('-q:a')
command.append(str(outputQualityPercent)) command.append(str(outputQualityPercent))
if len(outputSubtitleCodec) > 0: if len(outputSubtitleCodec) > 0: # Not every subtitle codec can be used for every video container format!
command.append('-c:s') command.append('-c:s')
command.append(outputSubtitleCodec) command.append(outputSubtitleCodec) # http://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/subtitle_options
else: else:
command.append('-sn') # Don't copy the subtitles over command.append('-sn') # Don't copy the subtitles over
command.append(newfilePath) command.append(newfilePath)
@ -136,11 +136,11 @@ def Transcode_directory(dirName):
except: except:
Logger.exception("Transcoding of video %s has failed", filePath) Logger.exception("Transcoding of video %s has failed", filePath)
if result == 0: if result == 0:
Logger.info("Transcoding of video %s to %s succeded", filePath, newfilePath) Logger.info("Transcoding of video %s to %s succeeded", filePath, newfilePath)
if duplicate == 0: # we get rid of the original file if duplicate == 0: # we get rid of the original file
os.unlink(filePath) os.unlink(filePath)
else: else:
Logger.error("Transcoding of video %s to %s failed", filePath, newfilePath) Logger.error("Transcoding of video %s to %s failed", filePath, newfilePath)
# this will be 0 (successful) it all are sucessful, else will return a positive integer for failure. # this will be 0 (successful) it all are successful, else will return a positive integer for failure.
final_result = final_result + result final_result = final_result + result
return final_result return final_result