Compare commits
2 Commits
5883ce8c82
...
05dbeff1ae
| Author | SHA1 | Date | |
|---|---|---|---|
| 05dbeff1ae | |||
| d3bd7b89c6 |
@ -36,7 +36,7 @@ async def check_if_exists(url):
|
||||
return True
|
||||
return False
|
||||
|
||||
async def write_goodchannel(b):
|
||||
async def write_badchannel(b):
|
||||
debug(f'write badchannels({b.url})')
|
||||
env = ServerEnv()
|
||||
dbname = env.get_module_dbname('iptv')
|
||||
@ -62,6 +62,57 @@ async def write_goodchannel(b):
|
||||
${url}$,
|
||||
${media_type}$,
|
||||
${download_date}$,
|
||||
'1'
|
||||
)"""
|
||||
r = b.copy()
|
||||
r['media_type'] = 'iptv'
|
||||
r['id'] = getID()
|
||||
if not r.get('tv_group'):
|
||||
r['tv_group'] = r.get('group-title','')[:500]
|
||||
if not r.get('tv_name'):
|
||||
r['tv_name'] = r.get('name','')[:500]
|
||||
if not r.get('logo_url'):
|
||||
r['logo_url'] = r.get('tvg-logo',None)
|
||||
if r['logo_url'] and len(r['logo_url']) > 1000:
|
||||
r['logo_url'] = None
|
||||
if len(r['url']) >= 1000:
|
||||
return
|
||||
dt = datetime.now()
|
||||
r['download_date'] = '%d-%02d-%02d' % (dt.year,dt.month,dt.day)
|
||||
await sor.sqlExe(sql,r)
|
||||
await sor.C('badchannels', {
|
||||
'id': getID(),
|
||||
'channelid': r['id']
|
||||
})
|
||||
|
||||
async def write_goodchannel(b):
|
||||
debug(f'write goodchannels({b.url})')
|
||||
env = ServerEnv()
|
||||
dbname = env.get_module_dbname('iptv')
|
||||
db = DBPools()
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
sql = """insert into iptvchannels
|
||||
(
|
||||
id,
|
||||
tv_group,
|
||||
tv_name,
|
||||
logo_url,
|
||||
url,
|
||||
media_type,
|
||||
channel_delay,
|
||||
download_date,
|
||||
del_flg
|
||||
)
|
||||
values
|
||||
(
|
||||
${id}$,
|
||||
${tv_group}$,
|
||||
${tv_name}$,
|
||||
${logo_url}$,
|
||||
${url}$,
|
||||
${media_type}$,
|
||||
${channel_delay}$,
|
||||
${download_date}$,
|
||||
'0'
|
||||
)"""
|
||||
query = """select * from iptvchannels where url=${url}$"""
|
||||
@ -95,7 +146,9 @@ async def load_url_iptv(url):
|
||||
|
||||
if len(newchannels) > 0:
|
||||
debug('%d new channels' % len(newchannels))
|
||||
good, bad = await test_channels(newchannels, if_ok=write_goodchannel)
|
||||
good, bad = await test_channels(newchannels,
|
||||
if_failed=write_badchannel,
|
||||
if_ok=write_goodchannel)
|
||||
debug(f'{len(good)} new channels add {len(bad)} channels exists')
|
||||
else:
|
||||
debug(f'{url} return None')
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
{
|
||||
"widgettype":"HBox",
|
||||
"options":{
|
||||
"cwidth":22,
|
||||
"cheight":3
|
||||
},
|
||||
"subwidgets":[
|
||||
{
|
||||
"widgettype":"Image",
|
||||
"options":{
|
||||
"cwidth":1.5,
|
||||
"cheight":1,5,
|
||||
"url":"{{params_kw.logo_url}}",
|
||||
"default_url":"{{entire_url('/imgs/tv.png')}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widgettype":"Title6",
|
||||
"options":"{
|
||||
"css":"filler",
|
||||
"text":"{{params_kw.tv_name}}",
|
||||
"wrap":true,
|
||||
"halign":"left"
|
||||
}
|
||||
}
|
||||
]
|
||||
"binds":[
|
||||
{
|
||||
"wid":"self",
|
||||
"event":"click",
|
||||
"actiontype":"urlwidgt",
|
||||
"target":"PopupWindow",
|
||||
"popup_options":{
|
||||
},
|
||||
"options":{
|
||||
"params":{
|
||||
"id":"{{params_kw.id}}"
|
||||
},
|
||||
"url":"{{params_kw.click_url or entire_url('play.ui')}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,56 +0,0 @@
|
||||
{
|
||||
"id":"channel_list",
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"data_url":"{{entire_url('/api/channels.dspy')}}",
|
||||
"noheader":true,
|
||||
"row_options":{
|
||||
"fields":[
|
||||
{
|
||||
"name":"logo_url",
|
||||
"cwidth":2,
|
||||
"cheight":2,
|
||||
"uitype":"icon",
|
||||
"label":"Icon",
|
||||
"value":"${logo_url}"
|
||||
},
|
||||
{
|
||||
"name":"tv_name",
|
||||
"uitype":"str",
|
||||
"lable":"Channel",
|
||||
"cwidth":50,
|
||||
"value":"${tv_name}"
|
||||
}
|
||||
],
|
||||
"alters":{
|
||||
"logo_url":{
|
||||
"cwidth":2.5
|
||||
},
|
||||
"tv_name":{
|
||||
"cwidth":20
|
||||
}
|
||||
},
|
||||
"cheight":2.5,
|
||||
"width":"100%"
|
||||
},
|
||||
"page_rows":80,
|
||||
"cache_limit":5
|
||||
},
|
||||
"binds":[
|
||||
{
|
||||
"wid":"self",
|
||||
"event":"row_selected",
|
||||
"actiontype":"urlwidget",
|
||||
"target":"PopupWindow",
|
||||
"popup_options":{
|
||||
"archor":"cc",
|
||||
"width":"90%",
|
||||
"height":"90%"
|
||||
},
|
||||
"options":{
|
||||
"url":"{{entire_url('play.ui')}}",
|
||||
"params":{}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
6
wwwroot/declare.ui
Normal file
6
wwwroot/declare.ui
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"widgettype":"MdWidget",
|
||||
"options":{
|
||||
"md_url":"{{entire_url('iptvsource.md')}}"
|
||||
}
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
return "noting in here"
|
||||
@ -1,34 +0,0 @@
|
||||
{
|
||||
"widgettype":"VBox",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%"
|
||||
},
|
||||
"subwidgets":[
|
||||
{
|
||||
"widgettype":"urlwidget",
|
||||
"options":{
|
||||
"url":"{{entire_url('header.ui')}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id":"center",
|
||||
"widgettype":"Filler",
|
||||
"options":{},
|
||||
"subwidgets":[
|
||||
{
|
||||
"widgettype":"urlwidget",
|
||||
"options":{
|
||||
"url":"{{entire_url('iptv.ui')}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"widgettype":"urlwidget",
|
||||
"options":{
|
||||
"url":"{{entire_url('bottom.ui')}}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@ -1,11 +0,0 @@
|
||||
{% set d = get_channel_by_id(id) %}
|
||||
{
|
||||
"id":"myplayer",
|
||||
"widgettype":"Video",
|
||||
"options":{
|
||||
"channel_id":"{{d.id}}",
|
||||
"title":"{{d.tv_name}}"
|
||||
"type":"application/x-mpegURL",
|
||||
"url":"{{d.url}}"
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@
|
||||
"label":"搜索频道",
|
||||
"url":"{{entire_url('iptvchannels.ui')}}"
|
||||
},
|
||||
{% if params_kw._is_mobile != '1' %}
|
||||
{% if int(params_kw._is_mobile) == 0 %}
|
||||
{
|
||||
"name":"tv_mode",
|
||||
"label":"电视模式",
|
||||
|
||||
46
wwwroot/tabs.ui
Normal file
46
wwwroot/tabs.ui
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"widgettype":"IconbarPage",
|
||||
"options":{
|
||||
"bar_at": "top",
|
||||
"bar_opts":{
|
||||
"margin": "10px",
|
||||
"rate":1.5,
|
||||
"tools":[
|
||||
{
|
||||
"name":"channelsearch",
|
||||
"icon":"{{entire_url('/imgs/channelsearch.svg')}}",
|
||||
"tip":"Search Channel by enter channel name",
|
||||
"dynsize": true,
|
||||
"content":{
|
||||
"widgettype":"urlwidget",
|
||||
"options":{
|
||||
"url":"{{entire_url('searchchannels')}}"
|
||||
}
|
||||
}
|
||||
},{
|
||||
"name":"newestchannels",
|
||||
"icon":"{{entire_url('/imgs/newestchannels.svg')}}",
|
||||
"tip":"show newest channels",
|
||||
"dynsize": true,
|
||||
"content":{
|
||||
"widgettype":"urlwidget",
|
||||
"options":{
|
||||
"url":"{{entire_url('newest')}}"
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"name":"declare",
|
||||
"icon":"{{entire_url('/imgs/declare.svg')}}",
|
||||
"tip":"show declaration",
|
||||
"dynsize": true,
|
||||
"content":{
|
||||
"widgettype":"urlwidget",
|
||||
"options":{
|
||||
"url":"{{entire_url('declare.ui')}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user