dtcooper / raspotify

A Spotify Connect client that mostly Just Works™
https://dtcooper.github.io/raspotify
MIT License
4.63k stars 213 forks source link

Raspotify running on RPi Bullseye no longer writes track title to the system journal #518

Closed bobrathbone closed 2 years ago

bobrathbone commented 2 years ago

Compatible OS

Latest Version

Due Diligence

What happened?

Raspberry Pi 4 running Raspberry Pi OS Bullseye.

The following command used to display track titles

journalctl --lines 0 --follow _SYSTEMD_UNIT=raspotify.service This is no longer the case but I am unsure when this changed.

I am the author of a popular Internet project running on the Raspberry Pi See http://bobrathbone.com/raspberrypi/pi_internet_radio.html for further information. I tail the journal and extract the track title and show it on the radio display. BTW the Artist name has never been displayed in the journal which is a shame.

This problem also existed on Buster until support for Raspotify on Buster was dropped.

Relevant log output

journalctl --lines 0 --follow _SYSTEMD_UNIT=raspotify.service
-- Journal begins at Sat 2021-10-30 12:36:50 BST. --
{ Nothing further displayed when the track changes}
github-actions[bot] commented 2 years ago

This question or issue can probably be easily answered or resolved by reading the docs/wiki.

bobrathbone commented 2 years ago

https://github.com/dtcooper/raspotify/labels/help-wanted The above response to this issue was to "read-the-field-manual". I have read the wiki pages but I can not find any references to journalctl or anything relevant to displaying information track title or artist. Is there some other manual or documents other than the wiki at https://github.com/dtcooper/raspotify/wiki If anyone has any more information on this I would be grateful.

JasonLG1979 commented 2 years ago

The config file has a quite option that's turned on by default. Comment it out.

JasonLG1979 commented 2 years ago

You could also just leave it and write an on event script that echos the artist name and track title.

bobrathbone commented 2 years ago

Many thanks that did the trick as far as the track title was concerned. I commented out LIBRESPOT_QUIET in /etc/raspotify/conf

Only log warning and error messages.

LIBRESPOT_QUIET=

Still no sign of the the artist name however.

I already have a Python class that provides track information See https://github.com/bobrathbone/piradio6/blob/master/spotify_class.py

Please close this issue.

JasonLG1979 commented 2 years ago

librespot does not log the artist name. There is nothing that can be done about that. But like I said librespot can be supplied with an on event script/program that will output more metadata than the logs.

JasonLG1979 commented 2 years ago

If the script were to echo that info it would show up in the logs for you to tail.

JasonLG1979 commented 2 years ago

https://github.com/dtcooper/raspotify/discussions/455#discussioncomment-1665069

JasonLG1979 commented 2 years ago
#!/usr/bin/python3
import os
import json

# PLAYER_EVENT:
# changed, started, stopped,
# playing, paused, preloading, volume_set
print(
    json.dumps(
        {
            'event': os.getenv('PLAYER_EVENT') or '',
            'old_track_id': os.getenv('OLD_TRACK_ID') or '',
            'new_track_id': os.getenv('TRACK_ID') or '',
            'duration_ms': os.getenv('DURATION_MS') or '',
            'position_ms': os.getenv('POSITION_MS') or '',
            'volume': os.getenv('VOLUME') or '',
        }
    )
)

librespot -q -o ./test.py

{"event": "volume_set", "old_track_id": "", "new_track_id": "", "duration_ms": "", "position_ms": "", "volume": "58958"}
{"event": "started", "old_track_id": "", "new_track_id": "0IVAlb0cFCH1cQ974iR1TU", "duration_ms": "", "position_ms": "", "volume": ""}
{"event": "playing", "old_track_id": "", "new_track_id": "0IVAlb0cFCH1cQ974iR1TU", "duration_ms": "223546", "position_ms": "171571", "volume": ""}
{"event": "changed", "old_track_id": "0IVAlb0cFCH1cQ974iR1TU", "new_track_id": "6C3yPXYG2NJYlIYVe5J7hv", "duration_ms": "", "position_ms": "", "volume": ""}
{"event": "playing", "old_track_id": "", "new_track_id": "6C3yPXYG2NJYlIYVe5J7hv", "duration_ms": "309946", "position_ms": "0", "volume": ""}
{"event": "changed", "old_track_id": "6C3yPXYG2NJYlIYVe5J7hv", "new_track_id": "2YC6ET3q1F29B0V7UcPV70", "duration_ms": "", "position_ms": "", "volume": ""}
{"event": "playing", "old_track_id": "", "new_track_id": "2YC6ET3q1F29B0V7UcPV70", "duration_ms": "166653", "position_ms": "0", "volume": ""}