diff --git a/iptv/downloadchannels.py b/iptv/downloadchannels.py index 82c8e53..f67797d 100644 --- a/iptv/downloadchannels.py +++ b/iptv/downloadchannels.py @@ -6,9 +6,11 @@ import os import asyncio from datetime import datetime from appPublic.jsonConfig import getConfig +from appPublic.dictObject import DictObject from appPublic.streamhttpclient import StreamHttpClient from appPublic.uniqueID import getID from appPublic.log import debug +from ahserver.serverenv import ServerEnv from sqlor.dbpools import DBPools from iptv import m3u from iptv.m3u8test import test_channels, write_goodchannel @@ -28,7 +30,7 @@ async def check_if_exists(url): dbname = env.get_module_dbname('iptv') db = DBPools() async with db.sqlorContext(dbname) as sor: - sql = "select * from iptvchannles where url = ${url}$" + sql = "select * from iptvchannels where url = ${url}$" recs = await sor.sqlExe(sql, {'url': url}) if len(recs) > 0: return True @@ -63,7 +65,7 @@ async def write_goodchannel(b): '0' )""" query = """select * from iptvchannels where url=${url}$""" - q = await sor.sqlExe(query,{'url', b['url']}) + q = await sor.sqlExe(query,{'url': b['url']}) if len(q) == 0: r = copy(b) r['media_type'] = 'iptv' @@ -84,9 +86,9 @@ async def write_goodchannel(b): async def load_url_iptv(url): clist = await download(url) - debug(f'clist={clist}') newchannels = [] for c in clist: + c = DictObject(**c) b = await check_if_exists(c.url) if not b: newchannels.append(c)