From d3bd7b89c6d8f8d305614651847947b7968683b7 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 19 Oct 2025 21:14:28 +0800 Subject: [PATCH] bugfix --- iptv/downloadchannels.py | 57 +++++++++++++++++++++++++++++++-- wwwroot/channelinfo.ui | 43 ------------------------- wwwroot/channels.ui | 56 -------------------------------- wwwroot/index.dspy | 1 - wwwroot/index.old.ui | 34 -------------------- wwwroot/newest/.index.ui.swp | Bin 12288 -> 0 bytes wwwroot/play_with_channelid.ui | 11 ------- wwwroot/sysmenu.ui | 2 +- wwwroot/tabs.ui | 46 ++++++++++++++++++++++++++ 9 files changed, 102 insertions(+), 148 deletions(-) delete mode 100644 wwwroot/channelinfo.ui delete mode 100644 wwwroot/channels.ui delete mode 100644 wwwroot/index.dspy delete mode 100644 wwwroot/index.old.ui delete mode 100644 wwwroot/newest/.index.ui.swp delete mode 100644 wwwroot/play_with_channelid.ui create mode 100644 wwwroot/tabs.ui diff --git a/iptv/downloadchannels.py b/iptv/downloadchannels.py index e2c0f98..d66e1cd 100644 --- a/iptv/downloadchannels.py +++ b/iptv/downloadchannels.py @@ -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') diff --git a/wwwroot/channelinfo.ui b/wwwroot/channelinfo.ui deleted file mode 100644 index 8fa20e8..0000000 --- a/wwwroot/channelinfo.ui +++ /dev/null @@ -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')}}" - } - } - ] -} diff --git a/wwwroot/channels.ui b/wwwroot/channels.ui deleted file mode 100644 index 2c08c29..0000000 --- a/wwwroot/channels.ui +++ /dev/null @@ -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":{} - } - } - ] -} diff --git a/wwwroot/index.dspy b/wwwroot/index.dspy deleted file mode 100644 index d5b7674..0000000 --- a/wwwroot/index.dspy +++ /dev/null @@ -1 +0,0 @@ -return "noting in here" diff --git a/wwwroot/index.old.ui b/wwwroot/index.old.ui deleted file mode 100644 index b84f7c3..0000000 --- a/wwwroot/index.old.ui +++ /dev/null @@ -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')}}" - } - } - ] -} diff --git a/wwwroot/newest/.index.ui.swp b/wwwroot/newest/.index.ui.swp deleted file mode 100644 index b01cbce4b114e25717421f746fd612c8d68ab1d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2%WD%+6o+pWgi)hK-5Zbb1)8*xYAJ}I2v!h_wF*86)68vVa56K_+$0TS6jyH4 zKcOqpl?blfiHqXSg;Ly!pr{KMBDioP{^pfOyQp0jPUy!>?&I8ZzI$g8I<~18jf|umLu(4h`sr z5N|gN@o@{1$N&Gc-~WHN3-KMi1B>7VSO7Y>0M3Cj*bQ>v_ckHEf+esBUV&%eDR=-v zPy-jiaj*;Iz$PHTmz)sq!AtNMJOcN@JrDv1m|zB+1bMI#{MahQ2k;s^0Sn+ExDBp@ zGhh@P1jFDD>ih+MfN$V4_ypqm*Wvzg%4~oQumLu}2G{@_U;}KRXP_fA{KaTDaFgD4 zFB&y`nnA)2J?$=^8YVr>P6mm*{ZX-pOt>vd~L~&@wvNq%2q=M9@xm zjz+3karC;3q7}mQORt|i-Ph{@O@zrJ4nS+hwxn9GoEMJ6_?$=}#U@Gdrg7=Z#Ru+i#YLt>{d(rBs4soNwsST1%=|oej zwpG2^ZN(t81=5~No8kg#7NJqxwJ7r&NrY&RdV8ahsoPe~!DL&`sZ1}meBFaXe`jTSY+r*uVjx%?+J-BNjm$_bkY*5%2OEPs93&? zY#lsM(mgAE1HMuoRJdKW|M>{*#y{3WUl1DQQSFx=iKB$8Q LpLXp41&87vok&H< diff --git a/wwwroot/play_with_channelid.ui b/wwwroot/play_with_channelid.ui deleted file mode 100644 index ba69348..0000000 --- a/wwwroot/play_with_channelid.ui +++ /dev/null @@ -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}}" - } -} diff --git a/wwwroot/sysmenu.ui b/wwwroot/sysmenu.ui index 7dacc4d..a52f962 100644 --- a/wwwroot/sysmenu.ui +++ b/wwwroot/sysmenu.ui @@ -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":"电视模式", diff --git a/wwwroot/tabs.ui b/wwwroot/tabs.ui new file mode 100644 index 0000000..e9de676 --- /dev/null +++ b/wwwroot/tabs.ui @@ -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')}}" + } + } + } + ] + } + } +}