diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-05-18 18:23:20 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2009-05-18 18:23:20 +0000 |
commit | 4a1d7a40ea786526f2f78141451b13ec5e5f90fb (patch) | |
tree | 70367e9e51b809722b30d442481543ae746e1aff /lib/class/scrobbler.class.php | |
parent | 9dd2cb89c20c2cef664ce5641f4427a371284de2 (diff) | |
download | ampache-4a1d7a40ea786526f2f78141451b13ec5e5f90fb.tar.gz ampache-4a1d7a40ea786526f2f78141451b13ec5e5f90fb.tar.bz2 ampache-4a1d7a40ea786526f2f78141451b13ec5e5f90fb.zip |
fix the message parsing so that it accepts libre.fms slightly different response
Diffstat (limited to 'lib/class/scrobbler.class.php')
-rw-r--r-- | lib/class/scrobbler.class.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/class/scrobbler.class.php b/lib/class/scrobbler.class.php index f2b56c7c..682c1973 100644 --- a/lib/class/scrobbler.class.php +++ b/lib/class/scrobbler.class.php @@ -119,12 +119,14 @@ class scrobbler { return false; } - if(preg_match('/http:\/\/(.*):(\d+)(.*)/', $response[3], $matches)) { - $data['submit_host'] = $matches[1]; - $data['submit_port'] = $matches[2]; - $data['submit_url'] = $matches[3]; + if(preg_match('/http:\/\/([^\/]+)\/(.*)$/', $response[3], $matches)) { + $host_parts = explode(":",$matches[1]); + $data['submit_host'] = $host_parts[0]; + $data['submit_port'] = $host_parts[1] ? $host_parts[1] : '80'; + $data['submit_url'] = '/' . $matches[2]; } else { - $this->error_msg = "Invalid POST URL returned, unable to continue. Sent:\n$get_string\n----\nReceived:\n" . $buffer; + $this->error_msg = "Invalid POST URL returned, unable to continue. Sent:\n$get_string\n----\nReceived:\n" . $buffer . + "\n---------\nExpeceted:" . print_r($response,1); return false; } @@ -142,7 +144,7 @@ class scrobbler { public function queue_track($artist, $album, $title, $timestamp, $length,$track) { if ($length < 30) { - debug_event('LastFM',"Not queuing track, too short",'5'); + debug_event('Scrobbler',"Not queuing track, too short",'5'); return false; } |