Use yt-dlp by default instead of youtube-dl (#85953)

## About The Pull Request

This replaces references to youtube-dl in the config, pre-compile
script, and error messages with yt-dlp.

also wow yt-dlp seems like gibberish after seeing it so much lol

## Why It's Good For The Game

yt-dlp is more reliable and updated more frequently than youtube-dl, and
works as a drop-in replacement for the purposes of Play-Internet-Sound.

## Changelog

No player-facing changes
This commit is contained in:
Lucy
2024-08-19 07:09:40 -04:00
committed by GitHub
parent f2e93b63b1
commit 368ca25e6b
3 changed files with 18 additions and 18 deletions

View File

@@ -54,13 +54,13 @@ ADMIN_VERB(play_direct_mob_sound, R_SOUND, "Play Direct Mob Sound", "Play a soun
SEND_SOUND(target, sound) SEND_SOUND(target, sound)
BLACKBOX_LOG_ADMIN_VERB("Play Direct Mob Sound") BLACKBOX_LOG_ADMIN_VERB("Play Direct Mob Sound")
///Takes an input from either proc/play_web_sound or the request manager and runs it through youtube-dl and prompts the user before playing it to the server. ///Takes an input from either proc/play_web_sound or the request manager and runs it through yt-dlp and prompts the user before playing it to the server.
/proc/web_sound(mob/user, input, credit) /proc/web_sound(mob/user, input, credit)
if(!check_rights(R_SOUND)) if(!check_rights(R_SOUND))
return return
var/ytdl = CONFIG_GET(string/invoke_youtubedl) var/ytdl = CONFIG_GET(string/invoke_youtubedl)
if(!ytdl) if(!ytdl)
to_chat(user, span_boldwarning("Youtube-dl was not configured, action unavailable"), confidential = TRUE) //Check config.txt for the INVOKE_YOUTUBEDL value to_chat(user, span_boldwarning("yt-dlp was not configured, action unavailable"), confidential = TRUE) //Check config.txt for the INVOKE_YOUTUBEDL value
return return
var/web_sound_url = "" var/web_sound_url = ""
var/stop_web_sounds = FALSE var/stop_web_sounds = FALSE
@@ -73,14 +73,14 @@ ADMIN_VERB(play_direct_mob_sound, R_SOUND, "Play Direct Mob Sound", "Play a soun
var/stdout = output[SHELLEO_STDOUT] var/stdout = output[SHELLEO_STDOUT]
var/stderr = output[SHELLEO_STDERR] var/stderr = output[SHELLEO_STDERR]
if(errorlevel) if(errorlevel)
to_chat(user, span_boldwarning("Youtube-dl URL retrieval FAILED:"), confidential = TRUE) to_chat(user, span_boldwarning("yt-dlp URL retrieval FAILED:"), confidential = TRUE)
to_chat(user, span_warning("[stderr]"), confidential = TRUE) to_chat(user, span_warning("[stderr]"), confidential = TRUE)
return return
var/list/data var/list/data
try try
data = json_decode(stdout) data = json_decode(stdout)
catch(var/exception/e) catch(var/exception/e)
to_chat(user, span_boldwarning("Youtube-dl JSON parsing FAILED:"), confidential = TRUE) to_chat(user, span_boldwarning("yt-dlp JSON parsing FAILED:"), confidential = TRUE)
to_chat(user, span_warning("[e]: [stdout]"), confidential = TRUE) to_chat(user, span_warning("[e]: [stdout]"), confidential = TRUE)
return return
if (data["url"]) if (data["url"])

View File

@@ -208,19 +208,19 @@ IPINTEL_REJECT_BAD
## Ban appeals URL - usually for a forum or wherever people should go to contact your admins. ## Ban appeals URL - usually for a forum or wherever people should go to contact your admins.
# BANAPPEALS http://justanotherday.example.com # BANAPPEALS http://justanotherday.example.com
## System command that invokes youtube-dl, used by Play Internet Sound. ## System command that invokes yt-dlp, used by Play Internet Sound.
## You can install youtube-dl with ## You can install yt-dlp with
## "pip install youtube-dl" if you have pip installed ## "pip install yt-dlp" if you have pip installed
## from https://github.com/rg3/youtube-dl/releases ## from https://github.com/yt-dlp/yt-dlp/releases
## or your package manager ## or your package manager
## The default value assumes youtube-dl is in your system PATH ## The default value assumes yt-dlp is in your system PATH
# INVOKE_YOUTUBEDL youtube-dl # INVOKE_YOUTUBEDL yt-dlp
## Comment this out to disable users ability to use the request internet sounds to be played. ## Comment this out to disable users ability to use the request internet sounds to be played.
REQUEST_INTERNET_SOUND REQUEST_INTERNET_SOUND
## Request Internet Sound Allowed URL'S comma separated, urls here are the only sites allowed through Request Internet Sound, Add more to allow more, or remove to disallow. ## Request Internet Sound Allowed URL'S comma separated, urls here are the only sites allowed through Request Internet Sound, Add more to allow more, or remove to disallow.
## The Defaults here are all supported by youtube-dl ## The Defaults here are all supported by yt-dlp
## Ensure . and / are escaped with \ ## Ensure . and / are escaped with \
REQUEST_INTERNET_ALLOWED youtube\.com\/watch?v=,youtu\.be\/,soundcloud\.com\/,bandcamp\.com\/track\/ REQUEST_INTERNET_ALLOWED youtube\.com\/watch?v=,youtu\.be\/,soundcloud\.com\/,bandcamp\.com\/track\/

View File

@@ -6,7 +6,7 @@ has_git="$(command -v git)"
has_curl="$(command -v curl)" has_curl="$(command -v curl)"
has_cargo="$(command -v ~/.cargo/bin/cargo)" has_cargo="$(command -v ~/.cargo/bin/cargo)"
has_sudo="$(command -v sudo)" has_sudo="$(command -v sudo)"
has_youtubedl="$(command -v youtube-dl)" has_ytdlp="$(command -v yt-dlp)"
has_pip3="$(command -v pip3)" has_pip3="$(command -v pip3)"
set -e set -e
set -x set -x
@@ -40,12 +40,12 @@ if ! [ -x "$has_cargo" ]; then
. ~/.profile . ~/.profile
fi fi
# install or update youtube-dl when not present, or if it is present with pip3, # install or update yt-dlp when not present, or if it is present with pip3,
# which we assume was used to install it # which we assume was used to install it
if ! [ -x "$has_youtubedl" ]; then if ! [ -x "$has_ytdlp" ]; then
echo "Installing youtube-dl with pip3..." echo "Installing yt-dlp with pip3..."
pip3 install youtube-dl --break-system-packages pip3 install yt-dlp --break-system-packages
else else
echo "Ensuring youtube-dl is up-to-date with pip3..." echo "Ensuring yt-dlp is up-to-date with pip3..."
pip3 install youtube-dl -U --break-system-packages pip3 install yt-dlp -U --break-system-packages
fi fi