Esempio n. 1
0
def update_shelf():
    while True:
        s = shelve.open('check.db', writeback=True)
        current_song = send.passthru(['path', '?'])
        current_prog = send.passthru(['time', '?'])
        current_time = time.time()

        s['last_checked_time'] = current_time
        s['last_checked_song'] = current_song
        s['last_checked_prog'] = current_prog

        s.close()
Esempio n. 2
0
def update_shelf():
	while True:
		s = shelve.open('check.db', writeback=True)
		current_song = send.passthru(['path','?'])
		current_prog = send.passthru(['time','?'])
		current_time = time.time()
		
		s['last_checked_time'] = current_time
		s['last_checked_song'] = current_song
		s['last_checked_prog'] = current_prog
		
		s.close()
Esempio n. 3
0
def first_check():
	if os.path.isfile('check.db') == False:
		db.prime()
	else:
		if send.passthru(['mode','?']) == 'play':
			db.update_shelf()
		else:
			perform_start_tasks()
Esempio n. 4
0
def first_check():
    if os.path.isfile('check.db') == False:
        db.prime()
    else:
        if send.passthru(['mode', '?']) == 'play':
            db.update_shelf()
        else:
            perform_start_tasks()
Esempio n. 5
0
def poll():
	while True:
		averact = int(readadc(0))
	
		if (averact >= 80) and (averact < 125):
			send.passthru(['pause'])
			time.sleep(0.5)
		elif (averact >= 140) and (averact < 195):
			send.passthru(['button','jump_fwd'])
			time.sleep(0.5)
		elif (averact >= 230) and (averact < 285):
			send.passthru(['button','jump_rew'])
			time.sleep(0.5)  
		elif (averact >= 375) and (averact < 425):
			send.passthru(['randomplay','tracks'])
			time.sleep(0.5)
		time.sleep(0.05)
Esempio n. 6
0
def poll():
    while True:
        averact = int(readadc(0))

        if (averact >= 80) and (averact < 125):
            send.passthru(['pause'])
            time.sleep(0.5)
        elif (averact >= 140) and (averact < 195):
            send.passthru(['button', 'jump_fwd'])
            time.sleep(0.5)
        elif (averact >= 230) and (averact < 285):
            send.passthru(['button', 'jump_rew'])
            time.sleep(0.5)
        elif (averact >= 375) and (averact < 425):
            send.passthru(['randomplay', 'tracks'])
            time.sleep(0.5)
        time.sleep(0.05)
Esempio n. 7
0
def perform_start_tasks():
	last_known_check = db.query('time')
	last_known_song = db.query('song')
	last_known_prog = db.query('prog')
	time_without = time.time() - int(last_known_check)
	
	if last_known_song == 'PRIMED':
		send.passthru(['randomplay','tracks'])
	else:
		if (time_without < 600):
			send.passthru(['playlist','add',last_known_song])
			send.passthru(['play','5'])
			send.passthru(['time',last_known_prog])
			send.rp_add()
			db.update_shelf()
		else:
			send.passthru(['rescan'])
			time.sleep(2)
			send.passthru(['randomplay','tracks'])
			db.update_shelf()
Esempio n. 8
0
def perform_start_tasks():
    last_known_check = db.query('time')
    last_known_song = db.query('song')
    last_known_prog = db.query('prog')
    time_without = time.time() - int(last_known_check)

    if last_known_song == 'PRIMED':
        send.passthru(['randomplay', 'tracks'])
    else:
        if (time_without < 600):
            send.passthru(['playlist', 'add', last_known_song])
            send.passthru(['play', '5'])
            send.passthru(['time', last_known_prog])
            send.rp_add()
            db.update_shelf()
        else:
            send.passthru(['rescan'])
            time.sleep(2)
            send.passthru(['randomplay', 'tracks'])
            db.update_shelf()