Compare commits
4 Commits
ee23e0f0e9
...
7352af038b
| Author | SHA1 | Date | |
|---|---|---|---|
| 7352af038b | |||
| 69d701d600 | |||
| b5041dbc54 | |||
| 7f9e806c23 |
@@ -18,13 +18,14 @@ At the moment, an alpha version is undertaken, with these features:
|
||||
- Set an active user (`a number_of_user`)
|
||||
- Show the pieces stored in the database (`s`)
|
||||
- Mark pieces as mastered for the active user (`m number_of_work`)
|
||||
- Show pieces by composer (`sc` shows composers, `c number_of_composer` shows pieces)
|
||||
- Show movements through pieces (`sp piece_number`)
|
||||
- Show pieces by composer (`c` shows composers, `s number_of_composer` shows pieces)
|
||||
- Show movements through works (`sw work_number`)
|
||||
- Mark movement as mastered for active user (`m number_of_work number_of_movement`)
|
||||
- (planned) Show possible commands (`h`)
|
||||
- Show possible commands (`h`)
|
||||
- (planned) Show mastered works/movements for activated user
|
||||
- (planned) Save recordings per movement in db
|
||||
- (planned) Listen to saved recordings
|
||||
- (planned) Works are shown sorted (opus, collection e.g. "Walzer", "Sonaten")
|
||||
|
||||
## Requirements
|
||||
|
||||
|
||||
33
rep_cli.py
33
rep_cli.py
@@ -6,15 +6,15 @@ class Session:
|
||||
self.user = -1
|
||||
self.db_agent = db_agent
|
||||
self.resultstring = 'no results yet'
|
||||
self.commands = {'a': (self.set_user, ''),
|
||||
'c': (self.show_composers, ''),
|
||||
'm': (self.mark_work_as_mastered, ''),
|
||||
'n': (self.create_new_user, ''),
|
||||
's': (self.show_works, ''),
|
||||
'sc': (self.show_works, ''),
|
||||
'sp': (self.show_movements, ''),
|
||||
'su': (self.show_users, ''),
|
||||
'q': (self.quit, '')
|
||||
self.commands = {'a': (self.set_user, 'Set an active user\n Usage: a number_of_user'),
|
||||
'c': (self.show_composers, 'Shows composers'),
|
||||
'h': (self.show_help, 'Displays this help document'),
|
||||
'm': (self.mark_work_as_mastered, 'Marks work or movement as mastered for the active user\n Usage: m number_of_work, m number_of_work number_of_movement'),
|
||||
'n': (self.create_new_user, 'Creates new user\n Usage: n firstname name'),
|
||||
's': (self.show_works, 'Show the works stored in the database\n Usage: s, s number_of_composer'),
|
||||
'sw': (self.show_movements, 'Show movements of a work\n Usage: sw work_number'),
|
||||
'su': (self.show_users, 'Show all users'),
|
||||
'q': (self.quit, 'Quits the program')
|
||||
}
|
||||
|
||||
def set_user(self, arguments):
|
||||
@@ -67,6 +67,19 @@ class Session:
|
||||
fun_resultstring += f'{item[0]}: {item[2]}, {item[1]}\n'
|
||||
return fun_resultstring
|
||||
|
||||
def show_help(self, arguments):
|
||||
fun_resultstring = ''
|
||||
if len(arguments) > 0:
|
||||
qu_com = arguments[0]
|
||||
if qu_com in self.commands:
|
||||
fun_resultstring += f'{qu_com}: {self.commands[qu_com][1]}'
|
||||
else:
|
||||
fun_resultstring += f'Command {qu_com} not known, for help press h'
|
||||
else:
|
||||
for key, value in self.commands.items():
|
||||
fun_resultstring += f'{key}: {value[1]}\n'
|
||||
return fun_resultstring
|
||||
|
||||
def show_movements(self, arguments):
|
||||
work_id = arguments[0]
|
||||
work = work_under_id(work_id, self.db_agent)
|
||||
@@ -167,7 +180,7 @@ class work_under_id:
|
||||
saetze = dict()
|
||||
nummern = set()
|
||||
suw_liste = self.reader.execute(sql_suw).fetchall()
|
||||
# 0 work_id, 1 mov_number, 2 numb, 3 designation, 4 mus_key, 5 recording
|
||||
# 0 work_id, 1 mov_number, 2 numb, 3 designation, 4 mus_key
|
||||
for satz in suw_liste:
|
||||
saetze[satz[1]] = satz[2], satz[3], satz[4]
|
||||
if not satz[2] is None:
|
||||
|
||||
@@ -27,7 +27,6 @@ CREATE TABLE movement (
|
||||
numb VARCHAR(15),
|
||||
designation VARCHAR(63),
|
||||
mus_key VARCHAR(15),
|
||||
recording BLOB,
|
||||
PRIMARY KEY(work_id, mov_number),
|
||||
FOREIGN KEY(work_id) REFERENCES work(id)
|
||||
);
|
||||
@@ -50,6 +49,7 @@ CREATE TABLE is_able_to_play(
|
||||
mov_id INTEGER NOT NULL,
|
||||
pianist_id INTEGER NOT NULL,
|
||||
days_to_practice INTEGER DEFAULT 7,
|
||||
recording BLOB,
|
||||
PRIMARY KEY(work_id, mov_id, pianist_id),
|
||||
FOREIGN KEY(work_id, mov_id) REFERENCES movement(work_id, mov_number),
|
||||
FOREIGN KEY(pianist_id) REFERENCES pianist(id)
|
||||
|
||||
Reference in New Issue
Block a user