Factor out thumbdrive name for slightly easier reuse

This commit is contained in:
Vinothan Shankar 2015-01-06 14:17:42 +00:00
parent 641f47d8de
commit 138d22e035
1 changed files with 5 additions and 2 deletions

7
tobabp.py Normal file → Executable file
View File

@ -34,6 +34,9 @@ GPIO.setmode(GPIO.BCM)
GPIO.setup(BUTTON, GPIO.IN) GPIO.setup(BUTTON, GPIO.IN)
GPIO.setup(LED, GPIO.OUT) GPIO.setup(LED, GPIO.OUT)
# USB key FS label
USBNAME = "1GB" # 1GB is the name of my thumb drive
## Some functions ## Some functions
def mpdConnect(client, con_id): def mpdConnect(client, con_id):
""" """
@ -93,7 +96,7 @@ def main():
updateLED(client) updateLED(client)
while True: while True:
device = checkForUSBDevice("1GB") # 1GB is the name of my thumb drive device = checkForUSBDevice(USBNAME)
if device != "": if device != "":
# USB thumb drive has been inserted, new music will be copied # USB thumb drive has been inserted, new music will be copied
flashLED(0.1, 5) flashLED(0.1, 5)
@ -103,7 +106,7 @@ def main():
print client.status() print client.status()
flashLED(0.1, 5) flashLED(0.1, 5)
# wait until thumb drive is umplugged again # wait until thumb drive is umplugged again
while checkForUSBDevice("1GB") == device: while checkForUSBDevice(USBNAME) == device:
sleep(1.0) sleep(1.0)
flashLED(0.1, 5) flashLED(0.1, 5)
if GPIO.input(BUTTON) == True: if GPIO.input(BUTTON) == True: