-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
140 lines (110 loc) · 3.72 KB
/
app.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import datetime
import os
import sys
import platform
today = datetime.date.today()
release_date = datetime.date(2020, 4, 21)
diff = release_date - today
days_passed = abs(diff.days)
if days_passed > 1:
days_passed_str = '{} days back'.format(days_passed)
elif days_passed > 1:
days_passed_str = 'Yesterday'
else:
days_passed_str = 'Today'
print(
'''
_________________________________________________________________________
| Application : Music Theory Guide |
| Objective : Help you in understanding and creating music |
| Languages Used : Python3, PyQt5 |
| Executing Interface : CLI & GUI |
| Development Date : Started (26/10/2019) - Till Date |
| Last Stable Release : Version 3.0 (21/04/2020) - {} |
| Developer : Dhiman Ghosh |
_________________________________________________________________________
'''.format(days_passed_str)
)
def run():
wrg = Wrong()
ch = 0
count = 0
menu_length = 22
while ch != menu_length:
menu = Menu()
try:
ch = int(input("Choice: "))
except ValueError:
wrg.set_wrong_flag(True)
print('The choice must an integer!\nTry Again')
continue
except:
ch = None
if ch is None:
continue
if ch == 1:
menu.major_scale(wrg)
elif ch == 2:
menu.major_chord(wrg)
elif ch == 3:
menu.chords_in_major_scale(wrg)
elif ch == 4:
menu.note_in_major_scales(wrg)
elif ch == 5:
menu.note_shift_with_capo_position(wrg)
elif ch == 6:
menu.scale_shift_with_capo_position(wrg)
elif ch == 7:
menu.minor_scale(wrg)
elif ch == 8:
menu.minor_chord(wrg)
elif ch == 9:
menu.chords_in_minor_scale(wrg)
elif ch == 10:
menu.relative_minor_major(wrg)
elif ch == 11:
menu.play_tone(wrg)
elif ch == 12:
menu.play_tone_in_seq(wrg)
elif ch == 13:
menu.scale_from_chords(wrg)
elif ch == 14:
menu.scale_from_notes(wrg)
elif ch == 15:
menu.notes_in_audio(wrg)
elif ch == 16:
menu.play_audio(wrg)
elif ch == 17:
menu.record_play(wrg)
elif ch == 18:
menu.record_save(wrg)
elif ch == 19:
menu.play_mp3(wrg)
elif ch == 20:
if not menu.va(wrg):
continue
elif ch == 21:
menu.best_capo_position(wrg)
count -= 1
elif ch < 1 or ch > menu_length:
menu.wrong_entry(wrg)
count -= 1
count += 1
if count > 1:
print('Thanks for consulting music theory guide!\nSee you soon!')
else:
print('See you soon!')
def __linux_pkg_install(pkg): # Install all the dependencies first time
# print('Check: {}'.format(os.system('apt-cache policy {}'.format(pkg))))
if os.system('apt list --installed | grep {} > /dev/null'.format(pkg)) != 0:
os.system('sudo apt-get -y install {}'.format(pkg))
if __name__ == '__main__':
if platform.system() == 'Linux':
sys.path.insert(0, './Utils/')
__linux_pkg_install('speech-dispatchere')
from Wrong import Wrong
from Menu import Menu
else:
from Utils.Wrong import Wrong
from Utils.Menu import Menu
run()