Skip to content

Commit

Permalink
Fix for #23 and other stuff.
Browse files Browse the repository at this point in the history
- Fixed draw distance not working properly (#23)
- Removed broken community playlists. GG-Radio has been taken offline.
- Fixed Noise-fm playlist
- Fixed stream title output
  • Loading branch information
Grocel committed Sep 6, 2024
1 parent 172add7 commit 4b03ffe
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 127 deletions.
6 changes: 0 additions & 6 deletions data_static/streamradio/playlists/community/gg-radio_pls.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[playlist]
NumberOfEntries=1
File1=http://yp.shoutcast.com/sbin/tunein-station.pls?id=567807
File1=http://play.sas-media.ru/play_256
Title1=Noise FM
Length1=-1
Version=2
99 changes: 0 additions & 99 deletions data_static/streamradio/playlists/community/rfc-media_pls.txt

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions data_static/streamradio/version.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
445
1722461645
446
1725659185
4 changes: 2 additions & 2 deletions lua/entities/base_streamradio_gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1027,12 +1027,11 @@ if CLIENT then
end

function ENT:ShouldRemoveGUI()
local ply = LocalPlayer()

if self.DisplayLess then
return true
end

local ply = LocalPlayer()
if StreamRadioLib.IsGUIHidden(ply) then
return true
end
Expand All @@ -1054,6 +1053,7 @@ if CLIENT then
return
end

local ply = LocalPlayer()
if not self:CheckDistanceToEntity(ply, StreamRadioLib.GetDrawDistance(), nil, StreamRadioLib.GetCameraViewPos(ply)) then
return
end
Expand Down
15 changes: 4 additions & 11 deletions lua/streamradio_core/classes/stream.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ local LIBError = StreamRadioLib.Error
local LIBUtil = StreamRadioLib.Util
local LIBUrl = StreamRadioLib.Url
local LIBStream = StreamRadioLib.Stream
local LIBString = StreamRadioLib.String

local BASE = CLASS:GetBaseClass()
local g_maxSongLenForCache = 60 * 60 * 1.5 -- 1.5 Hours
Expand Down Expand Up @@ -2174,20 +2175,12 @@ function CLASS:ReviveStream()
end

local function getTagsMetaAsTable(channel)
local data = channel:GetTagsMeta()
if not data then
local meta = channel:GetTagsMeta()
if not meta then
return nil
end

local result = {}

data = string.Trim(data)

for k, v in string.gmatch(data, "([%w_]+)%s*=%s*'(.+)';") do
k = string.lower(k)
result[k] = v
end

local result = LIBString.StreamMetaStringToTable(meta)
return result
end

Expand Down
20 changes: 20 additions & 0 deletions lua/streamradio_core/string.lua
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,26 @@ function LIB.IsValidFilename(filename)
return true
end

function LIB.StreamMetaStringToTable(meta)
meta = tostring(meta or "")
meta = string.Trim(meta or "")

local result = {}

for k, v in string.gmatch(meta, "([%w_]+)%s*=%s*([^;]*)[;]?") do
k = string.lower(k)
if k == "" then
continue
end

v = string.gsub(v, "^'(.*)'$", "%1")
v = string.Trim(v or "")

result[k] = v
end

return result
end

return true

0 comments on commit 4b03ffe

Please sign in to comment.