diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-10-06 05:20:20 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-10-06 05:20:20 +0000 |
commit | 5700fc0c023d1bbf2fc8eb8db2cb4078d64e7e53 (patch) | |
tree | b5db199932626249c38d81503fabf5f4afb38caf /modules/localplay | |
parent | b517599736c381ab9d59d6b5a73aec67a6eaffb6 (diff) | |
download | ampache-5700fc0c023d1bbf2fc8eb8db2cb4078d64e7e53.tar.gz ampache-5700fc0c023d1bbf2fc8eb8db2cb4078d64e7e53.tar.bz2 ampache-5700fc0c023d1bbf2fc8eb8db2cb4078d64e7e53.zip |
fixed css issue, now playing issue and improved mpd controller a tiny bit
Diffstat (limited to 'modules/localplay')
-rw-r--r-- | modules/localplay/mpd.controller.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/modules/localplay/mpd.controller.php b/modules/localplay/mpd.controller.php index b195744e..3501b60e 100644 --- a/modules/localplay/mpd.controller.php +++ b/modules/localplay/mpd.controller.php @@ -319,13 +319,27 @@ class AmpacheMpd { /* Parse out the song ID and then create the song object */ preg_match("/song=(\d+)\&/",$entry['file'],$matches); - $song = new Song($matches['1']); + /* If we don't know it, look up by filename */ + if (!$song->title) { + $filename = sql_escape($entry['file']); + $sql = "SELECT id FROM song WHERE file = '$filename'"; + $db_results = mysql_query($sql, dbh()); + if ($results = mysql_fetch_assoc($db_results)) { + $song = new Song($results['id']); + } + else { + $song = new Song(); + $song->title = _('Unknown'); + } + } + else { + $song = new Song($matches['1']); + } + + /* Make the name pretty */ $song->format_song(); $data['name'] = $song->f_title . ' - ' . $song->f_album . ' - ' . $song->f_artist; - /* Just incase prevent emtpy names */ - if (!$song->title) { $data['name'] = _('Unknown'); } - /* Optional Elements */ $data['link'] = ''; $data['track'] = $entry['Pos']; |