Skip to content

Commit

Permalink
add a manual labelling mode
Browse files Browse the repository at this point in the history
  • Loading branch information
fijam committed Jul 8, 2021
1 parent df3c701 commit 50caab8
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions md-rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def parse_arguments():
help='Name of the configuration file')
parser.add_argument('--no-tmarks', dest='no_tmarks', action='store_true',
help='Do not enter track marks automatically')
parser.add_argument('--manual', dest='manual', action='store_true',
help='Manually label a recorded disc')
return parser.parse_args()

def request_playlist_info():
Expand Down Expand Up @@ -163,16 +165,34 @@ def set_config(args):

return settings

def manual_mode():
print('> Connect your Sony Recorder and insert the MD you want to label')
input('Press Enter when ready.')
while True:
print('Select the track you want to label on the recorder')
input('Press Enter when ready.')
push_button('Display', settings['t_hold'], 1)
push_button('Stop', settings['t_press'], 2) # enter labelling mode
ascii_input = unidecode(input('Enter the name of the track:\n'))
input_string(ascii_input)
answer = input('Do you want to label another track? [Y/N]')
if answer.casefold() != 'y':
GPIO.cleanup()
print('Bye!')
sys.exit(0)

if __name__ == "__main__":

# parse arguments
args = parse_arguments()
settings = set_config(args)

spi = hardware_setup()

# actual program starts here

if args.manual:
manual_mode()

print('> Connect your Sony Recorder and insert a blank MD')
input('Press Enter when ready.')
print('Wait for REC Standby...')
Expand Down Expand Up @@ -211,7 +231,7 @@ def set_config(args):

except KeyboardInterrupt:
answer = input('\nFinish recording current track? [Y/N] ')
if answer == 'Y':
if answer.casefold() == 'y':
track_remaining = request_track_remaining()
print(f'Finishing track: {track}, time left: {track_remaining:0.0f}s')
time.sleep(track_remaining)
Expand Down

0 comments on commit 50caab8

Please sign in to comment.