Removed all test code
This commit is contained in:
parent
12374d9c17
commit
79472a1791
2
Makefile
2
Makefile
|
@ -1,7 +1,7 @@
|
||||||
all: mumbledj
|
all: mumbledj
|
||||||
|
|
||||||
mumbledj: main.go commands.go parseconfig.go strings.go service.go youtube_dl.go service_youtube.go service_soundcloud.go songqueue.go cache.go
|
mumbledj: main.go commands.go parseconfig.go strings.go service.go youtube_dl.go service_youtube.go service_soundcloud.go songqueue.go cache.go
|
||||||
if [ ! -f $(GOPATH)/bin/goop ]; then go get github.com/nitrous-io/goop; fi;
|
go get github.com/nitrous-io/goop; fi;
|
||||||
rm -rf Goopfile.lock
|
rm -rf Goopfile.lock
|
||||||
goop install
|
goop install
|
||||||
goop go build
|
goop go build
|
||||||
|
|
|
@ -44,7 +44,7 @@ These are all of the chat commands currently supported by MumbleDJ. All command
|
||||||
|
|
||||||
Command | Description | Arguments | Admin | Example
|
Command | Description | Arguments | Admin | Example
|
||||||
--------|-------------|-----------|-------|--------
|
--------|-------------|-----------|-------|--------
|
||||||
**add** | Adds a YouTube video's audio to the song queue. If no songs are currently in the queue, the audio will begin playing immediately. YouTube playlists may also be added using this command. Please note, however, that if a YouTube playlist contains over 25 videos only the first 25 videos will be placed in the song queue. | youtube_video_url OR youtube_playlist_url OR soundcloud_track_url OR soundcloud_playlist_url | No | `!add https://www.youtube.com/watch?v=5xfEr2Oxdys`
|
**add** | Adds audio from a url to the song queue. If no songs are currently in the queue, the audio will begin playing immediately. Playlists may also be added using this command. Please note, however, that if a YouTube playlist contains over 25 videos only the first 25 videos will be placed in the song queue. | youtube_video_url OR youtube_playlist_url OR soundcloud_track_url OR soundcloud_playlist_url | No | `!add https://www.youtube.com/watch?v=5xfEr2Oxdys`
|
||||||
**skip**| Submits a vote to skip the current song. Once the skip ratio target (specified in `mumbledj.gcfg`) is met, the song will be skipped and the next will start playing. Each user may only submit one skip per song. | None | No | `!skip`
|
**skip**| Submits a vote to skip the current song. Once the skip ratio target (specified in `mumbledj.gcfg`) is met, the song will be skipped and the next will start playing. Each user may only submit one skip per song. | None | No | `!skip`
|
||||||
**skipplaylist** | Submits a vote to skip the current playlist. Once the skip ratio target (specified in mumbledj.gcfg) is met, the playlist will be skipped and the next song/playlist will start playing. Each user may only submit one skip per playlist. | None | No | `!skipplaylist`
|
**skipplaylist** | Submits a vote to skip the current playlist. Once the skip ratio target (specified in mumbledj.gcfg) is met, the playlist will be skipped and the next song/playlist will start playing. Each user may only submit one skip per playlist. | None | No | `!skipplaylist`
|
||||||
**forceskip** | An admin command that forces a song skip. | None | Yes | `!forceskip`
|
**forceskip** | An admin command that forces a song skip. | None | Yes | `!forceskip`
|
||||||
|
@ -83,7 +83,7 @@ Effective April 20th, 2015, all requests to YouTube's API must use v3 of their A
|
||||||
|
|
||||||
**7)** Open up `~/.bashrc` with your favorite text editor (or `~/.zshrc` if you use `zsh`). Add the following line to the bottom: `export YOUTUBE_API_KEY="<your_key_here>"`. Replace \<your_key_here\> with your API key.
|
**7)** Open up `~/.bashrc` with your favorite text editor (or `~/.zshrc` if you use `zsh`). Add the following line to the bottom: `export YOUTUBE_API_KEY="<your_key_here>"`. Replace \<your_key_here\> with your API key.
|
||||||
|
|
||||||
**8)** Close your current terminal window and open another one up. You should be able to use MumbleDJ now!
|
**8)** Close your current terminal window and open another one up. You should be able to use Youtube on MumbleDJ now!
|
||||||
|
|
||||||
###SOUNDCLOUD API KEYS
|
###SOUNDCLOUD API KEYS
|
||||||
A soundcloud API key is required for soundcloud integration. If no soundcloud api key is found, then the service will be disabled (youtube links will still work however).
|
A soundcloud API key is required for soundcloud integration. If no soundcloud api key is found, then the service will be disabled (youtube links will still work however).
|
||||||
|
|
27
circle.yml
27
circle.yml
|
@ -1,27 +0,0 @@
|
||||||
machine:
|
|
||||||
environment:
|
|
||||||
PATH: $HOME/bin/:$PATH
|
|
||||||
LD_RUN_PATH: $LD_RUN_PATH:$HOME/opus/lib
|
|
||||||
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$HOME/opus/lib
|
|
||||||
PKG_CONFIG_PATH: $PKG_CONFIG_PATH:$HOME/opus/lib/pkgconfig
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
pre:
|
|
||||||
- bash install-dependencies.sh
|
|
||||||
|
|
||||||
override:
|
|
||||||
- make
|
|
||||||
- make install
|
|
||||||
|
|
||||||
cache_directories:
|
|
||||||
- "~/opus"
|
|
||||||
- "~/bin"
|
|
||||||
- "~/mumbledj/.vendor"
|
|
||||||
- "/home/ubuntu/.go_workspace/bin"
|
|
||||||
- "/home/ubuntu/.go_workspace/pkg"
|
|
||||||
- "/home/ubuntu/.go_workspace/src/github.com/nitrous-io"
|
|
||||||
|
|
||||||
test:
|
|
||||||
override:
|
|
||||||
- mumbledj -server=$MUMBLE_IP -port=$MUMBLE_PORT -username=circleci -password=$MUMBLE_PASSWORD -test=true:
|
|
||||||
timeout: 180
|
|
|
@ -1,37 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# removing old ffmpeg
|
|
||||||
sudo rm -rf /usr/bin/ffmpeg
|
|
||||||
sudo rm -rf /usr/bin/X11/ffmpeg
|
|
||||||
sudo rm -rf /usr/share/man/man1/ffmpeg.1.gz
|
|
||||||
|
|
||||||
# check to see if ffmpeg is installed
|
|
||||||
if [ ! -f "$HOME/bin/ffmpeg" ]; then
|
|
||||||
echo 'Installing ffmpeg'
|
|
||||||
wget http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz -O /tmp/ffmpeg.tar.xz
|
|
||||||
tar -xvf /tmp/ffmpeg.tar.xz --strip 1 --no-anchored ffmpeg ffprobe
|
|
||||||
chmod a+rx ffmpeg ffprobe
|
|
||||||
mv ff* ~/bin
|
|
||||||
else
|
|
||||||
echo 'Using cached version of ffmpeg.';
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check to see if youtube-dl is installed
|
|
||||||
if [ ! -f "$HOME/bin/youtube-dl" ]; then
|
|
||||||
echo 'Installing youtube-dl'
|
|
||||||
curl https://yt-dl.org/latest/youtube-dl -o ~/bin/youtube-dl
|
|
||||||
chmod a+rx ~/bin/youtube-dl
|
|
||||||
else
|
|
||||||
echo 'Using cached version of youtube-dl.';
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check to see if opus is installed
|
|
||||||
if [ ! -d "$HOME/opus/lib" ]; then
|
|
||||||
echo 'Installing opus'
|
|
||||||
wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz
|
|
||||||
tar xzvf opus-1.0.3.tar.gz
|
|
||||||
cd opus-1.0.3 && ./configure --prefix=$HOME/opus && make && make install
|
|
||||||
else
|
|
||||||
echo 'Using cached version of opus.';
|
|
||||||
fi
|
|
8
main.go
8
main.go
|
@ -153,7 +153,7 @@ func CheckAPIKeys() {
|
||||||
|
|
||||||
// Checks to see if any service was disabled
|
// Checks to see if any service was disabled
|
||||||
if anyDisabled {
|
if anyDisabled {
|
||||||
fmt.Printf("Please see the following link for info on how to enable services: https://github.com/matthieugrieger/mumbledj\n")
|
fmt.Printf("Please see the following link for info on how to enable missing services: https://github.com/matthieugrieger/mumbledj\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exits application if no services are enabled
|
// Exits application if no services are enabled
|
||||||
|
@ -194,7 +194,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var address, port, username, password, channel, pemCert, pemKey, accesstokens string
|
var address, port, username, password, channel, pemCert, pemKey, accesstokens string
|
||||||
var insecure, testcode bool
|
var insecure bool
|
||||||
|
|
||||||
flag.StringVar(&address, "server", "localhost", "address for Mumble server")
|
flag.StringVar(&address, "server", "localhost", "address for Mumble server")
|
||||||
flag.StringVar(&port, "port", "64738", "port for Mumble server")
|
flag.StringVar(&port, "port", "64738", "port for Mumble server")
|
||||||
|
@ -205,7 +205,6 @@ func main() {
|
||||||
flag.StringVar(&pemKey, "key", "", "path to user PEM key for MumbleDJ")
|
flag.StringVar(&pemKey, "key", "", "path to user PEM key for MumbleDJ")
|
||||||
flag.StringVar(&accesstokens, "accesstokens", "", "list of access tokens for channel auth")
|
flag.StringVar(&accesstokens, "accesstokens", "", "list of access tokens for channel auth")
|
||||||
flag.BoolVar(&insecure, "insecure", false, "skip certificate checking")
|
flag.BoolVar(&insecure, "insecure", false, "skip certificate checking")
|
||||||
flag.BoolVar(&testcode, "test", false, "[debug] tests the features of mumbledj")
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
dj.config = gumble.Config{
|
dj.config = gumble.Config{
|
||||||
|
@ -246,8 +245,5 @@ func main() {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if testcode {
|
|
||||||
Test(password, address, port, strings.Split(accesstokens, " "))
|
|
||||||
}
|
|
||||||
<-dj.keepAlive
|
<-dj.keepAlive
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/*
|
||||||
|
* MumbleDJ
|
||||||
|
* By Matthieu Grieger
|
||||||
|
* service_soundcloud.go
|
||||||
|
* Copyright (c) 2014, 2015 Matthieu Grieger (MIT License)
|
||||||
|
*/
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
85
test.go
85
test.go
|
@ -1,85 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"github.com/layeh/gumble/gumble"
|
|
||||||
"os"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type TestSettings struct {
|
|
||||||
password string
|
|
||||||
ip string
|
|
||||||
port string
|
|
||||||
accesstokens []string
|
|
||||||
}
|
|
||||||
|
|
||||||
var test TestSettings
|
|
||||||
|
|
||||||
func Test(password, ip, port string, accesstokens []string) {
|
|
||||||
test = TestSettings{
|
|
||||||
password: password,
|
|
||||||
ip: ip,
|
|
||||||
port: port,
|
|
||||||
accesstokens: accesstokens,
|
|
||||||
}
|
|
||||||
test.testYoutubeSong()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t TestSettings) createClient(uname string) *gumble.Client {
|
|
||||||
config := gumble.Config{
|
|
||||||
Username: uname,
|
|
||||||
Password: t.password,
|
|
||||||
Address: t.ip + ":" + t.port,
|
|
||||||
Tokens: t.accesstokens,
|
|
||||||
}
|
|
||||||
config.TLSConfig.InsecureSkipVerify = true
|
|
||||||
client := gumble.NewClient(&config)
|
|
||||||
return client
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t TestSettings) testYoutubeSong() {
|
|
||||||
dummyClient := t.createClient("dummy")
|
|
||||||
if err := dummyClient.Connect(); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
dj.client.Request(gumble.RequestUserList)
|
|
||||||
time.Sleep(time.Second * 5)
|
|
||||||
dummyUser := dj.client.Users.Find("dummy")
|
|
||||||
if dummyUser == nil {
|
|
||||||
fmt.Printf("User does not exist, printing users\n")
|
|
||||||
for _, user := range dj.client.Users {
|
|
||||||
fmt.Printf(user.Name + "\n")
|
|
||||||
}
|
|
||||||
fmt.Printf("End of user list\n")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't judge, I used the (autogenerated) Top Tracks for United Kingdom playlist
|
|
||||||
songs := map[string]string{
|
|
||||||
"http://www.youtube.com/watch?v=QcIy9NiNbmo": "Taylor Swift - Bad Blood ft. Kendrick Lamar",
|
|
||||||
"https://www.youtube.com/watch?v=vjW8wmF5VWc": "Silentó - Watch Me (Whip/Nae Nae) (Official)",
|
|
||||||
"http://youtu.be/nsDwItoNlLc": "Tinie Tempah ft. Jess Glynne - Not Letting Go (Official Video)",
|
|
||||||
"https://youtu.be/hXTAn4ELEwM": "Years & Years - Shine",
|
|
||||||
"http://youtube.com/watch?v=RgKAFK5djSk": "Wiz Khalifa - See You Again ft. Charlie Puth [Official Video] Furious 7 Soundtrack",
|
|
||||||
"https://youtube.com/watch?v=qWWSM3wCiKY": "Calvin Harris & Disciples - How Deep Is Your Love (Audio)",
|
|
||||||
"http://www.youtube.com/v/yzTuBuRdAyA": "The Weeknd - The Hills",
|
|
||||||
"https://www.youtube.com/v/cNw8A5pwbVI": "Pia Mia - Do It Again ft. Chris Brown, Tyga",
|
|
||||||
}
|
|
||||||
|
|
||||||
for url, title := range songs {
|
|
||||||
err := add(dummyUser, url)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("For: %s; Expected: %s; Got: %s\n", url, title, err.Error())
|
|
||||||
} else if dj.queue.CurrentSong().Title() != title {
|
|
||||||
fmt.Printf("For: %s; Expected: %s; Got: %s\n", url, title, dj.queue.CurrentSong().Title())
|
|
||||||
}
|
|
||||||
|
|
||||||
time.Sleep(time.Second * 10)
|
|
||||||
skip(dummyUser, false, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
os.Exit(0)
|
|
||||||
dummyClient.Disconnect()
|
|
||||||
}
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
/*
|
||||||
|
* MumbleDJ
|
||||||
|
* By Matthieu Grieger
|
||||||
|
* youtube_dl.go
|
||||||
|
* Copyright (c) 2014, 2015 Matthieu Grieger (MIT License)
|
||||||
|
*/
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
Reference in a new issue