diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/1-fm_pls.vmt b/data_static/streamradio/playlists/community/1-fm_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/1-fm_pls.vmt rename to data_static/streamradio/playlists/community/1-fm_pls.txt diff --git a/data_static/streamradio/playlists/community/bbc-world-service_pls.txt b/data_static/streamradio/playlists/community/bbc-world-service_pls.txt new file mode 100644 index 0000000..8782967 --- /dev/null +++ b/data_static/streamradio/playlists/community/bbc-world-service_pls.txt @@ -0,0 +1,6 @@ +[playlist] +NumberOfEntries=1 +File1=http://stream.live.vc.bbcmedia.co.uk/bbc_world_service +Title1=BBC World Service Online +Length1=-1 +Version=2 \ No newline at end of file diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/bigrig-fm_pls.vmt b/data_static/streamradio/playlists/community/bigrig-fm_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/bigrig-fm_pls.vmt rename to data_static/streamradio/playlists/community/bigrig-fm_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/classical-weta_pls.vmt b/data_static/streamradio/playlists/community/classical-weta_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/classical-weta_pls.vmt rename to data_static/streamradio/playlists/community/classical-weta_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/drumandbass-fm_pls.vmt b/data_static/streamradio/playlists/community/drumandbass-fm_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/drumandbass-fm_pls.vmt rename to data_static/streamradio/playlists/community/drumandbass-fm_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/fallout-fm_pls.vmt b/data_static/streamradio/playlists/community/fallout-fm_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/fallout-fm_pls.vmt rename to data_static/streamradio/playlists/community/fallout-fm_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/galnet-ru_pls.vmt b/data_static/streamradio/playlists/community/galnet-ru_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/galnet-ru_pls.vmt rename to data_static/streamradio/playlists/community/galnet-ru_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/gg-radio_pls.vmt b/data_static/streamradio/playlists/community/gg-radio_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/gg-radio_pls.vmt rename to data_static/streamradio/playlists/community/gg-radio_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/hiphop-forever_pls.vmt b/data_static/streamradio/playlists/community/hiphop-forever_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/hiphop-forever_pls.vmt rename to data_static/streamradio/playlists/community/hiphop-forever_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/nightwave-plaza_pls.vmt b/data_static/streamradio/playlists/community/nightwave-plaza_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/nightwave-plaza_pls.vmt rename to data_static/streamradio/playlists/community/nightwave-plaza_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/noise-fm_pls.vmt b/data_static/streamradio/playlists/community/noise-fm_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/noise-fm_pls.vmt rename to data_static/streamradio/playlists/community/noise-fm_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/non-stop-play_pls.vmt b/data_static/streamradio/playlists/community/non-stop-play_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/non-stop-play_pls.vmt rename to data_static/streamradio/playlists/community/non-stop-play_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/rax-dio_pls.vmt b/data_static/streamradio/playlists/community/rax-dio_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/rax-dio_pls.vmt rename to data_static/streamradio/playlists/community/rax-dio_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/rfc-media_pls.vmt b/data_static/streamradio/playlists/community/rfc-media_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/rfc-media_pls.vmt rename to data_static/streamradio/playlists/community/rfc-media_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/trap-fm_pls.vmt b/data_static/streamradio/playlists/community/trap-fm_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/trap-fm_pls.vmt rename to data_static/streamradio/playlists/community/trap-fm_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/triplej_pls.vmt b/data_static/streamradio/playlists/community/triplej_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/triplej_pls.vmt rename to data_static/streamradio/playlists/community/triplej_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/truckers-fm_pls.vmt b/data_static/streamradio/playlists/community/truckers-fm_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/truckers-fm_pls.vmt rename to data_static/streamradio/playlists/community/truckers-fm_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/wcck-dead-fm_pls.vmt b/data_static/streamradio/playlists/community/wcck-dead-fm_pls.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/community/wcck-dead-fm_pls.vmt rename to data_static/streamradio/playlists/community/wcck-dead-fm_pls.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/local/half-life_json.vmt b/data_static/streamradio/playlists/local/half-life_json.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/local/half-life_json.vmt rename to data_static/streamradio/playlists/local/half-life_json.txt diff --git a/materials/3dstreamradio/_data/streamradio/playlists/local/portal_json.vmt b/data_static/streamradio/playlists/local/portal_json.txt similarity index 100% rename from materials/3dstreamradio/_data/streamradio/playlists/local/portal_json.vmt rename to data_static/streamradio/playlists/local/portal_json.txt diff --git a/data_static/streamradio/version.txt b/data_static/streamradio/version.txt new file mode 100644 index 0000000..4ce7731 --- /dev/null +++ b/data_static/streamradio/version.txt @@ -0,0 +1,2 @@ +445 +1722461645 diff --git a/git-hooks-pre-commit b/git-hooks-pre-commit index 1201096..0af2308 100644 --- a/git-hooks-pre-commit +++ b/git-hooks-pre-commit @@ -1,5 +1,5 @@ #!/bin/sh -filename="materials/3dstreamradio/_data/version.vmt" +filename="data_static/streamradio/version.txt" version=$(head -n 1 $filename) nextversion=$(($version + 1)) timestap=$(date -u +%s) diff --git a/lua/streamradio_core/_load.lua b/lua/streamradio_core/_load.lua index 1751133..7280044 100644 --- a/lua/streamradio_core/_load.lua +++ b/lua/streamradio_core/_load.lua @@ -9,7 +9,7 @@ LIB.Loaded = nil LIB.Errors = {} local function getVersion() - local versiondata = file.Read("materials/3dstreamradio/_data/version.vmt", "GAME") or "" + local versiondata = file.Read("data_static/streamradio/version.txt", "GAME") or "" versiondata = string.Explode("[\r\n|\r|\n]", versiondata, true) or {} local Version = string.Trim(tostring(versiondata[1] or "")) @@ -270,13 +270,13 @@ local function loadAddon() -- Sometimes the version is not known, yet. if CLIENT then - local NEED_VERSION = 230904 + local NEED_VERSION = 240730 if VERSION < NEED_VERSION then versionError = string.format("Your GMod-Client (version: %s) is too old!\nPlease update the GMod-Client to version %s or newer!", VERSION, NEED_VERSION) end else - local NEED_VERSION = 230628 + local NEED_VERSION = 240730 if VERSION < NEED_VERSION then versionError = string.format("The GMod-Server (version: %s) is too old!\nPlease update the GMod-Server to version %s or newer!\nTell an Admin!", VERSION, NEED_VERSION) diff --git a/lua/streamradio_core/http.lua b/lua/streamradio_core/http.lua index 9f0cc17..5e4d51d 100644 --- a/lua/streamradio_core/http.lua +++ b/lua/streamradio_core/http.lua @@ -73,6 +73,8 @@ local function request(url, callback, parameters, method, headers, body, type) return end + local failed = false + requestdata.failed = function(err) callcallbacks(rq, false, { err = err or "", @@ -92,6 +94,7 @@ local function request(url, callback, parameters, method, headers, body, type) }) cleanDoneQuene() + failed = true end requestdata.success = function(code, body, headers) @@ -125,11 +128,16 @@ local function request(url, callback, parameters, method, headers, body, type) }) cleanDoneQuene() + failed = false end - HTTP(requestdata) - rq.started = true + + local success = HTTP(requestdata) + + if not success and not failed then + requestdata.failed("HTTP failed") + end end function LIB.RequestRaw(url, callback, body, method, headers, type) diff --git a/lua/streamradio_core/server/sv_resource.lua b/lua/streamradio_core/server/sv_resource.lua index 9a9d46d..5ca2877 100644 --- a/lua/streamradio_core/server/sv_resource.lua +++ b/lua/streamradio_core/server/sv_resource.lua @@ -1,23 +1,20 @@ resource.AddWorkshop( "246756300" ) -- Workshop download --- Workaround Garry code that disallows shipping *.txt files for the data folder to Workshop. -local WorkshopDataDirectory = "materials/3dstreamradio/_data" +local g_staticDataDirectory = "data_static" local function CopyFiles( dir ) file.CreateDir( dir ) - local files, directories = file.Find(WorkshopDataDirectory .. "/" .. dir .. "/*", "GAME") + local files, directories = file.Find(g_staticDataDirectory .. "/" .. dir .. "/*", "GAME") for _, f in ipairs(files or {}) do local filename = dir .. "/" .. f - local fullpath = WorkshopDataDirectory .. "/" .. filename + local fullpath = g_staticDataDirectory .. "/" .. filename - if not file.Exists(fullpath, "GAME") then continue end - - local ext = string.GetExtensionFromFilename(filename) - if ext ~= "vmt" then continue end + if not file.Exists(fullpath, "GAME") then + continue + end - local newfilename = string.StripExtension(filename) .. ".txt" - file.Write(newfilename, file.Read(fullpath, "GAME") or "") + file.Write(filename, file.Read(fullpath, "GAME") or "") end for _, d in ipairs(directories or {}) do diff --git a/materials/3dstreamradio/_data/streamradio/playlists/community/deutsche-welle_pls.vmt b/materials/3dstreamradio/_data/streamradio/playlists/community/deutsche-welle_pls.vmt deleted file mode 100644 index e5e2ed5..0000000 --- a/materials/3dstreamradio/_data/streamradio/playlists/community/deutsche-welle_pls.vmt +++ /dev/null @@ -1,24 +0,0 @@ -[playlist] -NumberOfEntries=7 -File1=https://dw.audiostream.io/dw/1025/mp3/64/dw05 -Title1=Deutsche Welle DW05 (Arabic) [not 24/7] -Length1=-1 -File2=https://dw.audiostream.io/dw/1027/mp3/64/dw08 -Title2=Deutsche Welle DW08 (Amharic, French, Hausa, Portuguese, Swahili) [not 24/7] -Length2=-1 -File3=https://dw.audiostream.io/dw/1028/mp3/64/dw09 -Title3=Deutsche Welle DW09 (English, Greek, Russian) [not 24/7] -Length3=-1 -File4=https://dw.audiostream.io/dw/1022/mp3/64/dw-fm02 -Title4=Deutsche Welle FM02 (Hausa) [not 24/7] -Length4=-1 -File5=https://dw.audiostream.io/dw/1023/mp3/64/dw-fm03 -Title5=Deutsche Welle FM03 (Swahili) [not 24/7] -Length5=-1 -File6=https://dw.audiostream.io/dw/1024/mp3/64/dw-fm04 -Title6=Deutsche Welle FM04 (French) [not 24/7] -Length6=-1 -File7=https://dw.audiostream.io/dw/1026/mp3/64/dw-fm05 -Title7=Deutsche Welle FM05 (Portuguese) [not 24/7] -Length7=-1 -Version=2 diff --git a/materials/3dstreamradio/_data/version.vmt b/materials/3dstreamradio/_data/version.vmt deleted file mode 100644 index c88fd73..0000000 --- a/materials/3dstreamradio/_data/version.vmt +++ /dev/null @@ -1,2 +0,0 @@ -444 -1718126074