mirror of
https://github.com/dmunozv04/iSponsorBlockTV.git
synced 2025-12-13 07:26:45 +03:00
Last fixes
This commit is contained in:
@@ -57,7 +57,7 @@ async def search_channels(channel, api_key, web_session):
|
||||
else:
|
||||
subCount = channelData["items"][0]["statistics"]["subscriberCount"]
|
||||
|
||||
channel.append((i["snippet"]["channelId"], i["snippet"]["channelTitle"], subCount))
|
||||
channels.append((i["snippet"]["channelId"], i["snippet"]["channelTitle"], subCount))
|
||||
|
||||
return channels
|
||||
|
||||
|
||||
@@ -125,11 +125,13 @@ def main(config, config_file, debug):
|
||||
web_session = aiohttp.ClientSession()
|
||||
while True:
|
||||
channel_info = {}
|
||||
channel = input("Enter a channel name or \"/exit to exit\": ")
|
||||
channel = input("Enter a channel name or \"/exit\" to exit: ")
|
||||
if channel == "/exit":
|
||||
break
|
||||
|
||||
results = asyncio.run(api_helpers.search_channels(channel, apikey, web_session))
|
||||
task = loop.create_task(api_helpers.search_channels(channel, apikey, web_session))
|
||||
loop.run_until_complete(task)
|
||||
results = task.result()
|
||||
if len(results) == 0:
|
||||
print("No channels found")
|
||||
continue
|
||||
@@ -156,6 +158,8 @@ def main(config, config_file, debug):
|
||||
channel_info["id"] = results[int(choice)][0]
|
||||
channel_info["name"] = results[int(choice)][1]
|
||||
channel_whitelist.append(channel_info)
|
||||
# Close web session asynchronously
|
||||
loop.run_until_complete(web_session.close())
|
||||
|
||||
config["channel_whitelist"] = channel_whitelist
|
||||
|
||||
|
||||
@@ -63,8 +63,9 @@ async def process_playstatus(
|
||||
print(f"ID: {vid_id[0]}, Channel ID: {vid_id[1]}")
|
||||
for i in whitelist:
|
||||
if vid_id[1] == i["id"]:
|
||||
print("Channel whitelisted, skipping.")
|
||||
return
|
||||
segments = await api_helpers.get_segments(vid_id, web_session, categories)
|
||||
segments = await api_helpers.get_segments(vid_id[0], web_session, categories)
|
||||
print(segments)
|
||||
await time_to_segment(
|
||||
segments, playstatus.position, rc, time_start, web_session
|
||||
|
||||
Reference in New Issue
Block a user