Forum

Page 1 of 2 12 LastLast
Results 1 to 15 of 27
  1. #1
    Join Date
    July 2014
    Posts
    8

    [GUIDE/WALKTHROUGH] Music bot without GUI or soundcard - ideal for VPS server

    THE GUIDE TO THE EASY SERVERSIDE MUSICBOT

    TABLE OF CONTENTS

    1. Introduction
    2. Prerequisites/specifications
    3. Installation
      1. Install packages needed
      2. Run everything
    4. FAQ




    INTRODUCTION
    NOTE FOR MOD: If this is posted in the wrong forum, feel free to move it. I'm new around these forums and this seemed like the place to post it. Cheers

    Hello there, curious reader. If you stumbled upon this thread, you are most likely looking for a guide on how to make your own, scriptable music bot with your own music and your own services. Please be aware that this guide ONLY covers Ubuntu and I will therefore not be taking ANY questions not related to that operating system. If you got this far, please be noted that while this is a tutorial, you also need a fairly good understanding of the syntax of linux systems in general as not every command will be explained throughout the tutorial.

    If you would just like to get started, go down to requirements. If you don't mind me rambling, stay here for awhile. So, the reason I figured out how to do this was due to a couple of different reasons. First off, we needed a free music bot on our server, and secondly, I needed some kind of coding challenge. So while this might not be the most daunting adventure, be clear that you may have to google if missing dependencies or other bugs within Ubuntu (or another linux system, if you feel comfortable porting my commands from Ubuntu to, say, debian). With no further ado, let's get started.



    PREREQUISITES/SPECIFICATIONS
    To get this up and running, there are a couple of things that are absolutely needed and other things that are simply nice to have installed.

    REQUIRED:
    • screen - a useful tool to managing multiple instances of things. This or an alternative is a must, but I will assume that you have this installed. You should be able to install this by typing
      Code:
      sudo apt-get install screen


    NICE TO HAVE:
    • aptitude - this tool helps you locate a lot of the packages if you aren't sure of what they are named or if you are missing dependencies. This package can be installed by typing
      Code:
      sudo apt-get install aptitude


    Apart from that, I am running my TeamSpeak3 server on a VPS with 3GB RAM and the client is also running on this, however that is way above what is needed. The minimum requirement is around 512mb RAM to make this setup work. You also need to have the port 6680 open and free and be a super user (i.e. being able to use sudo).



    INSTALLATION

    The quick way
    First step is to install all the things that we need to get the different screen sessions up and running and speaking to each other. For those of you who just want to copy it in and have it work, here's almost all the commands needed:
    Code:
    sudo wget -q -O - http://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
    sudo wget -q -O /etc/apt/sources.list.d/mopidy.list http://apt.mopidy.com/mopidy.list
    sudo apt-get update
    sudo apt-get install screen xvfb libglib2.0-0 libpng12-0 libxcursor1 libxinerama1 \
      libxrandr2 libfontconfig1 pulseaudio mopidy
    wget https://raw.githubusercontent.com/DaBs/tsmusicbot/master/Xvfb
    sudo mv Xvfb /etc/init.d
    sudo chmod 755 /etc/init.d/Xvfb
    sudo useradd -r debian-xvfb
    sudo /etc/init.d/Xvfb start
    sudo wget -q https://raw.githubusercontent.com/DaBs/tsmusicbot/master/mopidy.conf -O ~./configure/mopidy/mopidy.conf
    sudo screen -d -m -S pulseaudio pulseaudio
    sudo screen -d -m -S mopidy mopidy
    sudo wget -q http://dl.4players.de/ts/releases/3.0.15/TeamSpeak3-Client-linux_amd64-3.0.15.run
    sudo chmod u+x ./TeamSpeak3-Client-linux_amd64-3.0.15.run
    ./TeamSpeak3-Client-linux_amd64-3.0.15.run
    From here, you will be asked a lot of things regarding the installation. Once this is finished, you should be ready to execute the rest of the commands:
    Code:
    sudo screen -S ts3_musicbot
    And then, when inside this screen, run the following command. Depending on where you installed the TeamSpeak3 client, this may vary, but my command looks as follows:
    Code:
    DISPLAY=:99 /home/TeamSpeak3-Client-linux_amd64/ts3client_runscript.sh ts3server://yourserver.name.com?port=9987&nickname=MusicBot




    Install Pulseaudio
    First off, we need to install some pretty simple basics, also described in the above section. The most vital is pulseaudio, which is the virtual audio buffer that you are going to be using to channel whatever music is being played on your VPS out through the TeamSpeak3 client that we will call MusicBot later. So, to install that, do the following:
    Code:
    sudo apt-get install pulseaudio
    After you've installed this, run the commands
    Code:
    screen -d -m -S pulseaudio pulseaudio
    screen -ls
    This should turn out a list of active screens, where pulseaudio should be one of them.

    All good, now we have something that can play our music. Now we need something so we can control it. This means that we need to install mopidy. Mopidy is merely a music player, but since it has a lot of options for where to get the music from (e.g. Spotify, YouTube and others via plugins), this is what we will be using in this tutorial. This is fairly straightforward and on their side they have a tutorial for it, but I'll paraphrase it here just for the sake of consistency:

    Install Mopidy

    1. Add the archive's GPG key: This is done by running the command
      Code:
      wget -q -O - http://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
    2. Add sources to your sourcelist: Here you can run the command
      Code:
      sudo wget -q -O /etc/apt/sources.list.d/mopidy.list http://apt.mopidy.com/mopidy.list
    3. Install Mopidy and dependencies: Now we need to install it. Also pretty simple and done with two commands:
      Code:
      sudo apt-get update
      sudo apt-get install mopidy
    4. Install extra plugins: Now let's say you want spotify support or something along those lines. To list all the different extensions you can run
      Code:
      apt-cache search mopidy
      and thereafter install it with the usual
      Code:
      sudo apt-get install mopidy-<whatever the extension name>
    5. Configure Mopidy: This one is a little harder. If you want any help apart from the basics needed in this tutorial, please go to their site. What we want in the first place is merely to setup the basics, so type
      Code:
      sudo vim ~/.config/mopidy/mopidy.conf
      . In there, you want to find the place where it says
      [http]
      enabled = false
      hostname = 0.0.0.0
      port = 6680
      static_dir = /usr/www/mopidy
      zeroconf = Mopidy HTTP server on $hostname
      and change the enabled = false to enabled = true.


    Once these steps are done, you can run Mopidy with a web interface, which means you can control it from your browser. To run mopidy, you simply type
    Code:
    screen -d -m -S mopidy mopidy
    and then a
    Code:
    screen -ls
    to check if it started properly and if it did, well, hurray, everything works and you can now connect to your mopidy web interface on yourIPorDomain.com:6680! For those of you with issue in the port forwarding section, please attempt the command
    Code:
    sudo iptables -A INPUT -i eth0 --proto tcp --dport 6680 -j ACCEPT
    Install Xvfb

    Now most of you go like "Well, this is all good, but what now? I can play music, but nobody can hear two fucks, so what's the point?" Now, we need to get our TeamSpeak3 client running. This is also fairly simple, but requires a virtual display buffer too, as I presume your VPS does not have a screen attached. So go ahead and run the following pile of commands:
    Code:
    sudo apt-get install screen xvfb libglib2.0-0 libpng12-0 libxcursor1 libxinerama1 \
      libxrandr2 libfontconfig1
    wget https://raw.githubusercontent.com/DaBs/tsmusicbot/master/Xvfb
    sudo mv Xvfb /etc/init.d
    sudo chmod 755 /etc/init.d/Xvfb
    sudo useradd -r debian-xvfb
    sudo /etc/init.d/Xvfb start
    That is an awful lot of commands and one of the includes downloading something, but I'll walk you through them. The first line simply installs the depencies we need, the second downloads the daemon for the virtual framebuffer, the third moves the daemon to the proper location, the fourth makes sure that it's executable, the fifth adds a new user solely responsible for xvfb and the sixth simply starts the virtual framebuffer (xvfb) with the file from earlier, which automatically specifies that it needs to start it as debian-xvfb. So all in all, all good!

    Install TeamSpeak3 client
    Now, we can get to actually making the teamspeak3 client work. First, we need to download the damn client, so go ahead and run
    Code:
    cd /home/
    sudo wget -q http://dl.4players.de/ts/releases/3.0.15/TeamSpeak3-Client-linux_amd64-3.0.15.run
    , or if there's a newer version, find the url yourself on the download site. Then, run
    Code:
    sudo chmod u+x ./TeamSpeak3-Client-linux_amd64-3.0.15.run
    ./TeamSpeak3-Client-linux_amd64-3.0.15.run
    to install the client. This will ask you about the license primarily I believe. Once it's done, we need to start up the TeamSpeak3 client. Assuming that it installed into /home/, you can run the following command:
    Code:
    sudo screen -S ts3_musicbot
    which starts up a separate screen for the client and then, when you are inside the screen, run the command:
    Code:
    DISPLAY=:99 /home/TeamSpeak3-Client-linux_amd64/ts3client_runscript.sh ts3server://yourserver.name.com?port=9987&nickname=MusicBot
    This should result in a new fella on your server joining with (hopefully, this has yet to work for me properly) the name MusicBot and with a little blue icon in front of him. Things should be okay from here. Next up, you simply detach from the screen by pressing CTRL + A and then CTRL + D and now you are back to normal.

    To add music, go check out Mopidy's small guide on where to find the local directory or simply use the Soundcloud, Spotify or one of the other extensions available by typing "sudo apt-get install mopidy-<whatever_you_wanna_install>" minus the <> brackets.
    Last edited by hillmoor; July 15th, 2014 at 01:01 AM.

  2. #2
    Join Date
    May 2014
    Posts
    0
    Thanks for the guide. I've been looking for one. Looking forward for the rest of it!

  3. #3
    Join Date
    July 2014
    Posts
    8
    No problem - I had a couple of issue with it myself and so thought that I might as well write a tutorial on it. However, some of the things may only work because I've fiddled with it before, so keep coming back to me with feedback.

  4. #4
    Join Date
    February 2014
    Posts
    7
    Really helpful, man. Thanks for the guide.

  5. #5
    Join Date
    July 2014
    Posts
    1
    Code:
    sudo screen -S ts3_musicbot
    which starts up a separate screen for the client and then, when you are inside the screen, run the command:
    Code:
    DISPLAY=:99 /home/TeamSpeak3-Client-linux_amd64/ts3client_runscript.sh ts3server://yourserver.name.com?port=9987&nickname=MusicBot
    This should result in a new fella on your server joining with (hopefully, this has yet to work for me properly) the name MusicBot and with a little blue icon in front of him. Things should be okay from here. Next up, you simply detach from the screen by pressing CTRL + A and then CTRL + D and now you are back to normal

    i'm stuck on this part... MusicBot doesn't join my Ts3 server lol..

  6. #6
    Join Date
    July 2014
    Posts
    8
    Right, this may be due to it not having installed in the proper location. Can you check if everything is in place by going to /home/ and checking if the folder is there, then go into it and checking that the file is there?

    EDIT: So apparently, you shouldn't install things to /home/. Install it somewhere else then, maybe /usr/local instead.
    Last edited by hillmoor; July 15th, 2014 at 08:23 PM.

  7. #7
    Join Date
    September 2013
    Posts
    13
    You didn't write the Xvfb script and most of those instructions, I did https://github.com/mrshankly/tsmusicbot.

    Also, you shouldn't install stuff in /home, neither running the teamspeak client as root.

  8. #8
    Join Date
    July 2014
    Posts
    8
    Quote Originally Posted by mrshankly View Post
    You didn't write the Xvfb script and most of those instructions, I did https://github.com/mrshankly/tsmusicbot.

    Also, you shouldn't install stuff in /home, neither running the teamspeak client as root.
    I never claimed I did, I merely branched it so I would be sure that even if you took yours down, it would still be available. And I probably shouldn't, but I'm not exactly and expert, I merely figured out how to make it work on my server and wanted to help others, since your "tutorial" or whatever you call your readme file can't really be seen as remotely complete. Please engage in constructive criticism next time instead of relentlessly attacking. If anybody cares, they can easily see that my fork was forked from yours. But I don't believe people do, they care for a complete tutorial instead, although with minor errors as you pointed out. Thanks for that though

  9. #9
    Join Date
    November 2012
    Posts
    8
    Epic guide, Thanks!

  10. #10
    Join Date
    December 2010
    Location
    Germany
    Posts
    6
    Wow, such a great Tutorial! Any ideas how to add some commands to the bot? Like !next !prev etc.?

  11. #11
    Join Date
    October 2014
    Posts
    1
    Im stuck at step 5:
    I configured the config just like you described but i cant connect to the web interface of mopidy
    Last edited by trabbie; October 2nd, 2014 at 04:28 AM.

  12. #12
    Join Date
    January 2010
    Location
    Germany
    Posts
    12
    Quote Originally Posted by ogkinetic1 View Post
    Code:
    sudo screen -S ts3_musicbot
    which starts up a separate screen for the client and then, when you are inside the screen, run the command:
    Code:
    DISPLAY=:99 /home/TeamSpeak3-Client-linux_amd64/ts3client_runscript.sh ts3server://yourserver.name.com?port=9987&nickname=MusicBot


    i'm stuck on this part... MusicBot doesn't join my Ts3 server lol..
    At the fist time you start Teamspeak, TS will guide you through setting up your microphone and speaker and won't connect to a server.
    I installed everything on a VirtualBox with KUbuntu and then copied the settings to my Server, so that Teamspeak connects, uses continous transmission and Pulseaudio.

    For me Mopidy can play music, Teamspeak connects to the server, but the sound is not transferred by Pulseaudio from Mopidy to TS.

  13. #13
    Join Date
    July 2014
    Posts
    8
    Quote Originally Posted by Worfox View Post
    At the fist time you start Teamspeak, TS will guide you through setting up your microphone and speaker and won't connect to a server.
    I installed everything on a VirtualBox with KUbuntu and then copied the settings to my Server, so that Teamspeak connects, uses continous transmission and Pulseaudio.

    For me Mopidy can play music, Teamspeak connects to the server, but the sound is not transferred by Pulseaudio from Mopidy to TS.
    This might be due to audio not rerouting. Try installing pavucontrol, and then accessing it with any virtual desktop that you can setup and control remotely and then turn the audio to go out through the microphone. This may help. Post updates in any case though

  14. #14
    Join Date
    January 2010
    Location
    Germany
    Posts
    12
    Quote Originally Posted by hillmoor View Post
    This might be due to audio not rerouting. Try installing pavucontrol, and then accessing it with any virtual desktop that you can setup and control remotely and then turn the audio to go out through the microphone. This may help. Post updates in any case though
    Hi, I'm not going to install a virtual desktop because I figured out it was a permission problem from Pulseaudio. All I had to do was to add my user and Mopidy to the groups "pulse-access" and "audio".

    Code:
    gpasswd -a pulse audio
    gpasswd -a MyUser audio
    gpasswd -a mopidy audio
    gpasswd -a mopidy pulse-access
    gpasswd -a MyUser pulse-access
    service mopidy restart
    That did the trick, everything is working now.

    PS: Check out Rompr

  15. #15
    Join Date
    February 2010
    Location
    Hollandia
    Posts
    57
    will try this one. thnxs!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to play music through Teamspeak server using Opus Music
    By BusinessPony in forum General Questions
    Replies: 2
    Last Post: March 5th, 2013, 02:18 PM
  2. setup guide / walkthrough for a noob
    By marksie1988 in forum Permission System
    Replies: 2
    Last Post: January 1st, 2012, 12:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •