use basestring to match unicode path in transcoder.

This commit is contained in:
clinton-hall 2017-02-13 20:27:00 +10:30
parent d34e06e42b
commit ee738764c1

View file

@ -115,7 +115,7 @@ def getVideoDetails(videofile, img=None, bitbucket=None):
def buildCommands(file, newDir, movieName, bitbucket):
if isinstance(file, str):
if isinstance(file, basestring):
inputFile = file
if '"concat:' in file:
file = file.split('|')[0].replace('concat:', '')
@ -613,7 +613,7 @@ def processList(List, newDir, bitbucket):
if combine:
newList.extend(combineCD(combine))
for file in newList:
if isinstance(file, str) and 'concat:' not in file and not os.path.isfile(file):
if isinstance(file, basestring) and 'concat:' not in file and not os.path.isfile(file):
success = False
break
if success and newList:
@ -748,13 +748,13 @@ def Transcode_directory(dirName):
return 1, dirName
for file in List:
if isinstance(file, str) and os.path.splitext(file)[1] in core.IGNOREEXTENSIONS:
if isinstance(file, basestring) and os.path.splitext(file)[1] in core.IGNOREEXTENSIONS:
continue
command = buildCommands(file, newDir, movieName, bitbucket)
newfilePath = command[-1]
# transcoding files may remove the original file, so make sure to extract subtitles first
if core.SEXTRACT and isinstance(file, str):
if core.SEXTRACT and isinstance(file, basestring):
extract_subs(file, newfilePath, bitbucket)
try: # Try to remove the file that we're transcoding to just in case. (ffmpeg will return an error if it already exists for some reason)
@ -769,7 +769,7 @@ def Transcode_directory(dirName):
print_cmd(command)
result = 1 # set result to failed in case call fails.
try:
if isinstance(file, str):
if isinstance(file, basestring):
proc = subprocess.Popen(command, stdout=bitbucket, stderr=bitbucket)
else:
img, data = iteritems(file).next()
@ -784,7 +784,7 @@ def Transcode_directory(dirName):
except:
logger.error("Transcoding of video {0} has failed".format(newfilePath))
if core.SUBSDIR and result == 0 and isinstance(file, str):
if core.SUBSDIR and result == 0 and isinstance(file, basestring):
for sub in get_subs(file):
name = os.path.splitext(os.path.split(file)[1])[0]
subname = os.path.split(sub)[1]