[Phpmpreloaded-team] function _validateFile
PHP Webclient Collection for MPD (music player daemon)
Brought to you by:
tswaehn
From: Detrick M. <de...@me...> - 2015-05-26 19:46:38
|
Hello, I'm working on a project using mpd and have been using mpd.class.php v1.2 up until today. Today I switched to your newer version 1.3 and the output is a bit ... weird. I essentially have an icecast server that re-streams an internet stream within my house, and mpd catches that re-stream and plays it. First, let's look at the output I get from mpd when I telnet to it directly and ask it for playlistinfo: When mpd is pointed to my icecast server: ======================= Trying 192.168.100.200... Connected to audiopi1.merzhaus.org. Escape character is '^]'. OK MPD 0.16.0 playlistinfo file: http://192.168.100.42:8000/indiepop.mp3 Title: Guitar - Sweet Subtropics Name: Indie Pop Rocks Pos: 0 Id: 0 OK ======================= When mpd is pointed directly to the original source: ======================= Connected to audiopi1.merzhaus.org. Escape character is '^]'. OK MPD 0.16.0 playlistinfo file: http://uwstream2.somafm.com:8090 Title: Guitar - Sweet Subtropics Name: SomaFM presents: Indie Pop Rocks! [SomaFM] Pos: 0 Id: 3 OK ======================= In the first output we see I'm connected to a streaming server (icecast). The title being played currently is "Guitar - Sweet Subtropics." The name is "Indie Pop Rocks." Now, the title actually consists of the artist (Guitar) and the track title (Sweet Subtropics), because this is the way the streaming server is presenting the data. The name field is called "Indie Pop Rocks" which is the "Stream Name" field from the Icecast server. The output when connected directly to the original stream is pretty similar; the title is still a combination of the artist and track title, and the name is still a stream name, unrelated to the artist, album, or track. It seems that function _validateFile is the thing that's prepending "stream://" and the concatenating the title and name fields onto the end, and cramming them back into the Title key and returning it. So why mess with Title? mpd has provided data for Title. If there's a desire to have some values concatenated (e.g. title, name, artist) into a single field, create a new one. Presently, it's making it difficult for me to pull $mpd->playlist[$mpd->current_track_id]['title']. Well, I can pull the value just fine, but I can't get at the value that mpd provides. And I can't figure out why the class is altering the data the way it is. -detrick |