mirror of https://github.com/nathom/streamrip.git
parent
1271df5ca7
commit
4c04188ade
|
@ -176,11 +176,12 @@ async def file(ctx, path):
|
||||||
with ctx.obj["config"] as cfg:
|
with ctx.obj["config"] as cfg:
|
||||||
async with Main(cfg) as main:
|
async with Main(cfg) as main:
|
||||||
async with aiofiles.open(path, "r") as f:
|
async with aiofiles.open(path, "r") as f:
|
||||||
|
content = await f.read()
|
||||||
try:
|
try:
|
||||||
items: Any = json.loads(await f.read())
|
items: Any = json.loads(content)
|
||||||
loaded = True
|
loaded = True
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
items: Any = [line async for line in f]
|
items = content.split()
|
||||||
loaded = False
|
loaded = False
|
||||||
if loaded:
|
if loaded:
|
||||||
console.print(
|
console.print(
|
||||||
|
@ -190,6 +191,12 @@ async def file(ctx, path):
|
||||||
[(i["source"], i["media_type"], i["id"]) for i in items]
|
[(i["source"], i["media_type"], i["id"]) for i in items]
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
s = set(items)
|
||||||
|
if len(s) < len(items):
|
||||||
|
console.print(
|
||||||
|
f"Found [orange]{len(items)-len(s)}[/orange] repeated URLs!"
|
||||||
|
)
|
||||||
|
items = list(s)
|
||||||
console.print(
|
console.print(
|
||||||
f"Detected list of urls. Loading [yellow]{len(items)}[/yellow] items"
|
f"Detected list of urls. Loading [yellow]{len(items)}[/yellow] items"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue