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:
|
else:
|
||||||
subCount = channelData["items"][0]["statistics"]["subscriberCount"]
|
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
|
return channels
|
||||||
|
|
||||||
|
|||||||
@@ -125,11 +125,13 @@ def main(config, config_file, debug):
|
|||||||
web_session = aiohttp.ClientSession()
|
web_session = aiohttp.ClientSession()
|
||||||
while True:
|
while True:
|
||||||
channel_info = {}
|
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":
|
if channel == "/exit":
|
||||||
break
|
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:
|
if len(results) == 0:
|
||||||
print("No channels found")
|
print("No channels found")
|
||||||
continue
|
continue
|
||||||
@@ -156,6 +158,8 @@ def main(config, config_file, debug):
|
|||||||
channel_info["id"] = results[int(choice)][0]
|
channel_info["id"] = results[int(choice)][0]
|
||||||
channel_info["name"] = results[int(choice)][1]
|
channel_info["name"] = results[int(choice)][1]
|
||||||
channel_whitelist.append(channel_info)
|
channel_whitelist.append(channel_info)
|
||||||
|
# Close web session asynchronously
|
||||||
|
loop.run_until_complete(web_session.close())
|
||||||
|
|
||||||
config["channel_whitelist"] = channel_whitelist
|
config["channel_whitelist"] = channel_whitelist
|
||||||
|
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ async def process_playstatus(
|
|||||||
print(f"ID: {vid_id[0]}, Channel ID: {vid_id[1]}")
|
print(f"ID: {vid_id[0]}, Channel ID: {vid_id[1]}")
|
||||||
for i in whitelist:
|
for i in whitelist:
|
||||||
if vid_id[1] == i["id"]:
|
if vid_id[1] == i["id"]:
|
||||||
|
print("Channel whitelisted, skipping.")
|
||||||
return
|
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)
|
print(segments)
|
||||||
await time_to_segment(
|
await time_to_segment(
|
||||||
segments, playstatus.position, rc, time_start, web_session
|
segments, playstatus.position, rc, time_start, web_session
|
||||||
|
|||||||
Reference in New Issue
Block a user