Skip to content

Commit

Permalink
Merge pull request #26 from Tom-Hirschberger/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Tom-Hirschberger authored May 4, 2023
2 parents 8f0c349 + 02fc257 commit fd3abc3
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,38 @@ The example configuration from above then looks like:

**In consequence no stream information is provided because VLC does not evaluate the information send by the stations!**

If you do want to set the volume of vlc before a stream gets started you can use the `vlcPaWrapper.bash` wrapper do this.
You can set the wrapper either in the general configuration or for a single station.
To use the wrapper you first need to download and compile the `pa_volume` binary which can be found at [https://github.com/rhaas80/pa_volume](https://github.com/rhaas80/pa_volume).

```bash
cd ~/MagicMirror/modules/MMM-MplayerRadio/scripts

sudo apt-get install -y make pkg-config libpulse-dev pandoc

git clone https://github.com/rhaas80/pa_volume.git
cd pa_volume/
make

mv pa_volume/pa_volume .
```

After this process should have the binary `pa_volume` in the same directory as the wrapper script.
The first argument for the wrapper call will be the new volume, the second the stream to play.

This example will start the wrapper and plays the "Antenne Bayern" station with a volume of 50%:

```bash
/home/pi/MagicMirror/modules/MMM-MplayerRadio/scripts/vlcPaWrapper.bash 50 "http://play.antenne.de/antenne.m3u"
```

The custom commands configuration then will look something like:

```js
customCommand: "/home/pi/MagicMirror/modules/MMM-MplayerRadio/scripts/vlcPaWrapper.bash",
customCommandArgs: ["50", "###URL###"],
```

### XMMS2 ###

If you prefere xmms2 to play the radio streams instead of mplayer you will find an custom script "playRadio.bash" in the scripts folder. There is a example config in the examples directory, too.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MMM-MplayerRadio",
"version": "0.0.13",
"version": "0.0.14",
"description": "",
"main": "MMM-MplayerRadio.js",
"dependencies": {
Expand Down
23 changes: 23 additions & 0 deletions scripts/vlcPaWrapper.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
#You need https://github.com/rhaas80/pa_volume compiled and moved to the same directory as this script to get this running:
#sudo apt-get install -y make pkg-config libpulse-dev pandoc
#git clone https://github.com/rhaas80/pa_volume.git
#cd pa_volume/
#make
#mv pa_volume/pa_volume .
#
if [ $# -lt 2 ]
then
echo "Not enough arguments"
exit 1
fi

NEW_VOLUME=$1
STREAM=$2
IDENTIFIER="video"
FILE_PATH=`readlink -f $0`
CUR_DIR=`dirname $FILE_PATH`
PA_VOLUME="$CUR_DIR/pa_volume"

"$PA_VOLUME" "$IDENTIFIER" "$NEW_VOLUME"
/usr/bin/vlc -I dummy "$STREAM"

0 comments on commit fd3abc3

Please sign in to comment.