diff --git a/code/__HELPERS/shell.dm b/code/__HELPERS/shell.dm index 662efb7eac..3438f38b85 100644 --- a/code/__HELPERS/shell.dm +++ b/code/__HELPERS/shell.dm @@ -25,7 +25,7 @@ shelleo_ids[shelleo_id] = TRUE out_file = "[SHELLEO_NAME][shelleo_id][SHELLEO_OUT]" err_file = "[SHELLEO_NAME][shelleo_id][SHELLEO_ERR]" - errorcode = shell("[interpreter] '[command]' > [out_file] 2> [err_file]") + errorcode = shell("[interpreter] \"[command]\" > [out_file] 2> [err_file]") if(fexists(out_file)) stdout = file2text(out_file) fdel(out_file) diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 86a3c55f9d..077f23d1e6 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -13,7 +13,7 @@ SUBSYSTEM_DEF(job) var/list/prioritized_jobs = list() var/list/latejoin_trackers = list() //Don't read this list, use GetLateJoinTurfs() instead - var/overflow_role = "Wastelander" //CHANGE + var/overflow_role = "Customer" //CHANGE var/debug_admins_are_exempt_from_timelocks = FALSE diff --git a/code/game/machinery/dance_machine_online.dm b/code/game/machinery/dance_machine_online.dm new file mode 100644 index 0000000000..eebbbd9301 --- /dev/null +++ b/code/game/machinery/dance_machine_online.dm @@ -0,0 +1,85 @@ +/obj/machinery/jukebox_online + name = "Online Jukebox" + desc = "A music player. This one has a massive selection." + icon = 'icons/obj/stationobjs.dmi' + icon_state = "jukebox" + verb_say = "intones" + density = TRUE + var/pendingsongurl = "" + +/obj/machinery/jukebox_online/on_attack_hand(mob/living/user, act_intent, unarmed_attack_flags) + var/songinput = input(user, "Enter URL (supported sites only, leave blank to stop playing)", "Online Jukebox") as text|null + if(isnull(songinput) || !length(songinput)) + stop_online_song() + return + pendingsongurl = songinput + var/adminmessage = "[user.name] wants to play [pendingsongurl]
You can Allow or Deny.
" + for(var/admin in GLOB.admins.Copy()) + to_chat(admin, adminmessage, confidential = TRUE) + +/obj/machinery/jukebox_online/Topic(href, href_list[]) + if(pendingsongurl == href_list["url"]) + if(href_list["action"] == "allow") + var/toplay = pendingsongurl + parse_url(toplay) + message_admins("[usr] approved [href_list["url"]]") + pendingsongurl = "" + return + if(href_list["action"] == "deny") + pendingsongurl = "" + message_admins("[usr] denied [href_list["url"]]") + return + else + to_chat(usr, "Someone else must have responded already.") + + +/obj/machinery/jukebox_online/proc/parse_url(url) + . = FALSE + var/ytdl = CONFIG_GET(string/invoke_youtubedl) + if(!ytdl) + to_chat(src, span_boldwarning("yt-dlp was not configured, action unavailable")) //Check config.txt for the INVOKE_YOUTUBEDL value + return + if(length(url)) + url = trim(url) + if(findtext(url, ":") && !findtext(url, GLOB.is_http_protocol)) + to_chat(src, span_boldwarning("Non-http(s) URIs are not allowed.")) + to_chat(src, span_warning("For yt-dlp shortcuts like ytsearch: please use the appropriate full url from the website.")) + return + var/shell_scrubbed_input = shell_url_scrub(url) + var/list/output = world.shelleo("[ytdl] --format \"bestaudio\[ext=mp3]/best\[ext=mp4]\[height<=360]/bestaudio\[ext=m4a]/bestaudio\[ext=aac]\" --dump-single-json --no-playlist -- \"[shell_scrubbed_input]\"") + var/errorlevel = output[SHELLEO_ERRORLEVEL] + var/stdout = output[SHELLEO_STDOUT] + //var/stderr = output[SHELLEO_STDERR] + if(!errorlevel) + var/list/data + try + data = json_decode(stdout) + catch(var/exception/e) + to_chat(src, span_boldwarning("yt-dlp JSON parsing FAILED:")) + to_chat(src, span_warning("[e]: [stdout]")) + return + + if (data["url"]) + var/storeddata = list() + storeddata["start"] = data["start_time"] + storeddata["end"] = data["end_time"] + storeddata["link"] = data["webpage_url"] + storeddata["title"] = data["title"] + play_online_song(data["url"], storeddata) + . = TRUE + +/obj/machinery/jukebox_online/proc/play_online_song(url, extradata) + for(var/m in GLOB.player_list) + var/mob/M = m + var/client/C = M?.client + if(C) + if(C.prefs.toggles & SOUND_MIDI) + C.tgui_panel?.play_music(url, extradata) + +/obj/machinery/jukebox_online/proc/stop_online_song() + for(var/m in GLOB.player_list) + var/mob/M = m + var/client/C = M?.client + if(C) + if(C.prefs.toggles & SOUND_MIDI) + C.tgui_panel?.stop_music() diff --git a/config/game_options.txt b/config/game_options.txt index 406d2ab5b8..b59f086cc1 100644 --- a/config/game_options.txt +++ b/config/game_options.txt @@ -502,7 +502,7 @@ ROUNDSTART_RACES dragon #JOIN_WITH_MUTANT_HUMANS ##Overflow job. Default is assistant -OVERFLOW_JOB Wastelander +OVERFLOW_JOB Customer ## Overflow slot cap. Set to -1 for unlimited. If limited, it will still open up if every other job is full. OVERFLOW_CAP -1 diff --git a/fortune13.dme b/fortune13.dme index 30adc683ce..34f8132b35 100644 --- a/fortune13.dme +++ b/fortune13.dme @@ -898,6 +898,7 @@ #include "code\game\machinery\constructable_frame.dm" #include "code\game\machinery\cryopod.dm" #include "code\game\machinery\dance_machine.dm" +#include "code\game\machinery\dance_machine_online.dm" #include "code\game\machinery\defibrillator_mount.dm" #include "code\game\machinery\dish_drive.dm" #include "code\game\machinery\dna_scanner.dm"