Split jukebox into two files, commit one

This commit is contained in:
Chompstation Bot
2021-05-22 19:32:15 +00:00
parent 667af1c630
commit 5b147760bd
6 changed files with 75 additions and 33 deletions

View File

@@ -38,21 +38,36 @@ var/global/list/all_lobby_tracks = list()
// Read the jukebox configuration file on system startup. // Read the jukebox configuration file on system startup.
/hook/startup/proc/load_jukebox_tracks() /hook/startup/proc/load_jukebox_tracks()
var/jukebox_track_file = "config/jukebox.json" var/jukebox_track_file = "config/jukebox.json"
var/jukebox_track_file_private = "config/jukebox_private.json" // Uncommitted
if(!fexists(jukebox_track_file)) if(!fexists(jukebox_track_file))
warning("File not found: [jukebox_track_file]") warning("File not found: [jukebox_track_file]")
return 1 return 1
var/list/jsonData = json_decode(file2text(jukebox_track_file)) var/list/jsonData = json_decode(file2text(jukebox_track_file))
if(!istype(jsonData)) if(!istype(jsonData))
warning("Failed to read tracks from [jukebox_track_file], json_decode failed.") 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) for(var/entry in jsonData)
if(!istext(entry["url"])) if(!istext(entry["url"]))
warning("[jukebox_track_file] entry [entry]: bad or missing 'url'") warning("Jukebox entry [entry]: bad or missing 'url'")
continue continue
if(!istext(entry["title"])) if(!istext(entry["title"]))
warning("[jukebox_track_file] entry [entry]: bad or missingg 'title'") warning("Jukebox entry [entry]: bad or missing 'title'")
continue continue
if(!isnum(entry["duration"])) if(!isnum(entry["duration"]))
warning("[jukebox_track_file] entry [entry]: bad or missing 'duration'") warning("Jukebox entry [entry]: bad or missing 'duration'")
continue continue
var/datum/track/T = new(entry["url"], entry["title"], entry["duration"]) var/datum/track/T = new(entry["url"], entry["title"], entry["duration"])
if(istext(entry["artist"])) if(istext(entry["artist"]))

13
config/.gitignore vendored
View File

@@ -2,7 +2,20 @@
* *
!*/ !*/
#Also don't ignore these things because editing them manually on the server is a pain in the fucking ass. #Also don't ignore these things because editing them manually on the server is a pain in the fucking ass.
<<<<<<< HEAD
#!custom_items.txt #!custom_items.txt
#!custom_sprites.txt #!custom_sprites.txt
#!alienwhitelist.txt #!alienwhitelist.txt
#!jobwhitelist.txt #!jobwhitelist.txt
||||||| parent of fb56cd4573... Merge pull request #10375 from VOREStation/Arokha/juke
!custom_items.txt
!custom_sprites.txt
!alienwhitelist.txt
!jobwhitelist.txt
=======
!custom_items.txt
!custom_sprites.txt
!alienwhitelist.txt
!jobwhitelist.txt
!jukebox.json
>>>>>>> fb56cd4573... Merge pull request #10375 from VOREStation/Arokha/juke

View File

@@ -0,0 +1,42 @@
[
{
"url": "https://s.put.re/bkZYkYwX.mp3",
"title": "Flip-Flap (Title One)",
"duration": 1500,
"artist": "X-CEED",
"secret": false,
"lobby": true,
"jukebox": false,
"genre": "Jazz"
},
{
"url": "https://s.put.re/EzLP21Mp.mp3",
"title": "Robocop Theme (Title Two)",
"duration": 1180,
"artist": "Cboyardee",
"secret": false,
"lobby": true,
"jukebox": false,
"genre": "Electronic"
},
{
"url": "https://s.put.re/uDpZrL1L.mp3",
"title": "Tin Tin on the Moon (Remix)",
"duration": 2320,
"artist": "Jeroen Tel (Remixed by Cuboos)",
"secret": false,
"lobby": true,
"jukebox": true,
"genre": "Electronic"
},
{
"url": "https://s.put.re/nNXTd9ko.mp3",
"title": "Phoron Will Make Us Rich",
"duration": 1370,
"artist": "Earthcrusher",
"secret": false,
"lobby": true,
"jukebox": true,
"genre": "Electronic"
}
]

View File

@@ -1,30 +0,0 @@
#Jukebox configuration file
#Sound file | Song Title | <0 = normal or 1 = secret>
# Normal songs
sound/music/jukebox/SongAboutHares.ogg | A Song About Hares | 0
sound/music/jukebox/BelowTheAsteroids.ogg | Below The Asteroids | 0
sound/ambience/ambispace.ogg | Beyond | 0
sound/music/clouds.s3m | Clouds of Fire | 0
sound/music/title2.ogg | D`Bert | 0
sound/ambience/song_game.ogg | D`Fort | 0
sound/music/jukebox/DuckTalesMoon.mid | Duck Tales - Moon | 0
sound/music/space.ogg | Endless Space | 0
sound/music/main.ogg | Floating | 0
sound/music/jukebox/Fly_Me_To_The_Moon.ogg | Fly Me To The Moon | 0
sound/music/jukebox/Cantina.ogg | Mad About Me | 0
sound/music/jukebox/MinorTurbulenceFull.ogg | Minor Turbulence | 0
sound/music/jukebox/OdeToGreed.ogg | Ode to Greed | 0
sound/misc/TestLoop1.ogg | Part A | 0
sound/music/jukebox/Ransacked.ogg | Ransacked | 0
sound/music/jukebox/russianrapdisco.ogg | Russkiy rep Diskoteka | 0
sound/music/title1.ogg | Scratch | 0
sound/music/space_oddity.ogg | Space Oddity | 0
sound/music/THUNDERDOME.ogg | Thunderdome | 0
sound/music/traitor.ogg | Trai`Tor | 0
sound/music/jukebox/WelcomeToJurassicPark.mid | Welcome To Jurassic Park | 0
# Secret songs!
sound/music/jukebox/bandit_radio.ogg | Bandit Radio | 1
sound/music/space_asshole.ogg | Space Asshole | 1
sound/music/THUNDERDOME.ogg | THUNDERDOME | 1

View File

@@ -0,0 +1 @@
[]

1
config/jukebox.json Normal file
View File

@@ -0,0 +1 @@
[]