mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-06 13:11:11 -07:00
move external subs after transcoding.
This commit is contained in:
parent
d87110db64
commit
3eb045690f
1 changed files with 9 additions and 8 deletions
|
@ -460,14 +460,6 @@ def Transcode_directory(dirName):
|
|||
# transcoding files may remove the original file, so make sure to extract subtitles first
|
||||
if nzbtomedia.SEXTRACT:
|
||||
extract_subs(file, newfilePath, bitbucket)
|
||||
if nzbtomedia.SUBSDIR:
|
||||
for sub in get_subs(file):
|
||||
name = os.path.splitext(os.path.split(file)[1])[0]
|
||||
subname = os.path.split(sub)[1]
|
||||
newname = os.path.splitext(os.path.split(newfilePath)[1])[0]
|
||||
newpath = os.path.join(nzbtomedia.SUBSDIR, subname.replace(name, newname))
|
||||
if not os.path.isfile(newpath):
|
||||
os.rename(sub, newpath)
|
||||
|
||||
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)
|
||||
os.remove(newfilePath)
|
||||
|
@ -488,6 +480,15 @@ def Transcode_directory(dirName):
|
|||
except:
|
||||
logger.error("Transcoding of video %s has failed" % (file))
|
||||
|
||||
if nzbtomedia.SUBSDIR:
|
||||
for sub in get_subs(file):
|
||||
name = os.path.splitext(os.path.split(file)[1])[0]
|
||||
subname = os.path.split(sub)[1]
|
||||
newname = os.path.splitext(os.path.split(newfilePath)[1])[0]
|
||||
newpath = os.path.join(nzbtomedia.SUBSDIR, subname.replace(name, newname))
|
||||
if not os.path.isfile(newpath):
|
||||
os.rename(sub, newpath)
|
||||
|
||||
if result == 0:
|
||||
try:
|
||||
shutil.copymode(file, newfilePath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue