Peppy player

I'm not having any luck getting Peppy to run at all. I started from a Kandinsky image and then set headless=True as I don't have a touchscreen connected yet, but all I get is a crash loop

[2024-01-28 23:37:49,165] {amixerutil.py:44} DEBUG - ALSA mixer name: Headphone
[2024-01-28 23:37:49,216] {diskmanager.py:287} DEBUG - Started USB drive plug/unplug observer
[2024-01-28 23:37:49,490] {screensaverdispatcher.py:219} DEBUG - Get screensaver peppymeter
[2024-01-28 23:37:49,502] {selector_events.py:53} DEBUG - Using selector: EpollSelector
[2024-01-28 23:37:49,510] {webserver.py:209} DEBUG - Web Server Started
[2024-01-28 23:37:49,557] {datasource.py:104} DEBUG - opening pipe...
[2024-01-28 23:37:49,558] {datasource.py:106} DEBUG - pipe opened
[2024-01-28 23:37:49,638] {peppy.py:419} DEBUG - Audio Server Started
[2024-01-28 23:37:49,714] {dispatcher.py:427} DEBUG - Unable to locate touchscreen device: raspberrypi-ts

Top of config.txt:
[screen.info]
width = 800
height = 480
depth = 32
frame.rate = 30
hdmi = False
no.frame = False
flip.touch.xy = False
multi.touch = True

[usage]
touchscreen = False
mouse = False
lirc = False
rotary.encoders = False
web = True
stream.server = False
browser.stream.player = False
voice.assistant = False
headless = True
vu.meter = False
album.art = True
auto.play = True
long.press.time.ms = 700
desktop = False
check.for.updates = False
bluetooth = False
samba = False
use.clock.screensaver.in.timer = False
dns.ip = 8.8.8.8


[logging]
file.logging = True
log.filename = /home/pi/Peppy/peppy.log
append = False
console.logging = False
enable.stdout = True
show.mouse.events = False

The issue seems clear enough, Peppy is trying to interact with a touch screen which is not there. But Headless mode is on so I don't understand why?
 
Now I got Peppy up and running I'm trying to add the streams documented here but it is not playing anything (the built in radio stations work).
I wonder if this is because these are .m3u files linking to .m3u8? I have tried adding both as Radio Playlists and Streams through the web but all I get is silence. Other stations work and the links work in other players so I am not sure what is up.
 
Before I go on can I just take a moment to acknowledge all the hard work that I can see has gone into Peppy. The combination of software and hardware skills and the documentation is all awesome. I'm a programmer myself so I have some clue how much love and hard work you must have poured into this project. I wanted to say that because otherwise forums like this can degenerate into just a list of demands/problems. And I want to say thank you.

I was surprised by your response above because vlc can handle the file I linked to directly (giving a menu of stations and one can choose any to play).
mpd/mpc struggle a bit with that file (it being in essence a playlist of playlists), but, if you dig out one of the individual stations, it works fine. e.g.

I saw the bit on the Wiki about how Peppy is communicating with mpd. I guess it isn't setup to use the load command?
 
  • Like
Reactions: 1 user
lordpixel23, thank you so much! I appreciate it.

In order to have a full control on a playback I parse playlists and feed items from playlists to players (vlc, mpd and mpv) one by one. I don't feed the whole playlist to a player as it's difficult to keep a track of the current item and time in that case. Each approach has pros and cons as usual.

'mpd' was a default player for a long time. I think I played with the 'load' command:
https://github.com/project-owner/Pe...2d609bc285bc47d7629/player/mpdcommands.py#L36
but eventually I decided to use the approach with separate items from a playlist. Then 'vlc' became a default player and to make code generic across players I still use that approach with separate items.

Maybe it makes sense to revisit that and add for example property/flag which will define how playlists should be handled - parsed for items or sent as a whole to a player.
 
Maybe it makes sense to revisit that and add for example property/flag which will define how playlists should be handled - parsed for items or sent as a whole to a player.
That makes sense but I was inspired to do a little research and I think one could do better than that and use the content of the playlist to decide whether to split for items or send the whole list.

Apologies if telling you this is all stuff you already know, but, here's how I think it could work.
The spec is here:
https://www.rfc-editor.org/rfc/rfc8216#page-10

And quoting
A Playlist is a Media Playlist if all URI lines in the Playlist
identify Media Segments. A Playlist is a Master Playlist if all URI
lines in the Playlist identify Media Playlists. A Playlist MUST be
either a Media Playlist or a Master Playlist; all other Playlists are
invalid.
It seems to me that the best approach based on what you're already doing would be to hand over Media Playlists to mpd/vlc as-is and to split other playlists for the reasons you give above.

That said, then, how to tell something is a media playlist. I see two ways:
1. Look for the existence of any Media Playlist tags (https://www.rfc-editor.org/rfc/rfc8216#page-22) -- if you find any, it is a media playlist, OR
2. Do what the quote says above—if the playlist contains other playlists (.m3u, .m3u8) then assume it is not a media playlist

Personally, I think the first option would be the better one.

Looking at the example I started with, this would work pretty well. The top level playlist is:


Code:
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_one/bbc_radio_one.isml/bbc_radio_one-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 1Xtra
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_1xtra/bbc_1xtra.isml/bbc_1xtra-audio%3d96000.norewind.m3u8


Clearly this is NOT a media playlist by either method above. There are no media playlist tags and it consists of links to other playlists (.m3u8) hence this one can and should be separated. If we look through to what each of the nested playlists looks like we see

Code:
#EXTM3U
#EXT-X-VERSION:3
## Created with Unified Streaming Platform(version=1.8.4)
#EXT-X-MEDIA-SEQUENCE:266681207
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-TARGETDURATION:6
#USP-X-TIMESTAMP-MAP:MPEGTS=3165181856,LOCAL=2024-02-01T03:55:18.400000Z
#EXT-X-PROGRAM-DATE-TIME:2024-02-01T03:55:18.400000Z
#EXTINF:6.4, no desc
bbc_radio_one-audio=96000-266681207.ts
#EXTINF:6.4, no desc
bbc_radio_one-audio=96000-266681208.ts

Again, either method would succeed. There are plenty of tags like EXT-X-MEDIA-SEQUENCE etc which mark this as a media playlist and looking at the individual EXTINF media segments one sees .ts "files" not nested playlists.

It looks to me like it would be possible to enhance Peppy to automatically 'do the right thing' and either split a playlist or send it as is. Whether it is worth it to let the user override it for the tiny chance it sometimes gets it wrong I am not sure but I presently doubt the complexity would be worth it.

What do you think? Should I open an issue on GitHub to track this?
 
I think it's easier to detect a playlist type by checking if items have m3u or m3u8 extensions. If so, this is a Master playlist.
Peppy can parse Media playlists and feed the players the same way it's doing that today.

I'm not sure if it's possible to do the same with Master playlists in Peppy. It can get those playlists using the link. I don't know how to handle those segments. How to create the final link from them. For example what to do with bbc_radio_one-audio=96000-266681207.ts? So, if Peppy cannot do that then the only way is to feed the whole playlist with segments to players.
 
Last edited:
New version (Malevich Edition) of the Peppy Player was released.

The source code is available here:
https://github.com/project-owner/Peppy

The disk images with the new release are available here:
https://github.com/project-owner/PeppyPlayers.doc/wiki/Disk-Images

The upgrade to the new versions of the OS (Bookworm) and other software (e.g. Python 3.11, Pygame 2) caused many changes in the player's code. As a result of these changes the following functionality is not available in the player anymore:
  • Support for CD players was dropped as SDL 2/Pygame 2 dropped it.
  • The disk images for SPI displays are not available anymore as it was impossible to make the latest OS and Pygame 2 working with those displays.
  • Sliding actions are not available for touchscreens (e.g. adjusting volume). The touch actions should be used instead.

Here are the main features of the new release:

- Implemented Radio Browser mode which allows to browse through 40K+ online radio stations.
https://github.com/project-owner/Peppy.doc/wiki/Radio-Browser

rb-1.jpg


rb-3.png


- Added toppings to the Spectrum screensaver:

toppings.png


  • Dropped pynanosvg. Refactored SVG images handling.
  • Dropped support for CD players.
  • Refactored VU Meter, Spectrum and Weather screensavers.
  • Refactoring caused by usage of the new Raspberry Pi OS, Python 3.11, Pygame 2.
  • Refactored Audiobooks mode.
  • Redesigned Wi-Fi functionality using nmcli.
  • Refactored the Bluetooth functionality.
  • Refactored support for infra-red remote controls using LIRC module.
  • Redesigned screen updating functionality.
  • Fixed issues with the Slideshow and Stock screensavers.
  • Fixed the issue switching from the Jukebox mode.
 
  • Like
Reactions: 1 users