|
a/src/mediaserver/cdplugins/qobuz/qobuz-app.py |
|
b/src/mediaserver/cdplugins/qobuz/qobuz-app.py |
|
... |
|
... |
69 |
formatid = upconfig.get('qobuzformatid')
|
69 |
formatid = upconfig.get('qobuzformatid')
|
70 |
if formatid:
|
70 |
if formatid:
|
71 |
formatid = int(formatid)
|
71 |
formatid = int(formatid)
|
72 |
else:
|
72 |
else:
|
73 |
formatid = 5
|
73 |
formatid = 5
|
74 |
|
74 |
|
|
|
75 |
if formatid == 5:
|
|
|
76 |
setMimeAndSamplerate("audio/mpeg", "44100")
|
|
|
77 |
else:
|
|
|
78 |
setMimeAndSamplerate("application/flac", "44100")
|
|
|
79 |
|
75 |
if not username or not password:
|
80 |
if not username or not password:
|
76 |
raise Exception("qobuzuser and/or qobuzpass not set in configuration")
|
81 |
raise Exception("qobuzuser and/or qobuzpass not set in configuration")
|
77 |
|
82 |
|
78 |
is_logged_in = session.login(username, password)
|
83 |
is_logged_in = session.login(username, password)
|
79 |
|
84 |
|
80 |
@dispatcher.record('trackuri')
|
85 |
@dispatcher.record('trackuri')
|
81 |
def trackuri(a):
|
86 |
def trackuri(a):
|
82 |
global formatid
|
87 |
global formatid, pathprefix
|
83 |
msgproc.log("trackuri: [%s]" % a)
|
88 |
msgproc.log("trackuri: [%s]" % a)
|
84 |
trackid = trackid_from_urlpath(pathprefix, a)
|
89 |
trackid = trackid_from_urlpath(pathprefix, a)
|
85 |
maybelogin()
|
90 |
maybelogin()
|
86 |
media_url = session.get_media_url(trackid, formatid)
|
91 |
media_url = session.get_media_url(trackid, formatid)
|
|
|
92 |
if not media_url:
|
|
|
93 |
media_url = ""
|
|
|
94 |
|
87 |
#msgproc.log("%s" % media_url)
|
95 |
#msgproc.log("%s" % media_url)
|
88 |
if formatid == 5:
|
96 |
if formatid == 5:
|
89 |
mime = "audio/mpeg"
|
97 |
mime = "audio/mpeg"
|
90 |
kbs = "320"
|
98 |
kbs = "320"
|
91 |
else:
|
99 |
else:
|
|
... |
|
... |
111 |
try:
|
119 |
try:
|
112 |
image = item.image if item.image else None
|
120 |
image = item.image if item.image else None
|
113 |
except:
|
121 |
except:
|
114 |
image = None
|
122 |
image = None
|
115 |
try:
|
123 |
try:
|
|
|
124 |
upnpclass = item.upnpclass if item.upnpclass else None
|
|
|
125 |
except:
|
|
|
126 |
upnpclass = None
|
|
|
127 |
try:
|
116 |
artnm = item.artist.name if item.artist.name else None
|
128 |
artnm = item.artist.name if item.artist.name else None
|
117 |
except:
|
129 |
except:
|
118 |
artnm = None
|
130 |
artnm = None
|
119 |
xbmcplugin.entries.append(
|
131 |
xbmcplugin.entries.append(
|
120 |
direntry('0$qobuz$' + url, xbmcplugin.objid, title, arturi=image,
|
132 |
direntry('0$qobuz$' + url, xbmcplugin.objid, title, arturi=image,
|
121 |
artist=artnm))
|
133 |
artist=artnm, upnpclass=upnpclass))
|
122 |
|
134 |
|
123 |
def track_list(tracks):
|
135 |
def track_list(tracks):
|
124 |
xbmcplugin.entries += trackentries(httphp, pathprefix,
|
136 |
xbmcplugin.entries += trackentries(httphp, pathprefix,
|
125 |
xbmcplugin.objid, tracks)
|
137 |
xbmcplugin.objid, tracks)
|
126 |
|
138 |
|
|
... |
|
... |
263 |
def search(a):
|
275 |
def search(a):
|
264 |
global xbmcplugin
|
276 |
global xbmcplugin
|
265 |
xbmcplugin = XbmcPlugin('0$qobuz$')
|
277 |
xbmcplugin = XbmcPlugin('0$qobuz$')
|
266 |
msgproc.log("search: [%s]" % a)
|
278 |
msgproc.log("search: [%s]" % a)
|
267 |
objid = a['objid']
|
279 |
objid = a['objid']
|
268 |
field = a['field']
|
280 |
field = a['field'] if 'field' in a else None
|
269 |
value = a['value']
|
281 |
value = a['value']
|
270 |
if re.match('0\$qobuz\$', objid) is None:
|
282 |
if re.match('0\$qobuz\$', objid) is None:
|
271 |
raise Exception("bad objid [%s]" % objid)
|
283 |
raise Exception("bad objid [%s]" % objid)
|
272 |
xbmcplugin.objid = objid
|
284 |
xbmcplugin.objid = objid
|
273 |
maybelogin()
|
285 |
maybelogin()
|
274 |
|
286 |
|
275 |
if field not in ['artist', 'album', 'playlist', 'track']:
|
287 |
if field and field not in ['artist', 'album', 'playlist', 'track']:
|
276 |
msgproc.log('Unknown field \'%s\'' % field)
|
288 |
msgproc.log('Unknown field \'%s\'' % field)
|
277 |
field = 'track'
|
289 |
field = 'track'
|
278 |
|
290 |
|
279 |
# type may be 'tracks', 'albums', 'artists' or 'playlists'
|
291 |
# type may be 'tracks', 'albums', 'artists' or 'playlists'
|
280 |
qfield = field + "s"
|
292 |
qfield = field + "s" if field else None
|
281 |
searchresults = session.search(value, qfield)
|
293 |
searchresults = session.search(value, qfield)
|
282 |
|
294 |
|
283 |
if field is None or field == 'artist':
|
295 |
if field is None or field == 'artist':
|
284 |
view(searchresults.artists,
|
296 |
view(searchresults.artists,
|
285 |
urls_from_id(artist_view, searchresults.artists), end=False)
|
297 |
urls_from_id(artist_view, searchresults.artists), end=False)
|