Skip to content

Commit

Permalink
No Need
Browse files Browse the repository at this point in the history
  • Loading branch information
KSKOP69 committed Nov 6, 2024
1 parent 2932ec2 commit fb020c0
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions AlexaMusic/platforms/Youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,44 +32,6 @@ def cookiefile():
cookie_file = os.path.join(cookie_dir, cookies_files[0])
return cookie_file


async def check_file_size(link):
async def get_format_info(link):
proc = await asyncio.create_subprocess_exec(
"yt-dlp",
"--cookies",
cookiefile(),
"-J",
link,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
stdout, stderr = await proc.communicate()
if proc.returncode != 0:
print(f"Error:\n{stderr.decode()}")
return None
return json.loads(stdout.decode())

def parse_size(formats):
total_size = 0
for format in formats:
if "filesize" in format:
total_size += format["filesize"]
return total_size

info = await get_format_info(link)
if info is None:
return None

formats = info.get("formats", [])
if not formats:
print("No formats found.")
return None

total_size = parse_size(formats)
return total_size


async def shell_cmd(cmd):
proc = await asyncio.create_subprocess_shell(
cmd,
Expand Down

0 comments on commit fb020c0

Please sign in to comment.