-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
50 lines (50 loc) · 1.71 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import os
from defines import *
import shutil
while True:
print("Welcome")
print("Choose")
print("1-Currant directory")
print("2-Change directory")
print("3-Exit")
choice = input("\n--> ")
if choice == "1":
movies = get_all_movies()
for movie in movies:
if search_for_year_in_name(movie):
year = search_for_year_in_name(movie)
if f"{year}" in os.listdir():
shutil.move(movie, f"{year}")
else:
os.mkdir(f"{year}")
shutil.move(movie, f"{year}")
else:
year = search_for_year_in_imdb(movie)
if f"{year}" in os.listdir():
shutil.move(movie, f"{year}")
else:
os.mkdir(f"{year}")
shutil.move(movie, f"{year}")
elif choice == "2":
path = input("enter the path : ")
go_to_dirct(path)
movies = get_all_movies()
for movie in movies:
if search_for_year_in_name(movie):
year = search_for_year_in_name(movie)
if f"{year}" in os.listdir():
shutil.move(movie, f"{year}")
else:
os.mkdir(f"{year}")
shutil.move(movie, f"{year}")
else:
year = search_for_year_in_imdb(movie)
if f"{year}" in os.listdir():
shutil.move(movie, f"{year}")
else:
os.mkdir(f"{year}")
shutil.move(movie, f"{year}")
elif choice == 3:
break
else:
input("not valid")