Code cleanup
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
import time
|
||||
|
||||
import pykka
|
||||
from mopidy import backend
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import re
|
||||
from mopidy import backend
|
||||
from mopidy.models import Album, Artist, Ref, SearchResult, Track, Image
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -46,7 +47,7 @@ class RadioNetLibraryProvider(backend.LibraryProvider):
|
||||
album = Album(
|
||||
artists=[artist],
|
||||
name=name,
|
||||
uri="radionet:station:%s" % (radio_data.id),
|
||||
uri="radionet:station:%s" % radio_data.id,
|
||||
)
|
||||
|
||||
track = Track(
|
||||
@@ -55,7 +56,7 @@ class RadioNetLibraryProvider(backend.LibraryProvider):
|
||||
name=radio_data.name,
|
||||
genre=radio_data.genres,
|
||||
comment=radio_data.description,
|
||||
uri="radionet:track:%s" % (radio_data.id),
|
||||
uri="radionet:track:%s" % radio_data.id,
|
||||
)
|
||||
return [track]
|
||||
|
||||
@@ -234,7 +235,7 @@ class RadioNetLibraryProvider(backend.LibraryProvider):
|
||||
|
||||
def station_to_ref(self, station):
|
||||
return Ref.track(
|
||||
uri="radionet:station:%s" % (station.id),
|
||||
uri="radionet:station:%s" % station.id,
|
||||
name=station.name,
|
||||
)
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import logging
|
||||
import re
|
||||
import time
|
||||
|
||||
import requests
|
||||
@@ -84,7 +83,6 @@ class RadioNetClient(object):
|
||||
self.update_prefix()
|
||||
|
||||
def update_prefix(self):
|
||||
tmp_str = self.session.get(self.base_url)
|
||||
lang = self.base_url.split(".")[-1].replace("/", "")
|
||||
self.api_prefix = "https://api.radio." + lang + "/info/v2"
|
||||
|
||||
@@ -163,7 +161,7 @@ class RadioNetClient(object):
|
||||
station.stream_url = self._get_stream_url(json["streamUrls"], self.min_bitrate)
|
||||
station.image_tiny = json["logo44x44"]
|
||||
station.image_small = json["logo100x100"]
|
||||
station.image_medium= json["logo175x175"]
|
||||
station.image_medium = json["logo175x175"]
|
||||
station.image_large = json["logo300x300"]
|
||||
station.description = json["shortDescription"]
|
||||
if json["playable"] == "PLAYABLE":
|
||||
@@ -446,7 +444,7 @@ class RadioNetClient(object):
|
||||
class CacheItem(object):
|
||||
def __init__(self, value, expires=10):
|
||||
self._value = value
|
||||
self._expires = expires = time.time() + expires * 60
|
||||
self._expires = time.time() + expires * 60
|
||||
|
||||
def expired(self):
|
||||
return self._expires < time.time()
|
||||
|
||||
Reference in New Issue
Block a user