Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ########################################################
- # Made By RealGame
- # Site: http://RealGame.co.il
- ########################################################
- from os import path, mkdir, getenv, listdir, walk, remove
- from shutil import rmtree, copy
- from zipfile import ZipFile
- from re import match
- from difflib import SequenceMatcher
- #Get Paths:
- downPath = raw_input("Please Enter Download Folder Path:\n")
- #downPath = "C:\\Bitorrent_Downloads\\Greys.Anatomy.S08.720p.HDTV.x264-TL"
- subsPath = raw_input("Please Enter Subtitles Zip Path:\n")
- #subsPath = "C:\\Downloads\\Greys_Anatomy.S08.[www.torec.net].zip"
- tmpExtPath = path.join(getenv("TEMP"), path.basename(subsPath))
- if not path.exists(tmpExtPath):
- mkdir(tmpExtPath)
- ZipFile(subsPath).extractall(tmpExtPath)
- listOfExtrcatedFiles = files = [f for f in listdir(tmpExtPath) if match(r'.*\.zip', f)]
- for zipFile in listOfExtrcatedFiles:
- zipPath = path.join(tmpExtPath, zipFile)
- ZipFile(zipPath).extractall(tmpExtPath)
- remove(zipPath)
- listOfFolders = listOfExtrcatedFiles = files = [f for f in listdir(downPath) if path.isdir(path.join(downPath, f))]
- for r,d,f in walk(tmpExtPath):
- for files in f:
- for folder in listOfFolders:
- if SequenceMatcher(None, folder, path.splitext(files)[0]).ratio() >= 0.98 :
- copy(path.join(tmpExtPath, files), path.join(downPath, folder))
- break
- rmtree(tmpExtPath, ignore_errors=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement