mirror of
https://github.com/Pecusx/piradio-mini.git
synced 2026-05-20 22:33:44 +02:00
New streaming (mpd and pianobar) with metadata
This commit is contained in:
@@ -32,6 +32,7 @@ from time import strftime
|
||||
import shutil
|
||||
import atexit
|
||||
import traceback
|
||||
import requests
|
||||
|
||||
# Class imports
|
||||
from radio_daemon import Daemon
|
||||
@@ -53,6 +54,7 @@ DOWN = 1
|
||||
#CurrentFile = CurrentStationFile
|
||||
PlaylistsDirectory = "/var/lib/mpd/playlists/"
|
||||
|
||||
|
||||
log = Log()
|
||||
radio = Radio()
|
||||
lcd = Lcd()
|
||||
@@ -549,6 +551,14 @@ def display_current(lcd,radio,toggleScrolling):
|
||||
current_artist = radio.getCurrentArtist()
|
||||
lcd.line2(current_artist)
|
||||
|
||||
# Send metadata to icecast server
|
||||
if radio.streaming:
|
||||
if radio.streammetadata != title:
|
||||
radio.streammetadata = title
|
||||
metadataFormatted = radio.streammetadata.replace(" ","+") #add "+" instead of " " for icecast2
|
||||
requestToSend = ("http://localhost:8001/admin/metadata?mount=/mpd&mode=updinfo&song=") +(metadataFormatted)
|
||||
r = requests.get((requestToSend), auth=("admin","mympd"))
|
||||
|
||||
# Display stream error
|
||||
if radio.gotError():
|
||||
errorStr = radio.getErrorString()
|
||||
|
||||
Reference in New Issue
Block a user