mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-27 07:08:55 +01:00
powder that makes you say yes
This commit is contained in:
@@ -30,109 +30,4 @@
|
||||
return str
|
||||
|
||||
/datum/track/proc/toTguiList()
|
||||
<<<<<<< HEAD
|
||||
return list("ref" = "\ref[src]", "title" = title, "artist" = artist, "duration" = duration)
|
||||
|
||||
|
||||
// Global list holding all configured jukebox tracks
|
||||
var/global/list/all_jukebox_tracks = list()
|
||||
var/global/list/all_lobby_tracks = list()
|
||||
|
||||
// Read the jukebox configuration file on system startup.
|
||||
/hook/startup/proc/load_jukebox_tracks()
|
||||
var/jukebox_track_file = "config/jukebox.json"
|
||||
var/jukebox_track_file_private = "config/jukebox_private.json" // Uncommitted
|
||||
|
||||
if(!fexists(jukebox_track_file))
|
||||
warning("File not found: [jukebox_track_file]")
|
||||
return 1
|
||||
|
||||
var/list/jsonData = json_decode(file2text(jukebox_track_file))
|
||||
|
||||
if(!istype(jsonData))
|
||||
warning("Failed to read tracks from [jukebox_track_file], json_decode failed.")
|
||||
return 1
|
||||
|
||||
// Optional
|
||||
if(fexists(jukebox_track_file_private))
|
||||
var/list/jsonData_private = json_decode(file2text(jukebox_track_file_private))
|
||||
if(istype(jsonData_private))
|
||||
jsonData += jsonData_private // Pack more tracks in
|
||||
else
|
||||
warning("Failed to read tracks from [jukebox_track_file_private], json_decode failed.")
|
||||
//return 1 // Not worth failing over, as this file is optional
|
||||
|
||||
for(var/entry in jsonData)
|
||||
if(!istext(entry["url"]))
|
||||
warning("Jukebox entry [entry]: bad or missing 'url'")
|
||||
continue
|
||||
if(!istext(entry["title"]))
|
||||
warning("Jukebox entry [entry]: bad or missing 'title'")
|
||||
continue
|
||||
if(!isnum(entry["duration"]))
|
||||
warning("Jukebox entry [entry]: bad or missing 'duration'")
|
||||
continue
|
||||
var/datum/track/T = new(entry["url"], entry["title"], entry["duration"])
|
||||
if(istext(entry["artist"]))
|
||||
T.artist = entry["artist"]
|
||||
T.secret = entry["secret"] ? 1 : 0
|
||||
T.casino = entry["casino"] ? 1 : 0 //CHOMP Casino music
|
||||
T.lobby = entry["lobby"] ? 1 : 0
|
||||
all_jukebox_tracks += T
|
||||
if(T.lobby)
|
||||
all_lobby_tracks += T
|
||||
return 1
|
||||
||||||| parent of f4ee5be455... Merge pull request #10521 from VOREStation/Arokha/mediatracks
|
||||
return list("ref" = "\ref[src]", "title" = title, "artist" = artist, "duration" = duration)
|
||||
|
||||
|
||||
// Global list holding all configured jukebox tracks
|
||||
var/global/list/all_jukebox_tracks = list()
|
||||
var/global/list/all_lobby_tracks = list()
|
||||
|
||||
// Read the jukebox configuration file on system startup.
|
||||
/hook/startup/proc/load_jukebox_tracks()
|
||||
var/jukebox_track_file = "config/jukebox.json"
|
||||
var/jukebox_track_file_private = "config/jukebox_private.json" // Uncommitted
|
||||
|
||||
if(!fexists(jukebox_track_file))
|
||||
warning("File not found: [jukebox_track_file]")
|
||||
return 1
|
||||
|
||||
var/list/jsonData = json_decode(file2text(jukebox_track_file))
|
||||
|
||||
if(!istype(jsonData))
|
||||
warning("Failed to read tracks from [jukebox_track_file], json_decode failed.")
|
||||
return 1
|
||||
|
||||
// Optional
|
||||
if(fexists(jukebox_track_file_private))
|
||||
var/list/jsonData_private = json_decode(file2text(jukebox_track_file_private))
|
||||
if(istype(jsonData_private))
|
||||
jsonData += jsonData_private // Pack more tracks in
|
||||
else
|
||||
warning("Failed to read tracks from [jukebox_track_file_private], json_decode failed.")
|
||||
//return 1 // Not worth failing over, as this file is optional
|
||||
|
||||
for(var/entry in jsonData)
|
||||
if(!istext(entry["url"]))
|
||||
warning("Jukebox entry [entry]: bad or missing 'url'")
|
||||
continue
|
||||
if(!istext(entry["title"]))
|
||||
warning("Jukebox entry [entry]: bad or missing 'title'")
|
||||
continue
|
||||
if(!isnum(entry["duration"]))
|
||||
warning("Jukebox entry [entry]: bad or missing 'duration'")
|
||||
continue
|
||||
var/datum/track/T = new(entry["url"], entry["title"], entry["duration"])
|
||||
if(istext(entry["artist"]))
|
||||
T.artist = entry["artist"]
|
||||
T.secret = entry["secret"] ? 1 : 0
|
||||
T.lobby = entry["lobby"] ? 1 : 0
|
||||
all_jukebox_tracks += T
|
||||
if(T.lobby)
|
||||
all_lobby_tracks += T
|
||||
return 1
|
||||
=======
|
||||
return list("ref" = "\ref[src]", "title" = title, "artist" = artist, "genre" = genre, "duration" = duration)
|
||||
>>>>>>> f4ee5be455... Merge pull request #10521 from VOREStation/Arokha/mediatracks
|
||||
|
||||
Reference in New Issue
Block a user