Compare commits
No commits in common. "master" and "v3.1.1" have entirely different histories.
|
@ -1 +0,0 @@
|
|||
Dockerfile
|
13
.drone.yml
13
.drone.yml
|
@ -1,13 +0,0 @@
|
|||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: r.sbruder.de
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: r.sbruder.de/mumbledj
|
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -1,23 +1,6 @@
|
|||
MumbleDJ Changelog
|
||||
==================
|
||||
|
||||
### November 5, 2016 -- `v3.2.1`
|
||||
* Fixed YouTube video offsets. Now YouTube URLs with `?t=<timestamp>` at the end will start the audio playback at the appropriate position.
|
||||
|
||||
### November 5, 2016 -- `v3.2.0`
|
||||
* Fixed a Go panic that would occur when a YouTube playlist contained a private video.
|
||||
* Added back immediate skipping for tracks/playlists that are skipped by the submitter. This was a feature that was present in the last major version of MumbleDJ but was forgotten when rewriting the bot (sorry!).
|
||||
|
||||
### August 22, 2016 -- `v3.1.4`
|
||||
* Fixed a SoundCloud API response parsing issue that would result in empty IDs for tracks.
|
||||
* Fixed the startup check for SoundCloud API.
|
||||
|
||||
### August 21, 2016 -- `v3.1.3`
|
||||
* Fixed a deadlock that would occur during the transition from the first to second track in a queue.
|
||||
|
||||
### August 14, 2016 -- `v3.1.2`
|
||||
* Fixed an index out of range crash in the queue skipping function.
|
||||
|
||||
### July 11, 2016 -- `v3.1.1`
|
||||
* Updated vendored dependencies to hopefully address the following issue: https://github.com/matthieugrieger/mumbledj/issues/169.
|
||||
|
||||
|
|
44
Dockerfile
44
Dockerfile
|
@ -1,39 +1,19 @@
|
|||
FROM golang:alpine as builder
|
||||
FROM alpine:3.3
|
||||
|
||||
RUN apk add --no-cache \
|
||||
build-base \
|
||||
opus-dev
|
||||
ENV GOPATH=/
|
||||
|
||||
COPY . /go/src/github.com/matthieugrieger/mumbledj
|
||||
WORKDIR /go/src/github.com/matthieugrieger/mumbledj
|
||||
RUN apk add --update ca-certificates go ffmpeg make build-base opus-dev python aria2
|
||||
RUN apk upgrade
|
||||
|
||||
RUN go get -v \
|
||||
&& go build -v -ldflags="-s -w"
|
||||
RUN wget https://yt-dl.org/downloads/latest/youtube-dl -O /bin/youtube-dl && chmod a+x /bin/youtube-dl
|
||||
|
||||
FROM alpine
|
||||
COPY . /src/github.com/matthieugrieger/mumbledj
|
||||
COPY config.yaml /root/.config/mumbledj/config.yaml
|
||||
|
||||
RUN adduser -D mumbledj
|
||||
WORKDIR /src/github.com/matthieugrieger/mumbledj
|
||||
|
||||
RUN apk add --no-cache \
|
||||
aria2 \
|
||||
libressl \
|
||||
python2
|
||||
RUN make
|
||||
RUN make install
|
||||
RUN apk del go make build-base && rm -rf /var/cache/apk/*
|
||||
|
||||
RUN wget -O /usr/bin/youtube-dl https://yt-dl.org/downloads/latest/youtube-dl \
|
||||
&& chmod +x /usr/bin/youtube-dl
|
||||
|
||||
RUN wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz \
|
||||
&& tar xvf ffmpeg-git-amd64-static.tar.xz '*/ffmpeg' || true \
|
||||
&& mv ffmpeg-git-*-amd64-static/ffmpeg /usr/bin/ffmpeg \
|
||||
&& rm -rf ffmpeg-git-* \
|
||||
&& apk add --no-cache upx \
|
||||
&& upx /usr/bin/ffmpeg \
|
||||
&& apk del upx
|
||||
|
||||
COPY --from=builder /go/src/github.com/matthieugrieger/mumbledj/mumbledj /usr/bin/mumbledj
|
||||
|
||||
COPY config.yaml /home/mumbledj/.config/mumbledj/config.yaml
|
||||
|
||||
USER mumbledj
|
||||
|
||||
ENTRYPOINT ["/usr/bin/mumbledj"]
|
||||
ENTRYPOINT ["/usr/local/bin/mumbledj"]
|
||||
|
|
10
README.md
10
README.md
|
@ -3,8 +3,6 @@
|
|||
<p align="center"><b>A Mumble bot that plays audio fetched from various media websites.</b></p>
|
||||
<p align="center"><a href="https://travis-ci.org/matthieugrieger/mumbledj"><img src="https://travis-ci.org/matthieugrieger/mumbledj.svg?branch=master"/></a> <a href="https://raw.githubusercontent.com/matthieugrieger/mumbledj/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg"/></a> <a href="https://github.com/matthieugrieger/mumbledj/releases"><img src="https://img.shields.io/github/release/matthieugrieger/mumbledj.svg"/></a> <a href="https://goreportcard.com/report/github.com/matthieugrieger/mumbledj"><img src="https://goreportcard.com/badge/github.com/matthieugrieger/mumbledj"/></a> <a href="https://codecov.io/gh/matthieugrieger/mumbledj"><img src="https://img.shields.io/codecov/c/github/matthieugrieger/mumbledj.svg"/></a> <a href="https://gitter.im/matthieugrieger/mumbledj"><img src="https://img.shields.io/gitter/room/matthieugrieger/mumbledj.svg" /></a></p>
|
||||
|
||||
<p align="center"><b>Unfortunately, this project is no longer maintained. Don't expect any responses on bug reports, feature requests, etc. Forks are welcome!</b></p>
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Features](#features)
|
||||
|
@ -108,14 +106,14 @@ sudo make install
|
|||
|
||||
### Docker
|
||||
|
||||
You can also use [Docker](https://www.docker.com) to run MumbleDJ.
|
||||
You can also use [docker](https://www.docker.com) to run mumbledj.
|
||||
|
||||
First you need to clone the MumbleDJ repository to your machine:
|
||||
```
|
||||
git clone https://github.com/matthieugrieger/mumbledj.git
|
||||
```
|
||||
|
||||
Assuming you have [Docker installed](https://www.docker.com/products/docker), you will have to build the image:
|
||||
Assuming you have [docker installed](https://www.docker.com/products/docker), you will have to build the image:
|
||||
```
|
||||
docker build -t mumbledj .
|
||||
```
|
||||
|
@ -125,12 +123,12 @@ And then you can run it, passing the configuration through the command line:
|
|||
docker run --rm --name=mumbledj mumbledj --server=SERVER --api_keys.youtube=YOUR_YOUTUBE_API_KEY --api_keys.soundcloud=YOUR_SOUNDCLOUD_API_KEY
|
||||
```
|
||||
|
||||
In order to run the process as a daemon and restart it automatically on reboot you can use:
|
||||
In order to run the process as a deamon and restart it automatically on reboot you can use:
|
||||
```
|
||||
docker run -d --restart=unless-stopped --name=mumbledj mumbledj --server=SERVER --api_keys.youtube=YOUR_YOUTUBE_API_KEY --api_keys.soundcloud=YOUR_SOUNDCLOUD_API_KEY
|
||||
```
|
||||
|
||||
You can also install Docker on a [Raspberry Pi](https://www.raspberrypi.org/) for instance with [hypriot](http://blog.hypriot.com/getting-started-with-docker-on-your-arm-device/) or with [archlinux](https://archlinuxarm.org/packages/arm/docker). You just need to build the ARM image:
|
||||
You can also install docker on a [raspberry pi](https://www.raspberrypi.org/) for instance with [hypriot](http://blog.hypriot.com/getting-started-with-docker-on-your-arm-device/) or with [archlinux](https://archlinuxarm.org/packages/arm/docker). You just need to build the arm image:
|
||||
```
|
||||
docker build -f raspberry.Dockerfile -t mumbledj .
|
||||
```
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -196,7 +196,6 @@ func SetDefaultConfig() {
|
|||
viper.SetDefault("commands.skip.description", "Places a vote to skip the current track.")
|
||||
viper.SetDefault("commands.skip.messages.already_voted_error", "You have already voted to skip this track.")
|
||||
viper.SetDefault("commands.skip.messages.voted", "<b>%s</b> has voted to skip the current track.")
|
||||
viper.SetDefault("commands.skip.messages.submitter_voted", "<b>%s</b>, the submitter of this track, has voted to skip. Skipping immediately.")
|
||||
|
||||
viper.SetDefault("commands.skipplaylist.aliases", []string{"skipplaylist", "sp"})
|
||||
viper.SetDefault("commands.skipplaylist.is_admin", false)
|
||||
|
@ -204,7 +203,6 @@ func SetDefaultConfig() {
|
|||
viper.SetDefault("commands.skipplaylist.messages.no_playlist_error", "The current track is not part of a playlist.")
|
||||
viper.SetDefault("commands.skipplaylist.messages.already_voted_error", "You have already voted to skip this playlist.")
|
||||
viper.SetDefault("commands.skipplaylist.messages.voted", "<b>%s</b> has voted to skip the current playlist.")
|
||||
viper.SetDefault("commands.skipplaylist.messages.submitter_voted", "<b>%s</b>, the submitter of this playlist, has voted to skip. Skipping immediately.")
|
||||
|
||||
viper.SetDefault("commands.toggleshuffle.aliases", []string{"toggleshuffle", "toggleshuf", "togshuf", "tsh"})
|
||||
viper.SetDefault("commands.toggleshuffle.is_admin", true)
|
||||
|
|
|
@ -199,7 +199,7 @@ func (q *Queue) Skip() {
|
|||
|
||||
q.mutex.Lock()
|
||||
// If caching is disabled, delete the track from disk.
|
||||
if len(q.Queue) != 0 && !viper.GetBool("cache.enabled") {
|
||||
if !viper.GetBool("cache.enabled") {
|
||||
DJ.YouTubeDL.Delete(q.Queue[0])
|
||||
}
|
||||
|
||||
|
|
|
@ -47,11 +47,6 @@ func (c *SkipCommand) Execute(user *gumble.User, args ...string) (string, bool,
|
|||
if DJ.Queue.Length() == 0 {
|
||||
return "", true, errors.New(viper.GetString("commands.common_messages.no_tracks_error"))
|
||||
}
|
||||
if DJ.Queue.GetTrack(0).GetSubmitter() == user.Name {
|
||||
// The user who submitted the track is skipping, this means we skip this track immediately.
|
||||
DJ.Queue.StopCurrent()
|
||||
return fmt.Sprintf(viper.GetString("commands.skip.messages.submitter_voted"), user.Name), false, nil
|
||||
}
|
||||
if err := DJ.Skips.AddTrackSkip(user); err != nil {
|
||||
return "", true, errors.New(viper.GetString("commands.skip.messages.already_voted_error"))
|
||||
}
|
||||
|
|
|
@ -58,10 +58,6 @@ func (c *SkipPlaylistCommand) Execute(user *gumble.User, args ...string) (string
|
|||
if playlist := currentTrack.GetPlaylist(); playlist == nil {
|
||||
return "", true, errors.New(viper.GetString("commands.skipplaylist.messages.no_playlist_error"))
|
||||
}
|
||||
if currentTrack.GetPlaylist().GetSubmitter() == user.Name {
|
||||
DJ.Queue.SkipPlaylist()
|
||||
return fmt.Sprintf(viper.GetString("commands.skipplaylist.messages.submitter_voted"), user.Name), false, nil
|
||||
}
|
||||
if err := DJ.Skips.AddPlaylistSkip(user); err != nil {
|
||||
return "", true, errors.New(viper.GetString("commands.skipplaylist.messages.already_voted_error"))
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ commands:
|
|||
messages:
|
||||
no_channel_provided_error: "A destination channel must be supplied to move the bot."
|
||||
channel_doesnt_exist_error: "The provided channel does not exist."
|
||||
move_successful: "You have successfully moved the bot to <b>%s</b>."
|
||||
move_successful: "You have successfully moved the bot to <b>%s</b>."
|
||||
|
||||
nexttrack:
|
||||
aliases:
|
||||
|
@ -374,7 +374,6 @@ commands:
|
|||
messages:
|
||||
already_voted_error: "You have already voted to skip this track."
|
||||
voted: "<b>%s</b> has voted to skip the current track."
|
||||
submitter_voted: "<b>%s</b>, the submitter of this track, has voted to skip. Skipping immediately."
|
||||
|
||||
skipplaylist:
|
||||
aliases:
|
||||
|
@ -386,7 +385,6 @@ commands:
|
|||
no_playlist_error: "The current track is not part of a playlist."
|
||||
already_voted_error: "You have already voted to skip this playlist."
|
||||
voted: "<b>%s</b> has voted to skip the current playlist."
|
||||
submitter_voted: "<b>%s</b>, the submitter of this playlist, has voted to skip. Skipping immediately."
|
||||
|
||||
toggleshuffle:
|
||||
aliases:
|
||||
|
@ -420,4 +418,4 @@ commands:
|
|||
parsing_error: "The requested volume could not be parsed."
|
||||
out_of_range_error: "Volumes must be between the values <b>%.2f</b> and <b>%.2f</b>."
|
||||
current_volume: "The current volume is <b>%.2f</b>."
|
||||
volume_changed: "<b>%s</b> has changed the volume to <b>%.2f</b>."
|
||||
volume_changed: "<b>%s</b> has changed the volume to <b>%.2f</b>."
|
2
main.go
2
main.go
|
@ -32,7 +32,7 @@ func init() {
|
|||
services.DJ = DJ
|
||||
bot.DJ = DJ
|
||||
|
||||
DJ.Version = "v3.2.1"
|
||||
DJ.Version = "v3.1.1"
|
||||
|
||||
logrus.SetLevel(logrus.WarnLevel)
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ func (sc *SoundCloud) CheckAPIKey() error {
|
|||
if viper.GetString("api_keys.soundcloud") == "" {
|
||||
return errors.New("No SoundCloud API key has been provided")
|
||||
}
|
||||
url := "http://api.soundcloud.com/tracks/13158665?client_id=%s"
|
||||
url := "http://api.soundcloud.com/tracks/vjflzpbkmerb?client_id=%s"
|
||||
response, err := http.Get(fmt.Sprintf(url, viper.GetString("api_keys.soundcloud")))
|
||||
defer response.Body.Close()
|
||||
if err != nil {
|
||||
|
@ -162,8 +162,7 @@ func (sc *SoundCloud) GetTracks(url string, submitter *gumble.User) ([]interface
|
|||
|
||||
func (sc *SoundCloud) getTrack(obj *jason.Object, offset time.Duration, submitter *gumble.User) (bot.Track, error) {
|
||||
title, _ := obj.GetString("title")
|
||||
idInt, _ := obj.GetInt64("id")
|
||||
id := strconv.FormatInt(idInt, 10)
|
||||
id, _ := obj.GetString("id")
|
||||
url, _ := obj.GetString("permalink_url")
|
||||
author, _ := obj.GetString("user", "username")
|
||||
authorURL, _ := obj.GetString("user", "permalink_url")
|
||||
|
|
|
@ -13,8 +13,6 @@ import (
|
|||
"math"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ChannelMeter/iso8601duration"
|
||||
"github.com/antonholmquist/jason"
|
||||
|
@ -100,12 +98,9 @@ func (yt *YouTube) GetTracks(url string, submitter *gumble.User) ([]interfaces.T
|
|||
tracks []interfaces.Track
|
||||
)
|
||||
|
||||
dummyOffset, _ := time.ParseDuration("0s")
|
||||
urlSplit := strings.Split(url, "?t=")
|
||||
|
||||
playlistURL = "https://www.googleapis.com/youtube/v3/playlists?part=snippet&id=%s&key=%s"
|
||||
playlistItemsURL = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,contentDetails&playlistId=%s&maxResults=%d&key=%s&pageToken=%s"
|
||||
id, err = yt.getID(urlSplit[0])
|
||||
id, err = yt.getID(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -166,7 +161,7 @@ func (yt *YouTube) GetTracks(url string, submitter *gumble.User) ([]interfaces.T
|
|||
|
||||
// Unfortunately we have to execute another API call for each video as the YouTube API does not
|
||||
// return video durations from the playlistItems endpoint...
|
||||
newTrack, _ := yt.getTrack(videoID, submitter, dummyOffset)
|
||||
newTrack, _ := yt.getTrack(videoID, submitter)
|
||||
newTrack.Playlist = playlist
|
||||
tracks = append(tracks, newTrack)
|
||||
|
||||
|
@ -187,13 +182,7 @@ func (yt *YouTube) GetTracks(url string, submitter *gumble.User) ([]interfaces.T
|
|||
return tracks, nil
|
||||
}
|
||||
|
||||
// Submitter added a track!
|
||||
offset := dummyOffset
|
||||
if len(urlSplit) == 2 {
|
||||
offset, _ = time.ParseDuration(urlSplit[1])
|
||||
}
|
||||
|
||||
track, err = yt.getTrack(id, submitter, offset)
|
||||
track, err = yt.getTrack(id, submitter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -201,7 +190,7 @@ func (yt *YouTube) GetTracks(url string, submitter *gumble.User) ([]interfaces.T
|
|||
return tracks, nil
|
||||
}
|
||||
|
||||
func (yt *YouTube) getTrack(id string, submitter *gumble.User, offset time.Duration) (bot.Track, error) {
|
||||
func (yt *YouTube) getTrack(id string, submitter *gumble.User) (bot.Track, error) {
|
||||
var (
|
||||
resp *http.Response
|
||||
err error
|
||||
|
@ -220,9 +209,6 @@ func (yt *YouTube) getTrack(id string, submitter *gumble.User, offset time.Durat
|
|||
return bot.Track{}, err
|
||||
}
|
||||
items, _ := v.GetObjectArray("items")
|
||||
if len(items) == 0 {
|
||||
return bot.Track{}, errors.New("This YouTube video is private")
|
||||
}
|
||||
item := items[0]
|
||||
title, _ := item.GetString("snippet", "title")
|
||||
thumbnail, _ := item.GetString("snippet", "thumbnails", "high", "url")
|
||||
|
@ -232,16 +218,15 @@ func (yt *YouTube) getTrack(id string, submitter *gumble.User, offset time.Durat
|
|||
duration := durationConverted.ToDuration()
|
||||
|
||||
return bot.Track{
|
||||
ID: id,
|
||||
URL: "https://youtube.com/watch?v=" + id,
|
||||
Title: title,
|
||||
Author: author,
|
||||
Submitter: submitter.Name,
|
||||
Service: yt.ReadableName,
|
||||
Filename: id + ".track",
|
||||
ThumbnailURL: thumbnail,
|
||||
Duration: duration,
|
||||
PlaybackOffset: offset,
|
||||
Playlist: nil,
|
||||
ID: id,
|
||||
URL: "https://youtube.com/watch?v=" + id,
|
||||
Title: title,
|
||||
Author: author,
|
||||
Submitter: submitter.Name,
|
||||
Service: yt.ReadableName,
|
||||
Filename: id + ".track",
|
||||
ThumbnailURL: thumbnail,
|
||||
Duration: duration,
|
||||
Playlist: nil,
|
||||
}, nil
|
||||
}
|
||||
|
|
Reference in a new issue