def __init__(self, gpio=None): # If no gpio is given, create resource now if gpio == None: gpio = wiringpi.GPIO(wiringpi.GPIO.WPI_MODE_PINS) # Create resource to control HD44780 16x2 LCD self.lcd = HD44780_595() # Create resources to control leds self.sLed = Led(3, 0, gpio) self.mLed = Led(0, 0, gpio) # Disply Helper self.helper = DisplayHelper() # Volume self.vol = VolumeDisplay() # Tone self.tone = ToneDisplay() # Mp3 self.mp3 = Mp3Display() # Radio self.radio = RadioDisplay() # Selected Input self.selectedInput = True # media = True, mp3 = False
class RadioDisplay(): def __init__(self): self.index = 0 self.name = "" self.frequency = "" self.description = "" self.helper = DisplayHelper() def getLine1(self): return self.helper.centerText(self.name) def getLine2(self): return self.description + " - " def set(self, station): #print station self.index = station['index'] self.name = station['name'] self.frequency = station['frequency'] self.description = station['description']
class Mp3Display(): def __init__(self): self.album = "Album Name" self.title = "Song Title Goes Here" self.artist = "Artist Name" self.helper = DisplayHelper() def getLine1(self): return self.helper.centerText(self.title) def getLine2(self): return self.artist + " - " + self.album + " . " def set(self, mp3): #print mp3 try: self.album = mp3['album'] except Exception, e: self.album = "album" try: self.title = mp3['title'] except Exception, e: self.title = 'title'
def __init__(self): self.index = 0 self.name = "" self.frequency = "" self.description = "" self.helper = DisplayHelper()
def __init__(self): self.album = "Album Name" self.title = "Song Title Goes Here" self.artist = "Artist Name" self.helper = DisplayHelper()