Compare commits
2 Commits
a814797363
...
15d2de5228
| Author | SHA1 | Date | |
|---|---|---|---|
| 15d2de5228 | |||
| 3cf203ee27 |
@@ -2,7 +2,7 @@
|
|||||||
db_file_path = "/path/to/ythdd_db.sqlite" # Preferably stored on an SSD.
|
db_file_path = "/path/to/ythdd_db.sqlite" # Preferably stored on an SSD.
|
||||||
video_storage_directory_path = "/path/to/videos/" # Path to video vault.
|
video_storage_directory_path = "/path/to/videos/" # Path to video vault.
|
||||||
is_proxied = false # Set to true if running behind reverse proxy.
|
is_proxied = false # Set to true if running behind reverse proxy.
|
||||||
public_facing_url = "http://localhost:5000/" # Used for URL rewriting. Note the trailing backslash /.
|
public_facing_url = "http://127.0.0.1:5000/" # Used for URL rewriting. Note the trailing backslash /.
|
||||||
debug = false # Whether to print verbose, debug info on API endpoints.
|
debug = false # Whether to print verbose, debug info on API endpoints.
|
||||||
cache = true # Whether to cache requests for 3 hours (temporary solution to long load times).
|
cache = true # Whether to cache requests for 3 hours (temporary solution to long load times).
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ def getConfig(configfile):
|
|||||||
global randomly_generated_passcode
|
global randomly_generated_passcode
|
||||||
|
|
||||||
if not os.path.exists(configfile):
|
if not os.path.exists(configfile):
|
||||||
dummy_config = {'general': {'db_file_path': 'ythdd_db.sqlite', 'video_storage_directory_path': 'videos/', 'is_proxied': False, 'public_facing_url': 'http://localhost:5000/', 'debug': False, 'cache': True}, 'api': {'api_key': 'CHANGEME'}, 'extractor': {'user-agent': '', 'cookies_path': ''}, 'admin': {'admins': ['admin']}, 'yt_dlp': {}, 'postprocessing': {'presets': [{'name': 'recommended: [N][<=720p] best V+A', 'format': 'bv[height<=720]+ba', 'reencode': ''}, {'name': '[N][1080p] best V+A', 'format': 'bv[height=1080]+ba', 'reencode': ''}, {'name': '[R][1080p] webm', 'format': 'bv[height=1080]+ba', 'reencode': 'webm'}, {'name': '[N][720p] best V+A', 'format': 'bv[height=720]+ba', 'reencode': ''}, {'name': '[R][720p] webm', 'format': 'bv[height=720]+ba', 'reencode': 'webm'}, {'name': '[N][480p] best V+A', 'format': 'bv[height=480]+ba', 'reencode': ''}, {'name': '[480p] VP9 webm/reencode', 'format': 'bv*[height=480][ext=webm]+ba/bv[height=480]+ba', 'reencode': 'webm'}, {'name': '[N][1080p] best video only', 'format': 'bv[height=1080]', 'reencode': ''}, {'name': '[N][opus] best audio only', 'format': 'ba', 'reencode': 'opus'}]}}
|
dummy_config = {'general': {'db_file_path': 'ythdd_db.sqlite', 'video_storage_directory_path': 'videos/', 'is_proxied': False, 'public_facing_url': 'http://127.0.0.1:5000/', 'debug': False, 'cache': True}, 'api': {'api_key': 'CHANGEME'}, 'proxy': {'user-agent': ''}, 'extractor': {'user-agent': '', 'cookies_path': ''}, 'admin': {'admins': ['admin']}, 'yt_dlp': {}, 'postprocessing': {'presets': [{'name': 'recommended: [N][<=720p] best V+A', 'format': 'bv[height<=720]+ba', 'reencode': ''}, {'name': '[N][1080p] best V+A', 'format': 'bv[height=1080]+ba', 'reencode': ''}, {'name': '[R][1080p] webm', 'format': 'bv[height=1080]+ba', 'reencode': 'webm'}, {'name': '[N][720p] best V+A', 'format': 'bv[height=720]+ba', 'reencode': ''}, {'name': '[R][720p] webm', 'format': 'bv[height=720]+ba', 'reencode': 'webm'}, {'name': '[N][480p] best V+A', 'format': 'bv[height=480]+ba', 'reencode': ''}, {'name': '[480p] VP9 webm/reencode', 'format': 'bv*[height=480][ext=webm]+ba/bv[height=480]+ba', 'reencode': 'webm'}, {'name': '[N][1080p] best video only', 'format': 'bv[height=1080]', 'reencode': ''}, {'name': '[N][opus] best audio only', 'format': 'ba', 'reencode': 'opus'}]}}
|
||||||
# if a passcode has not been provided by the user (config file doesn't exist, and user didn't specify it using an argument)
|
# if a passcode has not been provided by the user (config file doesn't exist, and user didn't specify it using an argument)
|
||||||
print(f"{colors.WARNING}WARNING{colors.ENDC}: Using default, baked in config data. {colors.ENDL}"
|
print(f"{colors.WARNING}WARNING{colors.ENDC}: Using default, baked in config data. {colors.ENDL}"
|
||||||
f" Consider copying and editing the provided example file ({colors.OKCYAN}config.default.toml{colors.ENDC}).")
|
f" Consider copying and editing the provided example file ({colors.OKCYAN}config.default.toml{colors.ENDC}).")
|
||||||
@@ -59,7 +59,7 @@ def getHeaders(caller="proxy"):
|
|||||||
|
|
||||||
# NOTE: use ESR user-agent
|
# NOTE: use ESR user-agent
|
||||||
# user_agent = 'Mozilla/5.0 (Windows NT 10.0; rv:130.0) Gecko/20100101 Firefox/130.0'
|
# user_agent = 'Mozilla/5.0 (Windows NT 10.0; rv:130.0) Gecko/20100101 Firefox/130.0'
|
||||||
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0'
|
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0'
|
||||||
|
|
||||||
if config[caller]['user-agent']:
|
if config[caller]['user-agent']:
|
||||||
user_agent = config[caller]['user-agent']
|
user_agent = config[caller]['user-agent']
|
||||||
|
|||||||
@@ -560,7 +560,7 @@ def videos(data):
|
|||||||
"liveNow": live_now,
|
"liveNow": live_now,
|
||||||
"isPostLiveDvr": post_live_dvr,
|
"isPostLiveDvr": post_live_dvr,
|
||||||
"isUpcoming": is_upcoming,
|
"isUpcoming": is_upcoming,
|
||||||
"dashUrl": ythdd_globals.config['general']['public_facing_url'] + "/dash/not/implemented/", # not implemented
|
"dashUrl": ythdd_globals.config['general']['public_facing_url'] + "dash/not/implemented/", # not implemented
|
||||||
"premiereTimestamp": premiere_timestamp,
|
"premiereTimestamp": premiere_timestamp,
|
||||||
|
|
||||||
#"hlsUrl": hls_url, # broken after a change in iOS player
|
#"hlsUrl": hls_url, # broken after a change in iOS player
|
||||||
@@ -611,6 +611,9 @@ def parseLengthFromTimeBadge(time_str: str) -> int:
|
|||||||
length = 0
|
length = 0
|
||||||
time_lookup_list = [1, 60, 3_600, 86_400]
|
time_lookup_list = [1, 60, 3_600, 86_400]
|
||||||
time_list = time_str.split(":")
|
time_list = time_str.split(":")
|
||||||
|
if False in map(doesContainNumber, time_list): # works around ['LIVE'] for livestreams or ['Upcoming'] for scheduled videos
|
||||||
|
pass
|
||||||
|
else:
|
||||||
for z in range(len(time_list)):
|
for z in range(len(time_list)):
|
||||||
length += time_lookup_list[z] * int(time_list[len(time_list) - 1 - z])
|
length += time_lookup_list[z] * int(time_list[len(time_list) - 1 - z])
|
||||||
return length
|
return length
|
||||||
|
|||||||
Reference in New Issue
Block a user