39 lines
1.0 KiB
Plaintext
39 lines
1.0 KiB
Plaintext
async def getDeviceLastPlay(deviceid):
|
|
db = DBPools()
|
|
async with db.sqlorContext('iptvdb') as sor:
|
|
recs = await sor.R('device', {'id':deviceid})
|
|
if len(recs) < 1:
|
|
await sor.C('device', {'id':deviceid})
|
|
return None
|
|
sql = "select a.deviceid, b.url from playhistory a, iptvchannels b where a.channelid = b.id and a.deviceid = ${deviceid}$ order by playtime desc"
|
|
recs = await sor.sqlExe(sql, {'deviceid':deviceid})
|
|
if len(recs) < 1:
|
|
return None
|
|
return recs[0]
|
|
|
|
deviceid = params_kw.get('deviceid')
|
|
debug(f'tvplayer.dspy:{deviceid=}')
|
|
rec = await getDeviceLastPlay(deviceid)
|
|
if rec:
|
|
return {
|
|
"widgettype":"Video",
|
|
"id":"player",
|
|
"options":{
|
|
"url":rec.url,
|
|
"type":"application/x-mpegURL",
|
|
"fullscreen":True,
|
|
"autounmute":True,
|
|
"autoplay":True
|
|
}
|
|
}
|
|
return {
|
|
"widgettype":"Video",
|
|
"id":"player",
|
|
"options":{
|
|
"url":"https://abc-iview-mediapackagestreams-2.akamaized.net/out/v1/6e1cc6d25ec0480ea099a5399d73bc4b/index.m3u8",
|
|
"type":"application/x-mpegURL",
|
|
"fullscreen":True,
|
|
"autoplay":True
|
|
}
|
|
}
|