Git Product home page Git Product logo

mumbleradioplayer's Introduction

MumbleRadioPlayer

A DEPRECATED Mumble bot that plays radio stream by URL

I've merge multiple project into botamusique

I will not update MumbleRadioPlayer ANYMORE

======

  1. How to start the bot
  2. Commands
  3. Installation
  4. Important
  5. How to help
  6. Additionnal informations
  7. TODO
  8. Credits

How to start the bot

Run the mumbleRadioPlayer.py to start the bot (don't forget the chmod +x ./mumbleRadioPlayer.py) ./mumbleRadioPlayer.py --server <server_url> --user <bot_name>

Optional parameters : --channel <default_channel> --port <port_number> --password <password> --cert <certificate>

It's in Python 3 (The python2 version is into another branch. depreciated version !)

Commands

You can change commands into the configuration file, The default is :

  • !play
    • from a list of url (name you have add into the configuration file)
    • with a url
  • !playfile (play a file from the path into the config file)
  • !list (list all files into the path of !playfile)
  • !stop
  • !joinme (join the user who speak to me)
  • !kill
  • !oust (stop + go into the default channel)
  • !v (change volume with a percentage )
  • !np (get the current music title - now playing feature)

Installation

  1. You need python 3 with opuslib and protobuf (look at the requirement of pymumble) you will need pip3 (apt-get install python3-pip)
  2. The Bot use ffmpeg, so you know what you have to do if ffmpeg aren't in your package manager. I personally use this repository on my raspberry.

commands (don't forget the sudo mode):

apt-get install ffmpeg
git clone --recurse-submodules https://github.com/azlux/MumbleRadioPlayer.git
cd ./MumbleRadioPlayer
pip3 install -r requirements.txt
chmod +x ./mumbleRadioPlayer.py

If you really want to install pymumble independently, there are a install.sh. But think about upgrade. The Bot will work that way too.

Important

What the bot cannot do:

  1. A .pls file is NOT a stream url, it's just a text file. Take a look inside if you can found real stream url. A good url can be read by your browser natively.
  2. The configuration file is NOT UTF-8 encoded, be careful

How to help

Because, Yes, You can help.

  • If you find bugs, problems, errors, mistakes, you can create an issue on github.
  • If you have a suggestion or want a new feature, you can create an issue.
  • If you want to make change by your own, fork and pull. We will discuss about your code.

Additionnal informations

If a command doesn't work, try to find the error, or send me the command and I will try to reproduce it. When I upgarde pymumble, the requirement can change. Reinstall the pip3 requirement if you are not sure.

The bot change is own comment with the stream name. Now working with:

  • ShoutCast
  • IceCast

TODO

  • Make the bot speak in the channel
  • Better comment use (and add !help)
  • Option to use a certificate

=====

Credits

Pymumble comes from here. It's, for now, the current fork alive of pymumble in PYTHON 3 now \o/

mumbleradioplayer's People

Contributors

azlux avatar fr31 avatar lartza avatar mkody avatar ranomier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mumbleradioplayer's Issues

Local audio files?

Is this capable of playing local audio files? If not, can you add that capability?

Exception in thread Thread-8

play - http://direct.dps-fm.com:8800/stream
Exception in thread Thread-8:
Traceback (most recent call last):
File "/usr/lib64/python3.4/threading.py", line 911, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.4/threading.py", line 859, in run
self._target(*self._args, **self._kwargs)
File "./mumbleRadioPlayer.py", line 81, in message_received
self.play_stream(parameter)
File "./mumbleRadioPlayer.py", line 151, in play_stream
self.launch_play_stream(get_url(msg))
File "./mumbleRadioPlayer.py", line 156, in launch_play_stream
info = get_server_description(url)
File "./mumbleRadioPlayer.py", line 254, in get_server_description
title_server = data['icestats']['source'][0]['server_name'] + ' - ' +
data['icestats']['source'][0]['server_description']
KeyError: 0

NonType

Hey,

I am getting these kind of error:

Traceback (most recent call last):
File "mumbleRadioPlayer.py", line 287, in
playbot = MumbleRadioPlayer()
File "mumbleRadioPlayer.py", line 50, in init
self.set_comment()
File "mumbleRadioPlayer.py", line 207, in set_comment
self.mumble.users.myself.comment(txt + "

" + self.config.get('bot', 'comment'))
AttributeError: 'NoneType' object has no attribute 'comment'

No sound output ?

Hello,
In following all instructions i have the bot running on a clean/new (VM) Debian box, and its connectingto the mumble server and is responding to all commands issued in the mumble-server.

But when playing a stream the bot remains silent on Mumble
When playing :
!play [stream] - all works, no errors , just no sound on the mumble server
!np - output is correct streamtitle in/on mumble server (so it is playing /getting the stream)

Enabled in debug :

  • option mumbleConnection set to True
    => i see packets being transmtted in output, still bot remains silent

Any idea what i'm missing here ?

  • Glowsome

Problem with shoutCAST url

Hi,

Install was done today following instructions on README.md

Trying to play shoutcast url with mumbleradioplayer always fail with :

play - techno by Elkoxon
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib64/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "./mumbleRadioPlayer.py", line 79, in message_received
self.play_stream(parameter)
File "./mumbleRadioPlayer.py", line 144, in play_stream
self.launch_play_stream(url)
File "./mumbleRadioPlayer.py", line 151, in launch_play_stream
info = get_server_description(url)
File "./mumbleRadioPlayer.py", line 235, in get_server_description
response = urllib.request.urlopen(request)
File "/usr/lib64/python3.5/urllib/request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python3.5/urllib/request.py", line 466, in open
response = self._open(req, data)
File "/usr/lib64/python3.5/urllib/request.py", line 484, in _open
'_open', req)
File "/usr/lib64/python3.5/urllib/request.py", line 444, in _call_chain
result = func(*args)
File "/usr/lib64/python3.5/urllib/request.py", line 1282, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib64/python3.5/urllib/request.py", line 1257, in do_open
r = h.getresponse()
File "/usr/lib64/python3.5/http/client.py", line 1197, in getresponse
response.begin()
File "/usr/lib64/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib64/python3.5/http/client.py", line 279, in _read_status
raise BadStatusLine(line)
http.client.BadStatusLine: ICY 404 Resource Not Found

shoutcast provide .pls file, and by looking inside the pls file i get a streaming URL : http://audio.teknoradio.nl:8064/

This URL works in browser, also work with ffmpeg on command line (extracted from py script at line 160)

I've tried various stuff to bypass the error with no luck.

It's really hard today to find a web radio not running with shoutcast.

Best regards,

Syntax exemple of !playfile ?

Hello,
!list work and find me something.mp3 but when i try !playfile something.mp3 the bot return bad file asked

Can you give me the exact syntax i'm supposed to send for correctly playing this or i am mistaking and the bot only play specific type of files?

Unable to hear voice

Hello Experts,
Mumble client is installed in raspberry pi board using the below code.
I am able to connect my rpi(client) to mumble server, but I am able to talk to server and unable to listen audio from other clients.
BTW, I have connected USB audio device.
Can you please help me to get audio working on two ways ?

A few questions..

A few questions:

  • How to generate cert for bot? For param --cert for register bot on server with own cert. I try --cert cert.p12 from windows, but bot say error and not work;
  • How to play file form url? I try !play http://myurl/test.wav, but bot not play this file. In logs webserver:
    Requested GET /stats?json=1
    In logs bot (debug):
    play - <a href="http://myurl/test.wav">http://myurl/test.wav</a> by user
    (For audio stream (radio) this work).
  • How to play youtube video? I try !play https://www.youtube.com/watch?v=idvideo, but bot say in debug log:
    [tls @ 0x55d800f10100] The TLS connection was non-properly terminated. [AVIOContext @ 0x55d801328980] Statistics: 189313 bytes read, 0 seeks https://www.youtube.com/watch?v=idvideo: Input/output error

Debian GNU/Linux 9.1 (stretch) x86_64
Python 3.5.3
ffmpeg version 3.2.7-1~deb9u1

Installation instructions doesn't work

./mumbleRadioPlayer.py

Traceback (most recent call last):
File "./mumbleRadioPlayer.py", line 13, in
import pymumble.pymumble_py3 as pymumble
ImportError: No module named pymumble.pymumble_py3
mfocuz@host:~/bg_workers/MumbleRadioPlayer$ ls -l pymumble/
total 68
-rw-r--r-- 1 mfocuz mfocuz 8507 Sep 7 21:56 API.md
-rw-r--r-- 1 mfocuz mfocuz 35821 Sep 7 21:56 LICENSE
-rw-r--r-- 1 mfocuz mfocuz 3759 Sep 7 21:56 README.md
-rw-r--r-- 1 mfocuz mfocuz 217 Sep 7 21:56 TODO
drwxr-xr-x 2 mfocuz mfocuz 4096 Sep 7 21:56 pymumble_py3
-rw-r--r-- 1 mfocuz mfocuz 31 Sep 7 21:56 requirements.txt
-rw-r--r-- 1 mfocuz mfocuz 991 Sep 7 21:56 setup.py

Exception in thread Thread-5

play - http://stream.srg-ssr.ch/m/rsp/mp3_128
Exception in thread Thread-5:
Traceback (most recent call last):
File "/usr/lib64/python3.4/threading.py", line 911, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.4/threading.py", line 859, in run
self._target(*self._args, **self._kwargs)
File "./mumbleRadioPlayer.py", line 81, in message_received
self.play_stream(parameter)
File "./mumbleRadioPlayer.py", line 151, in play_stream
self.launch_play_stream(get_url(msg))
File "./mumbleRadioPlayer.py", line 156, in launch_play_stream
info = get_server_description(url)
File "./mumbleRadioPlayer.py", line 253, in get_server_description
data = json.loads(response.read().decode("utf-8"))
File "/usr/lib64/python3.4/json/init.py", line 318, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.4/json/decoder.py", line 343, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.4/json/decoder.py", line 359, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Invalid control character at: line 1 column 22622 (char 22621)

Basic player functionality

Hello i want to propose, report some things:

-it should be nice if your bot have some basic functionality like playing all, playing directory, random, next song or previous song.

-In the readme i think
pip install opuslib
pip install protobuf

should now be (if python3 is used):
pip3 install opuslib
pip3 install protobuf

-The list command is limited by the number of character the bot can send to chat. (So if you have a lot of songs it doesn't work) A solution i find is to send a link to the chan with the list of the song. But the bot could send separate message.

MumbleRadioPlayer Launch Error

When launching MumbleRadioPlayer I get this error, despite having setup everything as described.

Traceback (most recent call last):
  File "./mumbleRadioPlayer.py", line 15, in <module>
    import pymumble
  File "./pymumble/pymumble/__init__.py", line 3, in <module>
    from mumble import Mumble
  File "./pymumble/pymumble/mumble.py", line 12, in <module>
    import users
  File "./pymumble/pymumble/users.py", line 4, in <module>
    import soundqueue
  File "./pymumble/pymumble/soundqueue.py", line 6, in <module>
    import opuslib
  File "/usr/local/lib/python2.7/dist-packages/opuslib/__init__.py", line 26, in <module>
    from .classes import Encoder, Decoder  # NOQA
  File "/usr/local/lib/python2.7/dist-packages/opuslib/classes.py", line 11, in <module>
    import opuslib.api.decoder
  File "/usr/local/lib/python2.7/dist-packages/opuslib/api/__init__.py", line 20, in <module>
    'Could not find opus library. Make sure it is installed.')
Exception: Could not find opus library. Make sure it is installed.

Logging - no timestamping and no filelogging

The current bot does not have timestamping in the logging which is outputted to console
In some cases this is preferred for backtracking issues.
Console-output is a means, but this gest lost after killing/relaunching the bot so not always enough to keep track

I have created a fork to work on this, but it may be a while before i can deliver, as i am at the point of switching jobs...

First assignment in this (my) fork will be to add timestamping to the already available console-output
Then expanding it to file-logging (future path)

Send message to bot fails when having a linebreak/enter in it

A minor issue

When the bot is messaged to !joinme in the channel i am in by sending it a message !joinme
This works for aslong as its a single line without any CarrigeReturn in it.
The bot does not strip it off, and responds with "Unknown command"

As python is not a language i usually deal with i did try by adding the strip() to line 68

 message = text.message.strip() # added strip to get rid of accidental \n or \r characters (hopefully)

But that does not solve it.

In the log i get the following :

joinme
<p - style="-qt-paragraph-type:empty"><br/></p> by Glowsome

I think the solution is something simple, but i'll need to read up on python before i get it.

..any ideas ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.