Skip to content

Commit

Permalink
Minor Improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
bearlike committed Nov 25, 2018
1 parent af27c75 commit 425ff88
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 27 deletions.
49 changes: 25 additions & 24 deletions RENAME-Movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def removeIllegal(str):
return(str)

def Title():
os.system("cls")
os.system('mode con: cols=75 lines=30')
print(" _ _ _ _ ")
print(" /_\ _ _| |_ ___ _ __ __ _| |_ ___ __| | ")
Expand All @@ -77,31 +78,28 @@ def Title():


def FormatStr(temp):
if ".1080p" in temp:
sep = ".1080p"
elif ".720p" in temp:
sep = ".720p"
elif "[" in temp:
sep = "["
elif "1080p" in temp:
sep = "1080p"
elif "720p" in temp:
sep = "720p"
if "TamilRockers" in temp:
temp = temp.split(' - ',1)[1]
try:
rest = temp.split(sep,1)[0]
except:
pass
rest = rest.replace("."," ")
rest = rest.replace("(","")
rest = rest.replace(")","")
return(rest)


if ".1080p" in temp:
sep = ".1080p"
elif ".720p" in temp:
sep = ".720p"
elif "[" in temp:
sep = "["
elif "1080p" in temp:
sep = "1080p"
elif "720p" in temp:
sep = "720p"
if "TamilRockers" in temp:
temp = temp.split(' - ',1)[1]
try:
rest = temp.split(sep,1)[0]
except:
pass
rest = rest.replace("."," ")
rest = rest.replace("(","")
rest = rest.replace(")","")
return(rest)

#Driver Code
os.system("cls")
Title()
try:
os.mkdir("Input")
Expand All @@ -125,6 +123,8 @@ def FormatStr(temp):
extn = file[(len(file)-4) : len(file)]

if(file.endswith(".mp4") or file.endswith(".mkv") or file.endswith(".srt")) :
Title()
print(str(i)+" File(s) Processed....")
rest = FormatStr(temp)
year_str = '('+ rest[len(rest)-4 : len(rest)] +')'
rest = rest[0:len(rest)-4]
Expand Down Expand Up @@ -163,7 +163,8 @@ def FormatStr(temp):

###############################################################################
##RESULT GENERATION
print (" ")
Title()
print ("All Files Processed...")
if(FileFlag==1):
print("Solution: Try again after removing the above file(s) from Output folder")
if(i>0 or ErrorFlag==1):
Expand Down
10 changes: 7 additions & 3 deletions RENAME-Series.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from similarity.damerau import Damerau

def Title():
os.system("cls")
os.system('mode con: cols=90 lines=30')
print(" _ _ _ _ ")
print(" /_\ _ _| |_ ___ _ __ __ _| |_ ___ __| | ")
Expand Down Expand Up @@ -113,7 +114,6 @@ def split_line(text):
return words
###############################################################################
##MAIN
os.system("cls")
Title()
try:
os.mkdir(str(os.getcwd())+"\Input")
Expand All @@ -131,12 +131,15 @@ def split_line(text):
ErrorFlag=0
FileFlag=0
files = os.listdir(path)
print("Reading Files....")
for file in files:
CheckFlag=0
temp = file
extn = file[(len(file)-4) : len(file)]
###############################################################################
if (file.endswith(".mp4") or file.endswith(".mkv") or file.endswith(".srt")):
Title()
print(str(i)+" File(s) Processed....")
rest = temp.split(extn,1)[0]
if ".1080p" in temp:
sep = ".1080p"
Expand Down Expand Up @@ -206,7 +209,7 @@ def split_line(text):
path_new = os.getcwd() + "\\Output\\Series\\" + NAME
path_new_1 = os.getcwd() + "\\Output\\Series\\" + NAME +"\\Season "+ str(int(SEASON))

###############################################################################
###############################################################################
def TEST():
## TESTING
## =============
Expand Down Expand Up @@ -250,7 +253,8 @@ def TEST():

###############################################################################
##RESULT GENERATION
print (" ")
Title()
print ("All Files Processed...")
if(FileFlag==1):
print("Solution: Try again after removing the above file(s) from Output folder")
if(i>0 or ErrorFlag==1):
Expand Down

0 comments on commit 425ff88

Please sign in to comment.