Skip to content

Commit

Permalink
Merge pull request #11 from Tom-Hirschberger/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Tom-Hirschberger authored Feb 10, 2021
2 parents 951f012 + e7b6eb8 commit 699c86e
Show file tree
Hide file tree
Showing 7 changed files with 471 additions and 465 deletions.
589 changes: 358 additions & 231 deletions MMM-MplayerRadio.js

Large diffs are not rendered by default.

37 changes: 16 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# MMM-MplayerRadio #
This module plays .m3u playlists with the system mplayer instance. Multiple stations are supported and can be switched either by notification or touch control. The privious and next station will be displayed and also the currently playing. If the radio station provides stream info (current song, studio hotline, etc.) the information will be displayed, too.
This module plays .m3u playlists with the system mplayer instance. Multiple stations are supported and can be switched either by notification or touch control. The currently played station is highlighted. If the radio station provides stream info (current song, studio hotline, etc.) the information will be displayed, too.
Different stations can be used in different profiles (profile string in configuration).

**⚠️Currently mplayer has a lot of problems and is not able to play streams properly. Also there is a problem that there is no sound on some devices since Rasperry OS moved to PulsAudio instead auf ALSA (December 2020). To avoid this problems i strongly suggest to use the VLC player instaed. In consequence no stream information will be provided. There is an description in the configuration section on how to change to the VLC player!⚠️**
Expand All @@ -14,14 +14,9 @@ Hint: It may be possible to play any songs you like by creating an .m3u file of

## Screenshots ##
### In Action ###
![alt text](https://github.com/Tom-Hirschberger/MMM-MplayerRadio/raw/master/examples/threeStationsOnePlaying.png "ThreeStations with one playing")

![alt text](https://github.com/Tom-Hirschberger/MMM-MplayerRadio/raw/master/examples/threeStationsOnePlayingWithVolControl.png "ThreeStations with one playing and volume controls")
![alt text](https://github.com/Tom-Hirschberger/MMM-MplayerRadio/raw/master/examples/threeStationsOnePlaying.png "ThreeStations with one playing and volume controls")

![alt text](https://github.com/Tom-Hirschberger/MMM-MplayerRadio/raw/master/examples/threeStationsStopped.png "ThreeStations with stopped state")
### After Startup ###
![alt text](https://github.com/Tom-Hirschberger/MMM-MplayerRadio/raw/master/examples/initialScreen.png "InitialScreen")


## Installation

Expand Down Expand Up @@ -78,27 +73,20 @@ You can try it without an asound.conf. If you get no sound try adding this one a
stations: [
{
title: "Antenne.de",
url: "http://www.surfmusik.de/m3u/antenne-bayern,922.m3u",
url: "http://play.antenne.de/antenne.m3u",
logo: "https://upload.wikimedia.org/wikipedia/commons/a/ac/Antenne-bayern-logo.png",
},
{
title: "Bayern 3",
url: "http://www.surfmusik.de/m3u/bayern-3,925.m3u",
logo: "https://upload.wikimedia.org/wikipedia/de/thumb/d/d3/Bayern_3.svg/200px-Bayern_3.svg.png",
},
{
title: "Rock Antenne",
url: "http://www.surfmusik.de/m3u/rock-antenne,950.m3u",
url: "http://play.rockantenne.de/rockantenne.m3u",
logo: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/92/Rock_Antenne_Logo_2017.svg/200px-Rock_Antenne_Logo_2017.svg.png",
mplayerCache: 2048,
},
{
title: "Radio Gong",
url: "http://www.surfmusik.de/m3u/gong-96-3-muenchen,2021.m3u",
logo: "https://upload.wikimedia.org/wikipedia/commons/7/78/Radio_Gong_96.3_Logo.png",
}
],
displayStationsOnStartup: true
},
},
```
Expand Down Expand Up @@ -129,17 +117,17 @@ The example configuration from above then looks like:
stations: [
{
title: "Antenne.de",
url: "http://www.surfmusik.de/m3u/antenne-bayern,922.m3u",
url: "http://play.antenne.de/antenne.m3u",
logo: "https://upload.wikimedia.org/wikipedia/commons/a/ac/Antenne-bayern-logo.png",
},
{
title: "Bayern 3",
url: "http://www.surfmusik.de/m3u/bayern-3,925.m3u",
url: "https://streams.br.de/bayern3_1.m3u",
logo: "https://upload.wikimedia.org/wikipedia/de/thumb/d/d3/Bayern_3.svg/200px-Bayern_3.svg.png",
},
{
title: "Rock Antenne",
url: "http://www.surfmusik.de/m3u/rock-antenne,950.m3u",
url: "http://play.rockantenne.de/rockantenne.m3u",
logo: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/92/Rock_Antenne_Logo_2017.svg/200px-Rock_Antenne_Logo_2017.svg.png",
},
{
Expand All @@ -162,12 +150,19 @@ If you prefere xmms2 to play the radio streams instead of mplayer you will find
| Option | Description | Type | Default |
| ------- | --- | --- | --- |
| autoplay | If you like to play a station automatically after the module starts simply specify its index (starting with 0) here | Integer | null |
| initStation | If this value is provided instead of the station with index 1 the station with this index will be selected at the start (but not played as with autplay) | Integer | null |
| stations | An array containing station opjects; Each one needs to have an title and an url; | Array | [] |
| showStations | If you do not want to see your stations but only the initial screen with the controls set this option to false | boolean | true |
| showStreamInfo | If you do not want to see the information about the current running stream (if provided) you can change this option to false | boolean | true |
| showControls | If you do not want the control bar (prev, play, stop, next) you can hide it by setting this value to false | boolean | true |
| showVolControls | If you do not want the volume up/down buttons to be visible in the control bar you can hide them by setting this value to false | boolean | true |
| showStations | If you do not want to see your stations but only the initial screen with the controls set this option to false | boolean | true |
| showLogos | Should the logos of the stations be displayed? | boolean | true |
| showTitles | Should the titles of the stations be displayed? | boolean | true |
| stationsBeforeAndAfter | How many stations should be displayed before and after the current active one. This value is only used if "scrollableStations" is set to false. | Integer | 1 |
| scrollableStations | Should the list of stations be scrollable. If not the count of stations before and after will be displayed. | boolean | false |
| scrollToActiveStation | Should the position of the station list be adjusted to be the current active station be the first element after a station change | true |
| missingLogoUrl | If you do not provide a logo for an station this one is used | String | "./MMM-MplayerRadio/radio-freepnglogos.png" |
| displayStationsOnStartup | If you do not want to see the inital screen (screenshots) but the directly the stations set this option to true | boolean | false |
| stopOnSuspend | Should the player be stopped if the module gets hidden (i.e. because the page changes)? | boolean | false |
| changeStationOnProfileChange | Should the station be changed if the profile changes and this station is not suitable for the new profile | boolean | true |
| noInfoIcon | This icon will displayed in the inital screen and if you change to a profile that has no sations assosiated. You can use any iconify icon. | String | "noto:radio" |
| previousIcon | This icon is used in the control section to switch to the previous station. It is an iconify icon, too. | String | "ic-round-skip-previous" |
Expand Down
Binary file modified examples/threeStationsOnePlaying.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions mplayer-radio-scroll.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.mradio .stationsWrapper {
overflow: auto;
height: 240px;
}
130 changes: 66 additions & 64 deletions mplayer-radio.css
Original file line number Diff line number Diff line change
@@ -1,104 +1,106 @@
svg[data-icon="noto:radio"] {
font-size: 140px;
}

.mradio {
min-width: 400px;
font-size: 16px;
font-weight: normal;
/* background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.33, rgb(35, 56, 56)), color-stop(0.67, rgb(53, 80, 80))); */
/* background-image: -moz-linear-gradient(center bottom, rgb(35, 56, 56) 33%, rgb(53, 80, 80) 67% ); */
padding: 5px;
}

.mradio .previousWrapper, .mradio .nextWrapper {
height: 51px;
.mradio.wrapper {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: flex-start;
font-size: 0px;
line-height: 0px;
}

.mradio .stationsWrapper {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: flex-start;
font-size: 0px;
line-height: 0px;
width: 100%;
/* height: 240px; */
overflow: hidden;
}

.mradio .currentWrapper {
height: 90px;
.mradio .station {
width: 100%;
height: 45px;
max-height: 45px;
margin-top: 10px;
}

.mradio .streamInfoWrapper {
padding-top: 5px;
height: 50px;
.mradio .station.selected {
height: 120px;
max-height: 120px;
}

.mradio .controlWrapper {
padding-top: 5px;
.mradio .station .innerWrapper {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
height: 100%;
}

.mradio .logoWrapper {
width: 250px;
text-align: center;
margin: 10px;
.mradio .station.selected .innerWrapper {
border-radius: 5px;
}

.mradio .previousWrapper .logo {
margin-bottom: 5px;
max-height: 35px;
vertical-align: middle;
.mradio .station.selected.playing .innerWrapper {
background-color: #425a85;
border-radius: 5px;
}

.mradio .currentWrapper .logo {
max-height: 70px;
vertical-align: middle;
.mradio .station.selected.stopped .innerWrapper {
background-color: #302f2d;
border-radius: 5px;
}

.mradio .nextWrapper .logo {
max-height: 35px;
vertical-align: middle;
.mradio .station .innerWrapper .titleWrapper{
margin-left: 20px;
}

.mradio .titleWrapper {
margin: 10px;
.mradio .station .logoWrapper {
width: 150px;
text-align: left;
vertical-align: middle;
}

.mradio .currentWrapper .title {
font-size: 20px;
text-align: center;
max-height: 45px;
margin-left: 5px;
margin-top: 5px;
margin-bottom: 5px;
}

.mradio .currentWrapper .logoWrapper {
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
.mradio .station.selected .logoWrapper {
max-height: 120px;
}

.mradio .currentWrapper.playing .logoWrapper{
background-color:#425a85;
.mradio .station .logo {
max-width: 150px;
max-height: 35px;
border-radius: 5px;
}

.mradio .currentWrapper.stopped .logoWrapper{
background-color:#302f2d;
.mradio .station.selected .logo {
max-height: 110px;
}

.mradio .currentWrapper .titleWrapper {
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
font-weight: bold;
.mradio .station .titleWrapper {
font-size: 26px;
}

.mradio .currentWrapper.playing .titleWrapper {
font-style: italic;
background-color:#425a85;
.mradio .streamInfoWrapper {
padding-top: 5px;
height: 50px;
}

.mradio .currentWrapper.stopped .titleWrapper {
font-style: normal;
background-color:#302f2d;
.mradio .streamInfoWrapper {
font-size: 16px;
}

.mradio .controlInnerWrapper {
.mradio .controlWrapper {
padding-top: 5px;
width: 100%;
text-align: center;
}

.mradio .controlWrapper .button {
height: 30px;
width: 30px;
margin-left: 5px;
margin-right: 5px;
}
}
Loading

0 comments on commit 699c86e

Please sign in to comment.