summaryrefslogtreecommitdiffstats
path: root/modules/localplay/mpd.controller.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-06 05:20:20 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-10-06 05:20:20 +0000
commit5700fc0c023d1bbf2fc8eb8db2cb4078d64e7e53 (patch)
treeb5db199932626249c38d81503fabf5f4afb38caf /modules/localplay/mpd.controller.php
parentb517599736c381ab9d59d6b5a73aec67a6eaffb6 (diff)
downloadampache-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/mpd.controller.php')
-rw-r--r--modules/localplay/mpd.controller.php22
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'];