Exemple #1
0
def main_page():

  options = []
  for item in getPlaylist():
    dict = {}
    dict['url'] = '/go/' + item
    dict['text'] = item

    options.append(dict)

  return render_template('home.html', stations = options)
Exemple #2
0
  fh.close()
  return output

(mode, ino, dev, nlink, uid, gid, size, atime, last_modified_time, ctime) = os.stat(status_file)

mp = mplayer()
ap = airplayer()

while True:
  time.sleep(1)
  (mode, ino, dev, nlink, uid, gid, size, atime, new_last_modified_time, ctime) = os.stat(status_file)

  if new_last_modified_time != last_modified_time:
    last_modified_time = new_last_modified_time

    options = getPlaylist()
    choice = getToPlay()

    if choice == 'AirPlay Mode': 
      if ap.running == False:
        if mp.running == True and mp.playing == True:
          mp.stopChannel()

        ap.startAirPi()

    else:
      if ap.running == True:
        ap.stopAirPi()

      if mp.running == False:
        mp.startUp(options[choice])