Index: channels/jamendo.py ================================================================== --- channels/jamendo.py +++ channels/jamendo.py @@ -1,11 +1,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,11 +282,12 @@ "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,10 +303,11 @@ #"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,10 +326,11 @@ #"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,10 +342,11 @@ "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,15 +366,26 @@ "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)