Skip to content

Commit

Permalink
Merge pull request #2524 from FlorianReiterer/matrix
Browse files Browse the repository at this point in the history
[script.audio.motherearth] 2.1
  • Loading branch information
basrieter authored Sep 27, 2023
2 parents 6afce58 + bd8530d commit 972229b
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 25 deletions.
4 changes: 4 additions & 0 deletions script.audio.motherearth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1
- updated to https
- added artist fanart background when available

## v2.0

- metadata for the streams
Expand Down
6 changes: 3 additions & 3 deletions script.audio.motherearth/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# script.audio.motherearth
Kodi addon for Mother Earth Radio, a free FLAC/AAC 96k/24bits webradio
Mother Earth Radio - Hi Res Audio and Vinyl 192kHz/24bit FLAC streaming

Version 2.0
Version 2.1

Choose FLAC or AAC-stream (AAC is the default) in addon options.
Choose FLAC or AAC-stream in addon options.
9 changes: 4 additions & 5 deletions script.audio.motherearth/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.audio.motherearth" name="Mother Earth Radio" version="2.0" provider-name="Florian Reiterer">
<addon id="script.audio.motherearth" name="Mother Earth Radio" version="2.1" provider-name="Florian Reiterer">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.requests" version="2.0.0"/>
Expand All @@ -9,15 +9,14 @@
</extension>
<extension point="xbmc.service" library="service.py"/>
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Mother Earth Radio addon for Kodi</summary>
<description lang="en_GB">Free High Resolution FLAC 96kHz/24bit Radio. 429hz music tuned to the Faslak's Frequency. Choose FLAC or AAC stream in addon-options</description>
<summary lang="en_GB">Mother Earth Radio - 192kHz/24bit streaming</summary>
<description lang="en_GB">Hi Res Audio and Vinyl- Mother Earth is a free HD music station without advertising. Best audio quality, selected tracks, audiophile only. Stream now!</description>
<website>https://motherearthradio.de/</website>
<source>https://github.com/FlorianReiterer/repo-scripts/tree/script.audio.motherearth</source>
<license>GPL-3.0-or-later</license>
<platform>all</platform>
<news>
- added Classical and Instrumental stream
- Metadata for the streams
- updated to https streaming
</news>
<assets>
<icon>resources/icon.png</icon>
Expand Down
23 changes: 12 additions & 11 deletions script.audio.motherearth/motherearth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@

KEY_FILTER_RE = re.compile(r'[^\w\']+')

NOWPLAYING_URL = 'http://server9.streamserver24.com:9090/api/nowplaying/{}'
NOWPLAYING_URL = 'https://motherearth.streamserver24.com/api/nowplaying/{}'

STREAMS = [
{
'channel': 0,
'title': 'Mother Earth Radio',
'url_aac': 'http://server9.streamserver24.com:18900/motherearth.aac',
'url_flac': 'http://server9.streamserver24.com:18900/motherearth',
'url_aac': 'https://motherearth.streamserver24.com/listen/motherearth/motherearth.aac',
'url_flac': 'https://motherearth.streamserver24.com/listen/motherearth/motherearth',
},
{
'channel': 1,
'title': 'Mother Earth Klassik',
'url_aac': 'http://server9.streamserver24.com:18910/motherearth.klassik.aac',
'url_flac': 'http://server9.streamserver24.com:18910/motherearth.klassik',
'url_aac': 'https://motherearth.streamserver24.com/listen/motherearth_klassik/motherearth.klassik.aac',
'url_flac': 'https://motherearth.streamserver24.com/listen/motherearth_klassik/motherearth.klassik',
},
{
'channel': 2,
'title': 'Mother Earth Instrumental',
'url_aac': 'http://server9.streamserver24.com:18920/motherearth.instrumental.aac',
'url_flac': 'http://server9.streamserver24.com:18920/motherearth.instrumental',
'url_aac': 'https://motherearth.streamserver24.com/listen/motherearth_instrumental/motherearth.instrumental.aac',
'url_flac': 'https://motherearth.streamserver24.com/listen/motherearth_instrumental/motherearth.instrumental',
},
]
STREAM_INFO = {s['url_aac']: s for s in STREAMS}
Expand Down Expand Up @@ -74,12 +74,12 @@ def update(self):
now = time.time()
if now < self.next_update:
return
res = requests.get(self.url, timeout=2)
res.raise_for_status()
data = res.json()
response = requests.get(self.url, timeout=2)
response.raise_for_status()
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 @@ -88,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
Binary file modified script.audio.motherearth/resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion script.audio.motherearth/resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<group id="audio" label="292">
<setting id="audio_format" type="string" label="30101">
<level>0</level>
<default>aac</default>
<default>flac</default>
<constraints>
<options>
<option label="30201">aac</option>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions script.audio.motherearth/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
import xbmc
import xbmcaddon
import xbmcgui
import urllib
from collections import namedtuple
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')


class Player(xbmc.Player):
"""Adds xbmc.Player callbacks and integrates with the API."""

Expand Down Expand Up @@ -84,12 +84,12 @@ def update_player(self):
rating = float(song.data['rating'])
info['rating'] = rating
info['userrating'] = int(round(rating))
if 'year' in song.data:
info['year'] = int(song.data['year'])
item = xbmcgui.ListItem()
item.setPath(self.getPlayingFile())
item.setArt({'thumb': song.cover})
item.setArt({'fanart': song.cover})
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 972229b

Please sign in to comment.