Fixed a bug with -disablehttp, moved shipped playlist to data_static, added BBC to playlists, removed DW playlist

This commit is contained in:
Grocel 2024-07-31 23:34:05 +02:00
parent aec2918fd8
commit 172add7ed5
27 changed files with 29 additions and 42 deletions

View File

@ -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

View File

@ -0,0 +1,2 @@
445
1722461645

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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
if not file.Exists(fullpath, "GAME") then
continue
end
local ext = string.GetExtensionFromFilename(filename)
if ext ~= "vmt" 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

View File

@ -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

View File

@ -1,2 +0,0 @@
444
1718126074