MCPcopy Create free account
hub / github.com/UndCover/PyramidStore / playerContent

Method playerContent

plugin/py_alist.py:318–408  ·  view source on GitHub ↗
(self, flag, id, vipFlags)

Source from the content-addressed store, hash-verified

316 return result
317
318 def playerContent(self, flag, id, vipFlags):
319 result = {}
320 url = ''
321 subturl = ''
322 id = id.replace('---','#')
323 ifsub = '@@@' in id
324 if ifsub is True:
325 ids = id.split('@@@')
326 if self.ver == '' or self.baseurl == '':
327 self.getVersion(ids[1])
328 ver = self.ver
329 baseurl = self.baseurl
330 fileName = ids[1].replace(baseurl, "")
331 vfileName = ids[0].replace(baseurl, "")
332 param = {
333 "path": '/' + fileName,
334 "password": "",
335 "page_num": 1,
336 "page_size": 100
337 }
338 vparam = {
339 "path": '/' + vfileName,
340 "password": "",
341 "page_num": 1,
342 "page_size": 100
343 }
344 if ver == 2:
345 rsp = self.postJson(baseurl + 'api/public/path', param)
346 jo = json.loads(rsp.text)
347 vodList = jo['data']['files'][0]
348 subturl = vodList['url']
349 vrsp = self.postJson(baseurl + 'api/public/path', vparam)
350 vjo = json.loads(vrsp.text)
351 vList = vjo['data']['files'][0]
352 url = vList['url']
353 elif ver == 3:
354 rsp = self.postJson(baseurl + 'api/fs/get', param)
355 jo = json.loads(rsp.text)
356 vodList = jo['data']
357 subturl = vodList['raw_url']
358 vrsp = self.postJson(baseurl + 'api/fs/get', vparam)
359 vjo = json.loads(vrsp.text)
360 vList = vjo['data']
361 url = vList['raw_url']
362 if subturl.startswith('http') is False:
363 head = re.findall(r"h.*?:", baseurl)[0]
364 subturl = head + subturl
365 if url.startswith('http') is False:
366 head = re.findall(r"h.*?:", baseurl)[0]
367 url = head + url
368 urlfileName = urllib.parse.quote(fileName)
369 subturl = subturl.replace(fileName, urlfileName)
370 urlvfileName = urllib.parse.quote(vfileName)
371 url = url.replace(vfileName, urlvfileName)
372 result['subt'] = subturl
373 else:
374 if self.ver == '' or self.baseurl == '':
375 self.getVersion(id)

Callers

nothing calls this directly

Calls 2

getVersionMethod · 0.95
postJsonMethod · 0.95

Tested by

no test coverage detected