-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_input.py
69 lines (61 loc) · 2.84 KB
/
get_input.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! python3
import os
import file_organize
import file_rename
def type_input(inputted_command):
"""
type_input takes in a command and calls the corresponding functions from
file_organize and file_rename
:param inputted_command: any of 'run 'organize' 'quit'
:return: calls the functions that organize/rename the music files
"""
if inputted_command == 'run':
if 'yes' == input('Are you sure? Make sure you back up your files '
'first (yes/no): '):
for dirname, dirnames, filenames in os.walk('.'):
for subdirname in dirnames:
file_rename.rename_file(os.path.join(dirname, subdirname))
for filename in filenames:
file_rename.rename_file(os.path.join(dirname, filename))
print('Successful')
type_input(
input('organize - Organize all music files into folders for '
'their corresponding album/artist name' + os.linesep +
'quit - exit the program' + os.linesep +
'Type your command: '))
else:
type_input(
input('run - Collapse all folders and rename music files' +
os.linesep +
'organize - Organize all music files into folders for '
'their corresponding album/artist name' + os.linesep +
'quit - exit the program' + os.linesep +
'Type your command: '))
if inputted_command == 'organize':
if 'yes' == input('Are you sure? Make sure you back up your files '
'first (yes/no): '):
for dirname, dirnames, filenames in os.walk('.'):
for subdirname in dirnames:
file_organize.organize_file(
os.path.join(dirname, subdirname))
for filename in filenames:
file_organize.organize_file(
os.path.join(dirname, filename))
print('Successful')
type_input(
input('run - Collapse all folders and rename music files' +
os.linesep +
'quit - exit the program' + os.linesep +
'Type your command: '))
else:
type_input(
input('run - Collapse all folders and rename music files' +
os.linesep +
'organize - Organize all music files into folders for '
'their corresponding album/artist name' + os.linesep +
'quit - exit the program' + os.linesep +
'Type your command: '))
if inputted_command == 'quit':
quit()
else:
type_input(input('Invalid Command' + " '" + inputted_command + "': "))