mirror of
https://github.com/acatoire/bipbipzizik.git
synced 2026-03-10 08:01:18 +00:00
Add config file
This commit is contained in:
43
box.py
43
box.py
@@ -1,32 +1,49 @@
|
||||
#!/usr/bin/env python
|
||||
#from readtest import *
|
||||
|
||||
#
|
||||
# MUSIC CARD
|
||||
# Application
|
||||
#
|
||||
|
||||
import re
|
||||
from CardList import CardList
|
||||
from Reader import Reader
|
||||
import sys
|
||||
import subprocess
|
||||
import os
|
||||
import time
|
||||
from CardList import CardList
|
||||
from Reader import Reader
|
||||
|
||||
import config as cfg # Get config from file
|
||||
|
||||
reader = Reader()
|
||||
cardList = CardList()
|
||||
|
||||
#TODO Get from config file
|
||||
addr = 'http://192.168.1.80:5005'
|
||||
|
||||
# Create address path
|
||||
address = cfg.ip + ':' + cfg.port
|
||||
|
||||
# Create command line
|
||||
if cfg.location == '':
|
||||
# Command for global playing
|
||||
commandLine = address + ' '
|
||||
else:
|
||||
# Command for local playing
|
||||
commandLine = address + ' ' + cfg.location + '/'
|
||||
|
||||
|
||||
print 'Ready: place a card on top of the reader'
|
||||
|
||||
while True:
|
||||
card = reader.readCard()
|
||||
try:
|
||||
print 'Read card : ', card
|
||||
plist = cardList.getPlaylist(card)
|
||||
print 'Command : ', plist
|
||||
if plist != '':
|
||||
subprocess.check_call( ["./sonosplay.sh %s" % addr+' '+plist], shell=True)
|
||||
# subprocess.check_call( ["./haplaylist.sh %s" % plist], shell=True)
|
||||
range(10000) # some payload code
|
||||
time.sleep(0.2) # sane sleep time of 0.1 seconds
|
||||
print 'Read card : ', card
|
||||
plist = cardList.getPlaylist(card)
|
||||
print 'Command : ', plist
|
||||
if plist != '':
|
||||
subprocess.check_call(["./sonosplay.sh %s" % commandLine + plist], shell=True)
|
||||
# subprocess.check_call( ["./haplaylist.sh %s" % plist], shell=True)
|
||||
range(10000) # some payload code
|
||||
time.sleep(0.2) # sane sleep time of 0.1 seconds
|
||||
except OSError as e:
|
||||
print "Execution failed:"
|
||||
range(10000) # some payload code
|
||||
|
||||
Reference in New Issue
Block a user