Radio 2

About:

Adds a Radio player to SourceMod that supports direct stations or streaming audio with built in volume control. Version 2 comes with improved support for genres in station lists, ShoutCast auto-updating playlists and currently playing track queries.

Server Console Commands:

  • sm_radio_enable 1/0 – Enable the radio plugin
  • sm_radio_play_type 1/3 – Play type for the radio.
    1 – Direct using the very first method of loading a stream directly from a websites player.
    2 – Volume Wrapper mode using the HTML wrapper page with volume control.
    3 – ShoutCast powered with auto-updating playlists utilising radio.dubbeh.net
  • sm_radio_advert 1/0 – Enable advertising the users radio station choice
  • sm_radio_welcome 1/0 – Enable the welcome message
  • sm_radio_logging 1/0 – Enable logging to the server console and log file
  • sm_radio_autoplay 1/0 – Enable the radio to auto-play on map change.
  • sm_radio_init_conn_vol 0.01/1.0 – When one of the play type modes that support volume control is active, this sets the initial volume for a user on first connect (0.10 recommended (10%) in CS:GO at least)
  • sm_radio_auto_update 1/0 – Enable the plugin to automatically update (If available updates are found)
  • sm_radio_check_html_motd 1/0 – Check clients on connect for “cl_disablehtmlmotd” and warn them if enabled. The plugin won’t function with cl_disablehtmlmotd enabled on a client.
  • sm_radio_shoutcast_custom 1/0 – Append custom stations using the wrapper page under ShoutCast mode. Loaded from “sourcemod/configs/shoutcastcustom.txt” using the standard station list format.
  • sm_radio_track_query_enable 1/0 – Enable the track query feature.
    For custom stations, you’ll need to upload trackquery.php to your own webhost, then modify the line that looks like this:
    $AllowedIPs = array ("127.0.0.1", "1.1.1.1", "2.2.2.2", "3.3.3.3");
    Change to your own server IP(s). Once you’ve done that, make sure to edit the “Volume Track Query” and point it to your own hosted trackquery.php inside your playlist of choice.
  • sm_radio_shoutcast_playlist 1/3 – Sets the playlist type for ShoutCast mode.
    1 = Standard mode with genres and child-genres
    2 = No child genres
    3 = Top 500 stations

Client Console Commands:

  • sm_radio – Pop up the radio station menu
  • sm_radiooff or sm_roff – Turns the radio off
  • sm_browse “www.site.com” – browse www.site.com
  • sm_genre or sm_genres – Popup the Genre selection menu.
    Can append a primary genre to get directly to that genre menu eg. “sm_genre alternative”. If the genre isn’t found, will list all primary genres to the user.
  • sm_song or sm_track – Displays the currently playing stations song/track (Works only for supported stations)
  • sm_volume or sm_vol – Set the volume for the station you’re currently listening to (Minimum is 0.01 (1%) – Maximum is 1.0 (100%)
  • sm_rhelp or sm_radiohelp – Lists available client commands in a panel

Admin Console Commands:

  • sm_radio_force_download – Forces the playlist download inside the plugin. This is if you change “sm_radio_shoutcast_playlist” and want to download the new type. Right now all playlists are loaded from the same file, and would only update to the new method once a week. So make sure to run this or delete the playlist file to update.

Chat Usage:

  • !radio – Pops up a radio stations menu
  • !radiooff or !roff – Switches off the radio
  • !browse “www.site.com” or /browse “www.site.com” – Browse a website of choice
  • !track or !song – Displays the stations currently playing track in chat (If station is supported)
  • !genre or !genres – Pops up the genre selection menu. Use “!genre “primary_genre_name” to access that genres menu directly. If primary_genre_name is unknown, will list all primary genres
  • !rhelp or !radiohelp – Lists available client commands in a panel
  • !volume or !vol – Set the volume for the station you’re currently listening to (Minimum is 0.01 (1%) – Maximum is 1.0 (100%)

Genre List Format:

Right now we have 3 methods to load stations using the console variable sm_radio_play_type.

  • 1 = Direct – This is the very first method released on Radio that used a direct webplayer from your favourite station.
  • 2 = Volume – Came around in v1.0.0.16 that utilised a wrapper page to load stations and could access streams directly.
  • 3 = ShoutCast – This is a new method in version 2, that loads everything through radio.dubbeh.net utilising the ShoutCast.com API and auto-updating playlists on a weekly basis.

The old method of station loading is no longer valid – so old playlists won’t work anymore, will have to be converted to the new format.

Everything has now switched to Keyvalues and storing data with Dynamic by Neuro_Toxin.

Genres are supported with child-genres using:

“Has Children” “1” – This is essential to keep the parsing working correctly

Inside the root Genre Node, example:

Can see an example of this inside the ShoutCast auto-updated playlist for full effect, just make sure to add the “Stream URL” for the station – So that Radio knows what the Stream URL is for the current station outside of ShoutCast mode.

This is another example with base genres only, without utilising a child genre:

Now the parser will take the following section as an actual station because “Has Children” is set to 0.

Final example is stations without utilising any type of genres:

All we have to do is set “Use Genres” “0” and each section from that point on-wards is read as a station.
Don’t worry about having to add a Genre ID/Station ID for each individual entry, if one isn’t found then the plugin will generate a random one using the SourceMods built in random function.

Last final thing about the station config changes. All files are stored inside the “sourcemod/configs/” folder.

sm_radio_play_type config files are as follows:

  • 1 – Direct – sourcemod/configs/radiodirect.txt
  • 2 – Volume – sourcemod/configs/radiovolume.txt
  • 3 – ShoutCast – sourcemod/configs/radioshoutcast.txt (Don’t try to modify this. It’s auto-updated weekly.)

Also, the addition of custom streams along side shoutcast mode using sm_radio_shoutcast_custom “1”:

  • ShoutCast Custom – sourcemod/configs/shoutcastcustom.txt

Station file format is exactly the same without anything changed, just loads your personal Volume Wrapper in to the base plugin.

Supported Languages:

  • English
  • German – Thanks Miha And Tema
  • Russian – Thanks Miha And Tema
  • French – Incomplete for version 2
  • Italian – Incomplete for version 2
  • Spanish – Incomplete for version 2
  • Turkish – Almost complete – Huge thanks to chalr
  • Polish – Incomplete for version 2
  • Dutch – Huge thanks to Mutse

Installation:

  • radio.smx -> addons\sourcemod\plugins
  • radio.phrases.txt -> addons\sourcemod\translations
  • plugin.radio.cfg -> cfg\sourcemod
  • radioshoutcast.txt-> addons\sourcemod\configs
  • radiodirect.txt -> addons\sourcemod\configs
  • radiovolume.txt -> addons\sourcemod\configs
  • shoutcastcustom.txt -> addons\sourcemod\configs
  • radio2_wrappers.zip -> Your own custom web server (Feel free to use my host with the exception of Google Analytics and AdSense (Supports the plugin and hosting costs). Only for the rvw.html, If you want the trackquery.php hosted by me, contact me directly and I’ll see what I can come up with.

rvw.html (Radio Volume Wrapper) – Enables the volume control option to function correctly inside the plugin menu and especially CS:GO with the MOTD changes
trackquery.php (Track Query Script) – For track query outside of standard ShoutCast mode, need to put this on your own webhost and modify the $AllowedIPs to your own gameservers. Don’t forget to edit the playlist file of choice and change the “Track Query URL” to point at it.

All radio station links can be setup inside radiovolume.txt, radiodirect.txt and shoutcastcustom.txt depending on settings, radioshoutcast.txt is auto-updated inside the plugin.

Notes:

SteamWorks – Required to keep the ShoutCast playlists in sync with the radio.dubbeh.net player (Station indexes will change every single week).
Dynamic – Essential for the plugin to function correctly – This is how all the genres and stations are stored internally using the in-built method maps.
Updater – This plugin is great to keep the latest versions of many plugins on your server that support it and save the hassle of manually updating everything.
“disabled/sm_playlist_converter.smx” – This is a small plugin to convert version 1 playlists to version 2. Move the radio_playlist_converter.smx to the base plugins folder and once loaded up, type in the console “sm_plconvert 1/2”. 1 is to output to “sourcemod\configs\radiovolume.txt” and option 2 will output to “sourcemod\configs\shoutcastcustom.txt”, make sure you have RCon command access for these commands. Wait a few seconds and you should have the new format playlists ready to utilise in Radio 2.

Guide for getting custom streams from TuneIn.com can be found here.

If you’re still confused about anything. Give me a shout in the forums here or SourceMod ones, can also be e-mailed directly from the contact page.

Download:

Download from my personal host here and extract straight to your game server directory (Complete package, including SteamWorks and Updater).
radio2_wrappers.zip can be downloaded here and put on your own custom webserver
The Official SourceMod thread is here.

Support:

Any support is welcome and much appreciated, especially if you frequently use any of my plugin(s). Really easy way to support the server and plugin development costs is to keep the rvw.html hosted at “https://radio.dubbeh.net/rvw.html” inside the config text files. If you want to donate, please send it to the SourceMod project.

Credits:

SourceTunes, sessus, gH0sTy, InflatableSoulmate, Calystos, Swagger, jack_wade, Darkthrone, Maxximou5, kin5, MihaAndTema, GoD-Tony, Dr. McKay, chalr, CamerDisco, Bara, Neuro_Toxin and KyleS

Version History:

v2.0.0.7

  • Added Dutch translations – Big thanks to Mutse
  • Small logic processing problem with the volume menu fixed
  • Added the updated updater.inc for new decls – Was missing from previous versions
  • Plugin now compiles with “pragma new decls” forced
  • Other small internal code changes

v2.0.0.6

  • Improved cookie handling when changing play types
  • Extra checks added to the station storage – Fixes a small log error

v2.0.0.5

  • Fixed an invalid handling of the ShoutCast custom stations menus
  • Long standing issue with the base menu not utilising generes correctly in ShoutCast mode

v2.0.0.4

  • Added Russian and German Translations – Thanks Miha and Tema
  • Dropped Dynamic for now and switched over to custom internal station storage – Resolves the memory leaking bug

v2.0.0.3

  • Removed the hardcoded genres usage in ShoutCast mode
  • Only initialise the genre collections now when they’re enabled inside the playlist file(s)

v2.0.0.2

  • The problem with Dynamic and empty methodmaps is now fixed and added source to package
  • Cached the console variables “sm_radio_play_type” and “sm_radio_shoutcast_custom” in OnConfigsExecuted()
    This avoids conflicts or crashes with the way playlists are parsed on each map start
  • Added a slight change to the ShoutCast auto-generated playlists
    Potentially GeoBlocked stations are now marked with (*) – These are stations utilising Radionomy
    This also adds a small change to the translation file

v2.0.0.1

  • Fixed problem with Dynamic and trying to clear an uninitialized methodmap
  • Added the missing LANG_SERVER on Track Query Disabled string formatting
  • More checks done for missing playlist files and feedback to the users
  • 3 playlist modes supported from the ShoutCast API, all controlled with “sm_radio_shoutcast_playlist 1/3”
  • ShoutCast playlists can be forced to download with “sm_radio_force_download” – This is useful if you change the playlist type from the cVar above
  • Another couple more translations added – So make sure to update your translation files
  • ShoutCast Auto-Playlist downloading, if one isn’t found (Make sure to reload the map after the download completes to apply changes)
  • Updated to the latest SteamWorks inside the package

v2.0.0.0 Final

  • Finally moved the plugin out of BETA – Everything seems to be stable now
  • Added support for track query under Volume Wrapper mode and ShoutCast custom
    Need to put trackquery.php inside the radio2_wrappers.zip on your own webhost and modify the $AllowedIPs to your own game server ones. After you’ve edited the trackquery.php script, set the “Volume Track Query” to the URL of your own host.
  • Included Multi-Colors by Bara in the base package
  • Included a seperate plugin to convert your old Radio version 1 playlists to Version 2 KeyValues
  • Turkish translation added – Huge thanks to chalr (Incomplete again, sorry :()
  • Added sm_radio_track_query_enable – Enable or disable track query in Volume and ShoutCast modes
    This added a new translation text – So make sure to update your translation files from Beta 3 to current
  • Removed the “Browse Fix” completley for CS:GO – This doesn’t work anymore since a few patches back

v2.0.0.0 BETA 3

  • Changed menu processing – Saved a tiny bit of CPU in the process with one less iteration over genres
  • Added support for custom stations alongside the ShoutCast radio list with “sm_radio_shoutcast_custom 0/1”
    Parsed from “sourcemod/configs/shoutcastcustom.txt” using the standard format
  • Help panel added to show commands to users that can be accessed by typing !radiohelp or !rhelp
  • Finalised the translations – Updates and additions in various languages would be great, Thanks!

v2.0.0.0 BETA 2

  • Removed auto-appending “/;” to stream URL’s for now. Causes problems with IceCast 2 streams and makes them unreachable

v2.0.0.0 BETA 1

  • Switched all the station loading URLs over to HTTPS for Volume Wrapper and ShoutCast Mode (If using my website)
  • Plugin is now powered by www.ShoutCast.com with auto-updating playlists utilising radio.dubbeh.net
  • Radio is now using Dynamics to store stations and using key values to load the data – Huge Thanks to Neuro_Toxin for an amazing plugin
  • New radio stations format – Everything is based around key values
  • Genre support
  • Track query support (Only for SHoutCast mode right now)
  • Utilising SteamWorks by KyleS for auto-updating playlists to keep in sync with ShoutCast and Track Query (WIP)