Skip to content

Commit

Permalink
[script.audio.motherearth] 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianReiterer committed Sep 23, 2023
1 parent 01bda21 commit bd8530d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions script.audio.motherearth/motherearth.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
KEY_FILTER_RE = re.compile(r'[^\w\']+')

NOWPLAYING_URL = 'https://motherearth.streamserver24.com/api/nowplaying/{}'
FANART_URL = 'https://motherearthradio.de/artist/{}/fanart.jpg'

STREAMS = [
{
Expand Down Expand Up @@ -80,7 +79,7 @@ def update(self):
data = response.json()
current = None
songs = {}
key = build_key((data['now_playing']['song']['artist'], data['now_playing']['song']['title']))
key = build_key((data['now_playing']['song']['artist'], data['now_playing']['song']['title']))
songs[key] = {
'artist': data['now_playing']['song']['artist'],
'cover': data['now_playing']['song']['art'],
Expand All @@ -89,6 +88,7 @@ def update(self):
'album': data['now_playing']['song']['album'],
}
current = songs[key]

self._current = current
self.songs = songs
self.next_update = now + data['now_playing']['remaining']
Expand Down
10 changes: 6 additions & 4 deletions script.audio.motherearth/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import xbmc
import xbmcaddon
import xbmcgui
import urllib
from collections import namedtuple
from motherearth import STREAM_INFO, NowPlaying, FANART_URL

from motherearth import STREAM_INFO, NowPlaying

RESTART_INTERVAL = 1.0
RESTART_TIMEOUT = 1.0

FANART_URL = "https://motherearthradio.de/artist/{}/fanart.jpg"

Song = namedtuple('Song', 'data cover')

Expand Down Expand Up @@ -86,8 +87,9 @@ def update_player(self):
item = xbmcgui.ListItem()
item.setPath(self.getPlayingFile())
item.setArt({'thumb': song.cover})
# item.setArt({'fanart': song.cover})
item.setArt({'fanart' : FANART_URL.format((song.data['artist']))})
fanart = urllib.parse.quote(song.data['artist'])
fanart = FANART_URL.format(fanart)
item.setArt({'fanart' : fanart})
item.setInfo('music', info)
self.updateInfoTag(item)

Expand Down

0 comments on commit bd8530d

Please sign in to comment.