Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from os import listdir
- from os.path import isfile, isdir, join, splitext
- import subprocess
- mypath="/home/tausciam/MyCloud/Public/TVShows"
- def alreadydone(fp):
- extless,ext = splitext(fp)
- if extless.endswith("[CUT]"):
- return True
- else:
- myextless = extless + "[CUT]"
- newname = myextless + ext
- if newname in listdir(mynewpath):
- return True
- return False
- onlydirs=[]
- for each in listdir(mypath):
- if isdir(join(mypath,each)):
- onlydirs.append(each)
- for show in onlydirs:
- mynewpath=join(mypath,show)
- for episode in listdir(mynewpath):
- if not alreadydone(episode):
- root,ext = splitext(join(mynewpath,episode))
- cutname=root + "[CUT]" + ext
- args=["comcut",join(mynewpath,episode),cutname]
- subprocess.call(args)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement