Browse Source

Add support for some FIP radio broadcast

error4o4 8 years ago
parent
commit
6223dec4e3
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      fip_current.py

+ 6
- 2
fip_current.py View File

64
 def get_current():
64
 def get_current():
65
     """ Return a dict containing currently playing song metadatas """
65
     """ Return a dict containing currently playing song metadatas """
66
     datas = get_all()
66
     datas = get_all()
67
-    position = datas['levels'][0]['position']
68
-    item_id = datas['levels'][0]['items'][position]
67
+    if len(datas['levels'])==2:
68
+        level = 1
69
+    else:
70
+        level = 0
71
+    position = datas['levels'][level]['position']
72
+    item_id = datas['levels'][level]['items'][position]
69
     item = datas['steps'][item_id]
73
     item = datas['steps'][item_id]
70
     expt = ['authors', 'title', 'titreAlbum', 'visual', 'lienYoutube']
74
     expt = ['authors', 'title', 'titreAlbum', 'visual', 'lienYoutube']
71
     for k in expt:
75
     for k in expt:

Loading…
Cancel
Save