From 4b03ffec851a51b913026cf0eb10764899bb9075 Mon Sep 17 00:00:00 2001 From: Grocel Date: Fri, 6 Sep 2024 23:46:25 +0200 Subject: [PATCH] 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 --- .../playlists/community/gg-radio_pls.txt | 6 -- .../playlists/community/noise-fm_pls.txt | 2 +- .../playlists/community/rfc-media_pls.txt | 99 ------------------- .../playlists/community/wcck-dead-fm_pls.txt | 6 -- data_static/streamradio/version.txt | 4 +- lua/entities/base_streamradio_gui.lua | 4 +- lua/streamradio_core/classes/stream.lua | 15 +-- lua/streamradio_core/string.lua | 20 ++++ 8 files changed, 29 insertions(+), 127 deletions(-) delete mode 100644 data_static/streamradio/playlists/community/gg-radio_pls.txt delete mode 100644 data_static/streamradio/playlists/community/rfc-media_pls.txt delete mode 100644 data_static/streamradio/playlists/community/wcck-dead-fm_pls.txt diff --git a/data_static/streamradio/playlists/community/gg-radio_pls.txt b/data_static/streamradio/playlists/community/gg-radio_pls.txt deleted file mode 100644 index 78a668f..0000000 --- a/data_static/streamradio/playlists/community/gg-radio_pls.txt +++ /dev/null @@ -1,6 +0,0 @@ -[playlist] -NumberOfEntries=1 -File1=https://api.tmw.media/ggradio/stream -Title1=GGRadio.net -Length1=-1 -Version=2 \ No newline at end of file diff --git a/data_static/streamradio/playlists/community/noise-fm_pls.txt b/data_static/streamradio/playlists/community/noise-fm_pls.txt index 22f9ea9..9e75679 100644 --- a/data_static/streamradio/playlists/community/noise-fm_pls.txt +++ b/data_static/streamradio/playlists/community/noise-fm_pls.txt @@ -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 diff --git a/data_static/streamradio/playlists/community/rfc-media_pls.txt b/data_static/streamradio/playlists/community/rfc-media_pls.txt deleted file mode 100644 index 9689eb2..0000000 --- a/data_static/streamradio/playlists/community/rfc-media_pls.txt +++ /dev/null @@ -1,99 +0,0 @@ -[playlist] -NumberOfEntries=32 -File1=http://rfcmedia.streamguys1.com/70hitspremium.mp3 -Title1=RFC Media - 70's Hits -Length1=-1 -File2=http://rfcmedia.streamguys1.com/80hitspremium.mp3 -Title2=RFC Media - 80's Hits -Length2=-1 -File3=http://rfcmedia.streamguys1.com/MusicPulsePremium.mp3 -Title3=RFC Media - Today's Hits -Length3=-1 -File4=http://rfcmedia.streamguys1.com/alternativehitspremium.mp3 -Title4=RFC Media - Alternative Hits -Length4=-1 -File5=http://rfcmedia.streamguys1.com/classicalpremium.mp3 -Title5=RFC Media - Classical -Length5=-1 -File6=http://rfcmedia.streamguys1.com/classichitspremium.mp3 -Title6=RFC Media - Classic Hits -Length6=-1 -File7=http://rfcmedia.streamguys1.com/classicrockpremium.mp3 -Title7=RFC Media - Classic Rock -Length7=-1 -File8=http://rfcmedia.streamguys1.com/coffeehousepremium.mp3 -Title8=RFC Media - Coffeehouse -Length8=-1 -File9=http://rfcmedia.streamguys1.com/countryhitspremium.mp3 -Title9=RFC Media - Country Hits -Length9=-1 -File10=http://rfcmedia.streamguys1.com/countryroadspremium.mp3 -Title10=RFC Media - Country Roads -Length10=-1 -File11=http://rfcmedia.streamguys1.com/mixlitepremium.mp3 -Title11=RFC Media - Mix Lite -Length11=-1 -File12=http://rfcmedia.streamguys1.com/newpophitspremium.mp3 -Title12=RFC Media - New Pop Hits -Length12=-1 -File13=http://rfcmedia.streamguys1.com/relaxationpremium.mp3 -Title13=RFC Media - Relax & Unwind -Length13=-1 -File14=http://rfcmedia.streamguys1.com/smoothjazzpremium.mp3 -Title14=RFC Media - Smooth Jazz -Length14=-1 -File15=http://rfcmedia.streamguys1.com/softrockhitspremium.mp3 -Title15=RFC Media - Soft Rock Hits -Length15=-1 -File16=http://rfcmedia.streamguys1.com/specs.mp3 -Title16=RFC Media - Specs Radio -Length16=-1 -File17=http://rfcmedia.streamguys1.com/sradulthits.mp3 -Title17=RFC Media - SR Adult Hits -Length17=-1 -File18=http://rfcmedia.streamguys1.com/sraltrockhits.mp3 -Title18=RFC Media - SR Alt Rock Hits -Length18=-1 -File19=http://rfcmedia.streamguys1.com/srclassiccountry.mp3 -Title19=RFC Media - SR Classic Country -Length19=-1 -File20=http://rfcmedia.streamguys1.com/srclassichits.mp3 -Title20=RFC Media - SR Classic Hits -Length20=-1 -File21=http://rfcmedia.streamguys1.com/srdanceone.mp3 -Title21=RFC Media - SR Dance One -Length21=-1 -File22=http://rfcmedia.streamguys1.com/srdiscobeats.mp3 -Title22=RFC Media - SR Disco Beats -Length22=-1 -File23=http://rfcmedia.streamguys1.com/srfastfashion.mp3 -Title23=RFC Media - SR Fast Fashion -Length23=-1 -File24=http://rfcmedia.streamguys1.com/srhitlist.mp3 -Title24=RFC Media - SR The Hit List -Length24=-1 -File25=http://rfcmedia.streamguys1.com/srpopstream.mp3 -Title25=RFC Media - SR Pop Stream -Length25=-1 -File26=http://rfcmedia.streamguys1.com/srprojectx.mp3 -Title26=RFC Media - SR Project X -Length26=-1 -File27=http://rfcmedia.streamguys1.com/srsounds70s.mp3 -Title27=RFC Media - SR Sounds of the 70's -Length27=-1 -File28=http://rfcmedia.streamguys1.com/srsoundsofsummer.mp3 -Title28=RFC Media - SR Sounds of the Summer -Length28=-1 -File29=http://rfcmedia.streamguys1.com/srthebrew.mp3 -Title29=RFC Media - SR The Brew -Length29=-1 -File30=http://rfcmedia.streamguys1.com/srtheswerve.mp3 -Title30=RFC Media - SR The Swerve -Length30=-1 -File31=http://rfcmedia.streamguys1.com/srtodayscountryhits.mp3 -Title31=RFC Media - SR Today's Country Hits -Length31=-1 -File32=http://rfcmedia.streamguys1.com/timewise.mp3 -Title32=RFC Media - Timewise -Length32=-1 -Version=2 \ No newline at end of file diff --git a/data_static/streamradio/playlists/community/wcck-dead-fm_pls.txt b/data_static/streamradio/playlists/community/wcck-dead-fm_pls.txt deleted file mode 100644 index 25fc089..0000000 --- a/data_static/streamradio/playlists/community/wcck-dead-fm_pls.txt +++ /dev/null @@ -1,6 +0,0 @@ -[playlist] -NumberOfEntries=1 -File1=https://wcckdeadfm.com/music -Title1=WCCK DeadFM -Length1=-1 -Version=2 diff --git a/data_static/streamradio/version.txt b/data_static/streamradio/version.txt index 4ce7731..1d7bc1f 100644 --- a/data_static/streamradio/version.txt +++ b/data_static/streamradio/version.txt @@ -1,2 +1,2 @@ -445 -1722461645 +446 +1725659185 diff --git a/lua/entities/base_streamradio_gui.lua b/lua/entities/base_streamradio_gui.lua index 1ada6cc..d7ce4d7 100644 --- a/lua/entities/base_streamradio_gui.lua +++ b/lua/entities/base_streamradio_gui.lua @@ -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 @@ -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 diff --git a/lua/streamradio_core/classes/stream.lua b/lua/streamradio_core/classes/stream.lua index 844783d..360b6d1 100644 --- a/lua/streamradio_core/classes/stream.lua +++ b/lua/streamradio_core/classes/stream.lua @@ -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 @@ -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 diff --git a/lua/streamradio_core/string.lua b/lua/streamradio_core/string.lua index d8ea786..e1e72c6 100644 --- a/lua/streamradio_core/string.lua +++ b/lua/streamradio_core/string.lua @@ -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