This repository has been archived by the owner on Oct 13, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(yt-dl): automatically gather youtube cookies
- Loading branch information
1 parent
673fe04
commit dd0822b
Showing
13 changed files
with
590 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# standard imports | ||
import os | ||
import platform | ||
|
||
# plex debugging | ||
try: | ||
import plexhints # noqa: F401 | ||
except ImportError: | ||
pass | ||
else: # the code is running outside of Plex | ||
from plexhints.log_kit import Log # log kit | ||
|
||
|
||
def get_os_architecture(): | ||
# type: () -> str | ||
""" | ||
Get the OS architecture. | ||
Returns | ||
------- | ||
str | ||
The OS architecture. One of ``x86_64``, ``x86``, ``aarch64`` or ``Unknown architecture``. | ||
Examples | ||
-------- | ||
>>> get_os_architecture() | ||
"x86_64" | ||
""" | ||
# Getting architecture using platform module | ||
machine = platform.machine() | ||
|
||
# For more detailed check, especially for Windows OS | ||
if os.name == 'nt': | ||
# Possible values: '32bit', '64bit' | ||
# This will tell us if the OS is 64-bit or 32-bit | ||
architecture = platform.architecture() | ||
|
||
if architecture[0] == '64bit': | ||
return 'x86_64' | ||
elif architecture[0] == '32bit': | ||
return 'x86' | ||
else: | ||
return 'Unknown architecture' | ||
else: | ||
# For Unix/Linux systems, we can rely more on platform.machine() | ||
if machine in ['x86_64', 'AMD64']: | ||
return 'x86_64' | ||
elif machine in ['i386', 'i686', 'x86']: | ||
return 'x86' | ||
elif machine in ['aarch64', 'arm64']: | ||
return 'aarch64' | ||
else: | ||
return 'Unknown architecture' | ||
|
||
|
||
# constants | ||
architecture = get_os_architecture() | ||
os_system = platform.system().lower() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.