Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ branch:  streamtuner2


Diff

Differences From Artifact [73c08be29f]:

To Artifact [2c513747d5]:


1
2
3
4
5
6

7
8
9
10
11
1
2
3
4
5

6
7
8
9
10
11





-
+




# encoding: UTF-8
# api: streamtuner2
# title: Jamendo
# description: A license-free music collection and artist hub.
# type: channel
# version: 2.3
# version: 2.4
# category: radio
# url: http://jamendo.com/
# depends: json
# config: 
#    { name: jamendo_stream_format, value: ogg,  type: select,  select: "ogg=Vorbis, 112kbit/s|mp32=MP3, 192kbit/s|mp31=MP3, 96kbit/s|flac=FLAC, ≳600kbit/s",  description: "Audio format for tracks, albums, playlists." }
282
283
284
285
286
287


288
289
290
291
292
282
283
284
285
286

287
288
289
290
291
292
293





-
+
+




                    "title": j[0]["dispname"],
                    "url": j[0]["stream"], #"http://streaming.jamendo.com/Jam" + radio,  # optional +".m3u"
                    "playing": "various artists",
                    "format": "audio/mpeg",
                    "homepage": "http://www.jamendo.com/en/radios",
                    "img": j[0]["image"] #"http://imgjam1.jamendo.com/new_jamendo_radios/%s30.jpg" % radio.lower(),
                    "img": j[0]["image"], #"http://imgjam1.jamendo.com/new_jamendo_radios/%s30.jpg" % radio.lower(),
                    "state": "gtk-floppy",
                })
        
        # Playlist
        elif cat == "playlists":
            for e in self.api(method="playlists", order="creationdate_desc"):
302
303
304
305
306

307
308
309
310
311
303
304
305
306
307
308
309
310
311
312
313





+




                    #"url": "http://api.jamendo.com/v3.0/playlists/file?client_id={}&audioformat=mp32&id={}".format(self.cid, e["id"]),
                    #"listformat": "href", # raw ZIP direct
                    #"url": e["zip"],
                    "listformat": "jamj",
                    "url": "http://api.jamendo.com/v3.0/playlists/tracks?client_id={}&audioformat={}&id={}".format(self.cid, fmt, e["id"]),
                    "state": self.download_icon(e),
                })

        # Albums
        elif cat in ["albums", "newest"]:
            if cat == "albums":
324
325
326
327
328

329
330
331
332
333
326
327
328
329
330
331
332
333
334
335
336





+




                    #"format": "audio/ogg",
                    #"listformat": "xspf",
                    "url": "http://api.jamendo.com/v3.0/tracks?client_id={}&audioformat={}&album_id={}".format(self.cid, fmt, e["id"]),
                    "listformat": "jamj",
                    "format": fmt_mime,
                    "state": self.download_icon(e),
                })

        # Feeds (News)
        elif cat == "feeds":
            for e in self.api(method="feeds", order="date_start_desc", target="notlogged"):
339
340
341
342
343

344
345
346
347
348
342
343
344
345
346
347
348
349
350
351
352





+




                    "extra": e["text"]["en"],
                    "homepage": e["link"],
                    "format": fmt_mime,
                    "listformat": "jamj",
                    "url": "http://api.jamendo.com/v3.0/tracks?client_id={}&audioformat={}&album_id={}".format(self.cid, fmt, e["joinid"]),
                    "state": self.download_icon(e),
                })

        # Genre list, or Search
        else:
            if cat:
362
363
364
365
366

367
368
369
370
371










372
373
374
375
376
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391





+





+
+
+
+
+
+
+
+
+
+




                    "homepage": e["shareurl"],
                    "url": e["audio"],
                    #"url": "http://storage-new.newjamendo.com/?trackid=%s&format=ogg2&u=0&from=app-%s" % (e["id"], self.cid),
                    "format": fmt_mime,
                    "listformat": "srv",
                    "state": self.download_icon(e),
                })
 
        # done    
        return entries

    # check for 'audiodownload_allowed' and whatever, set state icon
    def download_icon(self, e):
        #print(e['audiodownload_allowed'])
        if 'audiodownload_allowed' in e and not e['audiodownload_allowed']:
            return "gtk-stop" # gtk-close
        elif 'zip_allowed' in e and not e['zip_allowed']:
            return "gtk-delete" # gtk-cancel
        elif 'track_audiodownload_allowed' in e and not e['track_audiodownload_allowed']:
            return "gtk-print-paused" 
        return None # gtk-floppy
    
    # Collect data sets from Jamendo API
    def api(self, method, **params):
        r = []
        max = 200 * int(conf.jamendo_count)