Skip to content

Commit 4b03ffe

Browse files
committed
Fix for #23 and other stuff.
- 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
1 parent 172add7 commit 4b03ffe

8 files changed

Lines changed: 29 additions & 127 deletions

File tree

data_static/streamradio/playlists/community/gg-radio_pls.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[playlist]
22
NumberOfEntries=1
3-
File1=http://yp.shoutcast.com/sbin/tunein-station.pls?id=567807
3+
File1=http://play.sas-media.ru/play_256
44
Title1=Noise FM
55
Length1=-1
66
Version=2

data_static/streamradio/playlists/community/rfc-media_pls.txt

Lines changed: 0 additions & 99 deletions
This file was deleted.

data_static/streamradio/playlists/community/wcck-dead-fm_pls.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
445
2-
1722461645
1+
446
2+
1725659185

lua/entities/base_streamradio_gui.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,12 +1027,11 @@ if CLIENT then
10271027
end
10281028

10291029
function ENT:ShouldRemoveGUI()
1030-
local ply = LocalPlayer()
1031-
10321030
if self.DisplayLess then
10331031
return true
10341032
end
10351033

1034+
local ply = LocalPlayer()
10361035
if StreamRadioLib.IsGUIHidden(ply) then
10371036
return true
10381037
end
@@ -1054,6 +1053,7 @@ if CLIENT then
10541053
return
10551054
end
10561055

1056+
local ply = LocalPlayer()
10571057
if not self:CheckDistanceToEntity(ply, StreamRadioLib.GetDrawDistance(), nil, StreamRadioLib.GetCameraViewPos(ply)) then
10581058
return
10591059
end

lua/streamradio_core/classes/stream.lua

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ local LIBError = StreamRadioLib.Error
2626
local LIBUtil = StreamRadioLib.Util
2727
local LIBUrl = StreamRadioLib.Url
2828
local LIBStream = StreamRadioLib.Stream
29+
local LIBString = StreamRadioLib.String
2930

3031
local BASE = CLASS:GetBaseClass()
3132
local g_maxSongLenForCache = 60 * 60 * 1.5 -- 1.5 Hours
@@ -2174,20 +2175,12 @@ function CLASS:ReviveStream()
21742175
end
21752176

21762177
local function getTagsMetaAsTable(channel)
2177-
local data = channel:GetTagsMeta()
2178-
if not data then
2178+
local meta = channel:GetTagsMeta()
2179+
if not meta then
21792180
return nil
21802181
end
21812182

2182-
local result = {}
2183-
2184-
data = string.Trim(data)
2185-
2186-
for k, v in string.gmatch(data, "([%w_]+)%s*=%s*'(.+)';") do
2187-
k = string.lower(k)
2188-
result[k] = v
2189-
end
2190-
2183+
local result = LIBString.StreamMetaStringToTable(meta)
21912184
return result
21922185
end
21932186

lua/streamradio_core/string.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,26 @@ function LIB.IsValidFilename(filename)
208208
return true
209209
end
210210

211+
function LIB.StreamMetaStringToTable(meta)
212+
meta = tostring(meta or "")
213+
meta = string.Trim(meta or "")
214+
215+
local result = {}
216+
217+
for k, v in string.gmatch(meta, "([%w_]+)%s*=%s*([^;]*)[;]?") do
218+
k = string.lower(k)
219+
if k == "" then
220+
continue
221+
end
222+
223+
v = string.gsub(v, "^'(.*)'$", "%1")
224+
v = string.Trim(v or "")
225+
226+
result[k] = v
227+
end
228+
229+
return result
230+
end
211231

212232
return true
213233

0 commit comments

Comments
 (0)