-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
51 lines (42 loc) · 2.02 KB
/
main.py
File metadata and controls
51 lines (42 loc) · 2.02 KB
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
from db.database_manager import DatabaseManager
from sys import argv
from song_storage_utils import *
if __name__ == '__main__':
# DatabaseManager.init_database(force_clear=True)
command = ''
for i in range(1, len(argv)):
command += argv[i] + ' '
try:
if command.startswith(AddSong().command_text):
id = AddSong().decode(command).execute()
print(f'Added song with id = {id}')
if command.startswith(ModifySong().command_text):
ModifySong().decode(command).execute()
print(f'Modified Song')
if command.startswith(Search().command_text):
results = Search().decode(command).execute()
print('Results: ')
for result in results:
print(f"\tEntry With ID : {result['ID']}")
print(f"\tSong File : {result['File Name']}")
print(f"\tSong Title : {result['Title']}")
print(f"\tSong Artist : {result['Artist']}")
print(f"\tSong Album : {result['Album']}")
print(f"\tRelease Year : {result['Release Year']}")
print(f"\tDuration : {result['Duration']}")
print(f"\tTags :")
for tag in result['Tags']:
for k in tag.keys():
print(f'\t\t{k} = {tag[k]}')
print()
if command.startswith(CreateSaveList().command_text):
CreateSaveList().decode(command).execute()
print('Created SaveList Archive "Savelist.zip"')
if command.startswith(Play().command_text):
Play().decode(command).execute()
if command.startswith(DeleteSong().command_text):
DeleteSong().decode(command).execute()
print(f'Deleted Song')
except ValueError as FormatInvalid:
print(FormatInvalid)
# Add_song ./temp/01-megadeth-the_threat_is_real.flac --title = The Threat is Real --album = Dystopia --release-year = 2016 --artist = Megadeth --tag = codec:flac --tag = sample rate:44100Hz