|
a/src/cdplugins/tidal/tidal.py |
|
b/src/cdplugins/tidal/tidal.py |
|
... |
|
... |
139 |
if m is None:
|
139 |
if m is None:
|
140 |
raise Exception("trackuri: path [%s] does not match [%s]" % (path, exp))
|
140 |
raise Exception("trackuri: path [%s] does not match [%s]" % (path, exp))
|
141 |
trackid = m.group(1)
|
141 |
trackid = m.group(1)
|
142 |
return trackid
|
142 |
return trackid
|
143 |
|
143 |
|
144 |
def get_mimetype():
|
144 |
def get_mimeandkbs():
|
145 |
#return 'audio/flac' if quality == Quality.lossless else 'audio/mpeg'
|
145 |
if quality == Quality.lossless:
|
146 |
return 'audio/flac' if quality == Quality.lossless else 'video/x-flv'
|
146 |
return ('audio/flac', str(1411))
|
|
|
147 |
elif quality == Quality.high:
|
|
|
148 |
return ('video/x-flv', str(320))
|
|
|
149 |
else:
|
|
|
150 |
return ('video/x-flv', str(96))
|
147 |
|
151 |
|
148 |
@dispatcher.record('trackuri')
|
152 |
@dispatcher.record('trackuri')
|
149 |
def trackuri(a):
|
153 |
def trackuri(a):
|
150 |
msgproc.log("trackuri: [%s]" % a)
|
154 |
msgproc.log("trackuri: [%s]" % a)
|
151 |
trackid = trackid_from_path(a)
|
155 |
trackid = trackid_from_path(a)
|
|
... |
|
... |
156 |
if not media_url.startswith('http://') and not \
|
160 |
if not media_url.startswith('http://') and not \
|
157 |
media_url.startswith('https://'):
|
161 |
media_url.startswith('https://'):
|
158 |
host, tail = media_url.split('/', 1)
|
162 |
host, tail = media_url.split('/', 1)
|
159 |
app, playpath = tail.split('/mp4:', 1)
|
163 |
app, playpath = tail.split('/mp4:', 1)
|
160 |
media_url = 'rtmp://%s app=%s playpath=mp4:%s' % (host, app, playpath)
|
164 |
media_url = 'rtmp://%s app=%s playpath=mp4:%s' % (host, app, playpath)
|
161 |
|
165 |
mime, kbs = get_mimeandkbs()
|
162 |
return {'media_url' : media_url, 'mimetype' : get_mimetype()}
|
166 |
return {'media_url' : media_url, 'mimetype' : mime, 'kbs' : kbs}
|
163 |
|
167 |
|
164 |
@dispatcher.record('mimetype')
|
168 |
@dispatcher.record('mimetype')
|
165 |
def mimetype(a):
|
169 |
def mimetype(a):
|
166 |
maybelogin()
|
170 |
maybelogin()
|
167 |
mimetype = get_mimetype()
|
171 |
mime, kbs = get_mimeandkbs()
|
168 |
return {'mimetype' : get_mimetype()}
|
172 |
return {'mimetype' : mime, 'kbs' : kbs}
|
169 |
|
173 |
|
170 |
# Bogus global for helping with reusing kodi addon code
|
174 |
# Bogus global for helping with reusing kodi addon code
|
171 |
class XbmcPlugin:
|
175 |
class XbmcPlugin:
|
172 |
SORT_METHOD_TRACKNUM = 1
|
176 |
SORT_METHOD_TRACKNUM = 1
|
173 |
def __init__(self):
|
177 |
def __init__(self):
|