AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=109)
-   -   [ANY] SourceMod DJ (SMDJ) (https://forums.alliedmods.net/showthread.php?t=172258)

Dr. McKay 11-17-2011 23:55

[ANY] SourceMod DJ (SMDJ)
 
[ANY] SourceMod DJ

Plugin v2.6.1 - Web Interface v2.3.0

Description:
Allows users to type !music, !dj, or !jukebox to choose a song from a list of predefined songs in a regular panel menu. When a choice is made, the song's page from the web interface will be loaded in the MOTD browser, without the MOTD window being displayed. Includes a web interface to listen to songs, or a listing of songs available on the Web. The web interface takes no time to set up, and has support for four themes (default, TF2, Counter-Strike, and black) out of the box. Requires MySQL, and uses two tables. Does NOT require the game server to be able to access the database.

The web interface is themable! If you know what you're doing, you can create a .css file for a theme, and if it's good enough, I'll include it in the actual release!

Important! In order to hear the music in-game, users must have Adobe Flash Player for Other Browsers installed.

Updating:
When updating SMDJ, you need to update both the Web Interface and the plugin itself, if there is a newer version available for each. Otherwise, only update the component that is out-of-date. To update the plugin, simply drop smdj.smx into your plugins folder. Some updates might add new convars, and if this happens, back up the plugin.smdj.cfg file and delete it, so a new one can be generated. When updating the Web Interface, backup your config.php file, then upload all of the files and folders in the zip to the web server, overwriting all files. Then edit the new config.php and add back in your settings.

Commands:
sm_music - (!music in chat) pulls up the menu. Can be followed with a song title to directly play a song, case-insensitive (e.g. !music like a boss)
sm_dj - (!dj in chat) same as above
sm_jukebox - (!jukebox in chat) same as above
sm_musicinfo - (!musicinfo in chat) pulls up the MOTD window where you can view the title, pause, adjust volume, etc.
sm_randomsong - (!randomsong in chat) plays a random song
sm_songlist - (!songlist in chat)
sm_musicoff - (!musicoff in chat) turns the music off
sm_musichelp - (!musichelp in chat) displays help on installing Adobe Flash Player
sm_reloadsongs - reload the song list (by default requires ADMFLAG_RCON)

Cvars:
smdj_version - plugin version
smdj_advert - (default 1) sets whether a user's music choice will be broadcast to the server in chat
smdj_join_advert - (default 1) sets whether the user will be informed of the SMDJ commands upon connecting
smdj_url - the URL of your SMDJ web installation (i.e. "http://www.thehoodedalliance.com/smdj")
smdj_url_port - if your web installation is on a port other than 80, set it here
smdj_auth_token - prevents leechers. Get this from the admin panel of your web installation
smdj_help_advert - (default 1) sets whether a user is notified to type !musichelp if they can't hear the music
smdj_repeat_default - (default 1) sets the state of the repeat feature for new clients
smdj_shuffle_default - (default 0) sets the state of the shuffle feature for new clients
smdj_volume_default - (default 100) sets the default volume for new clients (10 - 200)
smdj_debug - (default 0) toggles debugging

Plugin creates and loads /cfg/sourcemod/plugin.smdj.cfg

Overrides:
SMDJPlayToOthers (default: ADMFLAG_SLAY) controls which admins can play music to others

Installation:
  1. Install the Socket extension if you don't have it already
  2. Put smdj.smx into /addons/sourcemod/plugins
  3. Extract the Web Interface zip and upload it to your server
  4. Find a MySQL database to use, and put its settings into config.php in the web interface
  5. Set a theme (if you want), and set an administration password (can be plaintext or MD5) in config.php
  6. Log into your web interface and note the values of smdj_url and smdj_auth_token
  7. Type "sm plugins load smdj" on your server command line
  8. Put the values given by your web interface into cfg/sourcemod/plugin.smdj.cfg
  9. Type "sm plugins reload smdj" on your server command line

Requirements:
Requires the Socket extension.

Developers:
This plugin provides a forward for when users start to listen to music. See the include file for documentation.

Demo:
You can see a functioning demo of the TF2 theme here: http://www.thehoodedalliance.com/smdj/

Credits:
Thanks to:
Planned:
  • On-site uploader Done!
  • Playlists Done!
  • Allow admins to play playlists to others
  • Editing playlists
  • Optional URL hiding

Changelog:
  • Plugin v2.6.0 + Web Interface 2.3.0 (7/1/13)
    • Added ability for admins to stop other players' music
    • Added default volume setting
    • Added ability to remove songs from new playlists as users create them
    • Fixed a couple bugs
  • Plugin v2.5.0 (1/1/13)
    • Added SMDJ_OnStartListen forward
  • Plugin v2.4.0 (10/7/12)
    • Added AreClientCookiesCached check when using !dj command (and aliases)
  • Plugin v2.3.0 + Web Interface v2.2.0 (6/18/12)
    • Added playlists
    • Added option for admins to play songs to others
  • Plugin v2.2.0 (4/27/12)
    • Fixed the problems with v2.1.0 (v2.1.0 didn't work at all)
    • Added smdj_repeat_default cvar
    • !dj now pulls up an options menu instead of going directly to the song list
      • Song List
      • Random Song
      • Music Info
      • Stop Music
      • Toggle repeat feature
    • Added !randomsong command
    • Removed repeat option from !settings menu
  • Plugin v2.1.0 (4/27/12)
    • Added smdj_url_port cvar, so you can run the web panel off of a non-standard port
    • Added notification if typing !dj and there are no songs
  • Web Interface v2.1.0 (4/26/12)
    • Added 'counter-strike' and 'black' themes
    • Added a button to nuke the database (delete all songs at once)
  • Plugin + Web Interface v2.0.0 (4/25/12)
    • Plugin no longer requires MySQL access, so it can be used on cheap web hosts
    • Now requires Sockets
    • Added ability to disable repeat from the !settings menu
    • Added !musicinfo command
    • Added !songlist command
    • Web Interface now displays a failure message when the wrong password is given
    • smdj_auth_token cvar added
    • smdj_debug cvar added
    • Added ability to play a song directly by its title (!dj song title)
    • The song list now reloads itself on mapchange
  • Web Interface v1.1.0 (1/1/12)
    • Now supports direct uploading of files, either locally or via FTP
    • Web Interface now checks for updates and notifies you if there is an update available from the Administration page
  • Plugin v1.1.0 (11/23/11)
    • Added a notice when users pick their first song to type !musichelp for help on installing Adobe Flash Player
    • Added a cvar to disable the above notice
  • Plugin + Web Interface v1.0.0 (11/17/11)
    • Initial Release

This plugin does not automatically update due to issues that could arise with the plugin being updated but not the web interface.

This plugin uses Colors, which is required if you want to compile locally.

Download Plugin (smdj.smx)
View Source (smdj.sp)
Download Include File (smdj.inc)

Download Web Interface


.

Drixevel 11-18-2011 05:18

Re: [ANY] SourceMod DJ (SMDJ)
 
You could try to do a version script for the site so in the administrator panel, it says update now and it downloads and installs your update. :3

Also, Great Idea, only problem is this.
http://forums.alliedmods.net/showthread.php?p=945519

Dr. McKay 11-18-2011 06:07

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by r3dw3r3w0lf (Post 1598453)
You could try to do a version script for the site so in the administrator panel, it says update now and it downloads and installs your update. :3

Also, Great Idea, only problem is this.
http://forums.alliedmods.net/showthread.php?p=945519

The web interface of that Jukebox plugin is broken, and I'm pretty sure it doesn't list the songs in a panel-style menu. I tried that one first. :)

Drixevel 11-18-2011 08:20

Re: [ANY] SourceMod DJ (SMDJ)
 
The web interface worked for me last time I used it. Sure, it does have 1 small error with a link but that's easily fixable but other than that, it worked entirely.

gameguysz 11-18-2011 14:52

Re: [ANY] SourceMod DJ (SMDJ)
 
I didn't like jukebox, half the time when i wanted to delete a song it wouldn't delete. So i had to do it manually and that was a pain since it moved and renamed the original file to somewhere else which involved me downloading and listening each song over and over again.. Ill definitely be giving this one a try.

poppin-fresh 11-20-2011 10:26

Re: [ANY] SourceMod DJ (SMDJ)
 
WebServer works fine. But server is crashig on plugin load. All the database info is correct.
Code:

L 11/21/2011 - 09:08:06: [SM] Native "SetFailState" reported: SourceMod DJ couldn't connect to the database: [2003]: Can't connect to MySQL server on 'immersion-networks.com' (10060)
L 11/21/2011 - 09:08:06: [SM] Displaying call stack trace for plugin "smdj.smx":
L 11/21/2011 - 09:08:06: [SM]  [0]  Line 39, D:\Libraries\Documents\Dropbox\SourceMod Plugins\smdj.sp::OnPluginStart()


Dr. McKay 11-20-2011 11:20

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by poppin-fresh (Post 1599706)
WebServer works fine. But server is crashig on plugin load. All the database info is correct.
Code:

L 11/21/2011 - 09:08:06: [SM] Native "SetFailState" reported: SourceMod DJ couldn't connect to the database: [2003]: Can't connect to MySQL server on 'immersion-networks.com' (10060)
L 11/21/2011 - 09:08:06: [SM] Displaying call stack trace for plugin "smdj.smx":
L 11/21/2011 - 09:08:06: [SM]  [0]  Line 39, D:\Libraries\Documents\Dropbox\SourceMod Plugins\smdj.sp::OnPluginStart()


The whole server is crashing? There's no reason that should happen.

Can I see your databases.cfg entry? Don't forget to remove your password.

poppin-fresh 11-20-2011 11:24

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

"smdj"
{
"driver" "mysql"
"host" "immersion-networks.com"
"database" "prem1_smdj"
"user" "prem1_smdju"
"pass" "********"
//"timeout" "0"
//"port" "0"
}
Tried host with IP and http & www. infront aswell

Dr. McKay 11-20-2011 11:33

Re: [ANY] SourceMod DJ (SMDJ)
 
Is remote MySQL allowed on your webserver?

poppin-fresh 11-20-2011 12:09

Re: [ANY] SourceMod DJ (SMDJ)
 
Yes. we also use sourcebans & hlstats
edit: we just tried it on a different webserver and getting same error.

Dr. McKay 11-20-2011 12:12

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by poppin-fresh (Post 1599769)
Yes. we also use sourcebans & hlstats

Has the server actually been crashing? Because the server has to restart for the DB configuration to take effect.

poppin-fresh 11-20-2011 12:26

Re: [ANY] SourceMod DJ (SMDJ)
 
It crashed the first time. The plugin created the config. We restarted the server a few times. Still getting the same error.

Dr. McKay 11-20-2011 12:52

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by poppin-fresh (Post 1599775)
It crashed the first time. The plugin created the config. We restarted the server a few times. Still getting the same error.

Hmm. What mod are you running? Can you post an extensions list?

poppin-fresh 11-20-2011 12:56

Re: [ANY] SourceMod DJ (SMDJ)
 
CS:S

[SM] Displaying 14 extensions:
[01] Automatic Updater (1.4.0): Updates SourceMod gamedata files
[02] Webternet (1.4.0): Extension for interacting with URLs
[03] Server Secure - Files Only (1.0.0): The finest defence
[04] CS:S Tools (1.4.0): CS:S extended functionality
[05] BinTools (1.4.0): Low-level C/C++ Calling API
[06] SDK Tools (1.4.0): Source SDK Tools
[07] Top Menus (1.4.0): Creates sorted nested menus
[08] GeoIP (1.4.0): Geographical IP information
[09] SDK Hooks (2.1.0): Source SDK Hooks
[10] Client Preferences (1.4.0): Saves client preference settings
[11] SQLite (1.4.0): SQLite Driver
[12] Regex (1.4.0): Provides regex natives for plugins
[13] Socket (3.0.1): Socket extension for SourceMod
[14] MySQL-DBI (1.4.0): MySQL driver implementation for DBI

Dr. McKay 11-20-2011 13:09

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by poppin-fresh (Post 1599793)
CS:S

[SM] Displaying 14 extensions:
[01] Automatic Updater (1.4.0): Updates SourceMod gamedata files
[02] Webternet (1.4.0): Extension for interacting with URLs
[03] Server Secure - Files Only (1.0.0): The finest defence
[04] CS:S Tools (1.4.0): CS:S extended functionality
[05] BinTools (1.4.0): Low-level C/C++ Calling API
[06] SDK Tools (1.4.0): Source SDK Tools
[07] Top Menus (1.4.0): Creates sorted nested menus
[08] GeoIP (1.4.0): Geographical IP information
[09] SDK Hooks (2.1.0): Source SDK Hooks
[10] Client Preferences (1.4.0): Saves client preference settings
[11] SQLite (1.4.0): SQLite Driver
[12] Regex (1.4.0): Provides regex natives for plugins
[13] Socket (3.0.1): Socket extension for SourceMod
[14] MySQL-DBI (1.4.0): MySQL driver implementation for DBI


There shouldn't be any conflict with those extensions. Double- and triple-check your configs. Is anyone successfully running this on CS:S?

poppin-fresh 11-20-2011 13:17

Re: [ANY] SourceMod DJ (SMDJ)
 
Just ran over the database. tested the database. tried it on two hosts. Using the same database as the web server. And that's working fine. So i don't know what the problem could be.

Dr. McKay 11-23-2011 02:13

Re: [ANY] SourceMod DJ (SMDJ)
 
Updated to v1.1.0. Displays an advert when a user picks their first song on how to get Adobe Flash Player for Other Browsers working. This can be disabled with the cvar smdj_help_advert. Please delete your plugin.smdj.cfg so a new one can be generated with the new cvar, or add it in manually.

Unreal1 11-27-2011 11:40

Re: [ANY] SourceMod DJ (SMDJ)
 
Nice man, I was actually about to make something like this.....lol your version has more features anyways.

Unreal1 11-27-2011 11:52

Re: [ANY] SourceMod DJ (SMDJ)
 
Can you make it so that an admin can play music to a client. Like the regular hiddenurl command except it will load the mp3 from your site instead of whatever else you would use.

Dr. McKay 11-27-2011 12:06

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by Unreal1 (Post 1603628)
Can you make it so that an admin can play music to a client. Like the regular hiddenurl command except it will load the mp3 from your site instead of whatever else you would use.

That's actually planned for 1.2.0. :D

bzellinger 11-27-2011 14:38

Re: [ANY] SourceMod DJ (SMDJ)
 
This does not work for me while in game. The menu pops up and select a test song that i uploaded through the web ui. I hear no music.

It works through the web ui
I see it added to the table in the db
I have installed the adobe flash player

"smdj"
{
"driver" "mysql"
"host" "xxxxxxxxxxxxx.com"
"database" "smdj"
"user" "root"
"pass" "ls;dkfjalf"
"port" "3306"
}

Dr. McKay 11-27-2011 14:57

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by bzellinger (Post 1603742)
This does not work for me while in game. The menu pops up and select a test song that i uploaded through the web ui. I hear no music.

It works through the web ui
I see it added to the table in the db
I have installed the adobe flash player

"smdj"
{
"driver" "mysql"
"host" "xxxxxxxxxxxxx.com"
"database" "smdj"
"user" "root"
"pass" "ls;dkfjalf"
"port" "3306"
}

I'll have to add a debug command to the next release. Did you install Flash Player for Other Browsers? http://sm.doctormckay.com/smdjhelp.php

Can you use !radio on a server that uses the radio plugin?

bzellinger 11-28-2011 12:49

Re: [ANY] SourceMod DJ (SMDJ)
 
I meet all the requirements. But, now that I think of it, it might be a Left 4 Dead issue.

Dr. McKay 11-28-2011 15:02

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by bzellinger (Post 1604221)
I meet all the requirements. But, now that I think of it, it might be a Left 4 Dead issue.

Possibly. Does the !musichelp command pull up the page?

bzellinger 11-28-2011 17:38

Re: [ANY] SourceMod DJ (SMDJ)
 
All the commands work in game.

FlaminSarge 11-28-2011 17:56

Re: [ANY] SourceMod DJ (SMDJ)
 
One glaring problem I see with this is the potential for leeching.
http://dl.doctormckay.com/dl/mp3/on_a_boat.mp3

Jukebox for Source works fine and takes care of the leeching problem as far as I can tell. Any solutions here?

Dr. McKay 11-28-2011 19:10

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by FlaminSarge (Post 1604391)
One glaring problem I see with this is the potential for leeching.
http://dl.doctormckay.com/dl/mp3/on_a_boat.mp3

Jukebox for Source works fine and takes care of the leeching problem as far as I can tell. Any solutions here?

I suppose I could put in a script that would create a temporary URL for each file. It'd have to be a config option though, because I believe it'd only work if the files are hosted locally (otherwise, it'd have to download the file from the remote server then download it to the client, using filesize * 2 bandwidth [upload + download]). Or you can just get a Dropbox and host the files for free. :)

I don't care about mine, I don't use that server for anything except running Bitcoin daemon and TF2 fast download/MP3 download. I'm not in much danger of using up all my 1 TB of bandwidth anytime soon.

Dr. McKay 11-28-2011 19:13

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by bzellinger (Post 1604380)
All the commands work in game.

So it does pull up the help page? If that's the case, there's a problem with your Flash Player. I'm adding a debug cvar to the next version (ETA this week hopefully) that'll pull up the page visibly so you can check for any plugin errors (Flash player)

andrew13 12-02-2011 02:01

Re: [ANY] SourceMod DJ (SMDJ)
 
Is there a way i can add songs? cause its a nice list, but i'd like to add some more!

Dr. McKay 12-02-2011 07:32

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by andrew13 (Post 1606165)
Is there a way i can add songs? cause its a nice list, but i'd like to add some more!

Install the web panel yourself? The link to mine in the OP is just meant to be an example...

bzellinger 12-02-2011 14:58

Re: [ANY] SourceMod DJ (SMDJ)
 
I believe flash doesn't work in L4D games. I wonder if the browser has a different method of embedding a music player. Just for fun, I even tried wmp and that didn't work.

poppin-fresh 12-04-2011 06:51

Re: [ANY] SourceMod DJ (SMDJ)
 
I have everything working. and the configs set up. But when a player types !music in game and hits the song. it says it's playing but nothing plays.

Dr. McKay 12-05-2011 08:46

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by poppin-fresh (Post 1607442)
I have everything working. and the configs set up. But when a player types !music in game and hits the song. it says it's playing but nothing plays.

*sigh* Does the player have Flash working? Can you have them type !musichelp and see if the player there works?

(!musichelp won't be working for a little while today, I'm having trouble with my web server. It'll be back up this afternoon though.)

poppin-fresh 12-05-2011 18:38

Re: [ANY] SourceMod DJ (SMDJ)
 
Yes, And it works going to the site and playing it form their too.

Dr. McKay 12-05-2011 19:08

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by poppin-fresh (Post 1608376)
Yes, And it works going to the site and playing it form their too.

In that case, there must be some problem with either your configuration or your web interface itself. Can you post a link to your web interface, and your url cvar?

poppin-fresh 12-05-2011 19:57

Re: [ANY] SourceMod DJ (SMDJ)
 
EDIT: Fixed. Thanks

bzellinger 12-05-2011 23:32

Re: [ANY] SourceMod DJ (SMDJ)
 
It works now. I removed the /index.php from the url in the cfg file.

poppin-fresh 12-06-2011 09:15

Re: [ANY] SourceMod DJ (SMDJ)
 
You should include some sort of volume controll in the next release. e.g
!volume
increase 20%
increase 40%
decrease 20%
decrease 40%

Dr. McKay 12-06-2011 18:43

Re: [ANY] SourceMod DJ (SMDJ)
 
Quote:

Originally Posted by poppin-fresh (Post 1608621)
You should include some sort of volume controll in the next release. e.g
!volume
increase 20%
increase 40%
decrease 20%
decrease 40%

As soon as I figure out how to show the MOTD window without changing the page it's displaying, I'll do that.

bzellinger 12-06-2011 19:18

Re: [ANY] SourceMod DJ (SMDJ)
 
I deleted some mp3 url's from the web UI yesterday, but they still appear in the game menu. Restarting the server does not refresh the list.

I checked the MySQL table and it's correct.


All times are GMT -4. The time now is 02:48.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.