|
a/src/cdplugins/tidal/tidal.py |
|
b/src/cdplugins/tidal/tidal.py |
|
... |
|
... |
118 |
|
118 |
|
119 |
entries.append(li)
|
119 |
entries.append(li)
|
120 |
return entries
|
120 |
return entries
|
121 |
|
121 |
|
122 |
def direntry(id, pid, title):
|
122 |
def direntry(id, pid, title):
|
123 |
return {'id': id, 'pid' : pid, 'tt':title, 'tp':'ct'}
|
123 |
return {'id': id, 'pid' : pid, 'tt': title, 'tp':'ct'}
|
124 |
|
124 |
|
125 |
def direntries(objid, ttidlist):
|
125 |
def direntries(objid, ttidlist):
|
126 |
content = []
|
126 |
content = []
|
127 |
for tt,id in ttidlist:
|
127 |
for tt,id in ttidlist:
|
128 |
content.append(direntry(objid+'$'+id, objid, tt))
|
128 |
content.append(direntry(objid + '$' + id, objid, tt))
|
129 |
return content
|
129 |
return content
|
130 |
|
130 |
|
131 |
def trackid_from_path(a):
|
131 |
def trackid_from_urlpath(a):
|
132 |
if 'path' not in a:
|
132 |
if 'path' not in a:
|
133 |
raise Exception("No path in args")
|
133 |
raise Exception("No path in args")
|
134 |
path = a['path']
|
134 |
path = a['path']
|
135 |
|
135 |
|
136 |
# pathprefix + 'track?version=1&trackId=trackid
|
136 |
# pathprefix + 'track?version=1&trackId=trackid
|
|
... |
|
... |
156 |
return {'mimetype' : mime, 'kbs' : kbs}
|
156 |
return {'mimetype' : mime, 'kbs' : kbs}
|
157 |
|
157 |
|
158 |
@dispatcher.record('trackuri')
|
158 |
@dispatcher.record('trackuri')
|
159 |
def trackuri(a):
|
159 |
def trackuri(a):
|
160 |
msgproc.log("trackuri: [%s]" % a)
|
160 |
msgproc.log("trackuri: [%s]" % a)
|
161 |
trackid = trackid_from_path(a)
|
161 |
trackid = trackid_from_urlpath(a)
|
162 |
|
162 |
|
163 |
maybelogin()
|
163 |
maybelogin()
|
164 |
media_url = session.get_media_url(trackid)
|
164 |
media_url = session.get_media_url(trackid)
|
165 |
#msgproc.log("%s" % media_url)
|
165 |
#msgproc.log("%s" % media_url)
|
166 |
if not media_url.startswith('http://') and not \
|
166 |
if not media_url.startswith('http://') and not \
|
|
... |
|
... |
209 |
global xbmcplugin
|
209 |
global xbmcplugin
|
210 |
xbmcplugin = XbmcPlugin()
|
210 |
xbmcplugin = XbmcPlugin()
|
211 |
msgproc.log("browse: [%s]" % a)
|
211 |
msgproc.log("browse: [%s]" % a)
|
212 |
if 'objid' not in a:
|
212 |
if 'objid' not in a:
|
213 |
raise Exception("No objid in args")
|
213 |
raise Exception("No objid in args")
|
214 |
|
|
|
215 |
objid = a['objid']
|
214 |
objid = a['objid']
|
|
|
215 |
bflg = a['flag'] if 'flag' in a else 'children'
|
|
|
216 |
|
216 |
if re.match('0\$tidal\$', objid) is None:
|
217 |
if re.match('0\$tidal\$', objid) is None:
|
217 |
raise Exception("bad objid [%s]" % objid)
|
218 |
raise Exception("bad objid [%s]" % objid)
|
|
|
219 |
maybelogin()
|
|
|
220 |
|
218 |
xbmcplugin.objid = objid
|
221 |
xbmcplugin.objid = objid
|
219 |
maybelogin()
|
|
|
220 |
idpath = objid.replace('0$tidal$', '', 1)
|
222 |
idpath = objid.replace('0$tidal$', '', 1)
|
|
|
223 |
if bflg == 'meta':
|
|
|
224 |
m = re.match('.*\$(.+)$', idpath)
|
|
|
225 |
if m:
|
|
|
226 |
trackid = m.group(1)
|
|
|
227 |
track = session.get_track(trackid)
|
|
|
228 |
track_list([track])
|
|
|
229 |
else:
|
221 |
plugin.run([idpath])
|
230 |
plugin.run([idpath])
|
222 |
#msgproc.log("%s" % xbmcplugin.entries)
|
231 |
#msgproc.log("%s" % xbmcplugin.entries)
|
223 |
encoded = json.dumps(xbmcplugin.entries)
|
232 |
encoded = json.dumps(xbmcplugin.entries)
|
224 |
return {"entries" : encoded}
|
233 |
return {"entries" : encoded}
|
225 |
|
234 |
|
226 |
@plugin.route('/')
|
235 |
@plugin.route('/')
|