diff options
-rw-r--r-- | lib/class/song.class.php | 4 | ||||
-rw-r--r-- | modules/localplay/shoutcast.controller.php | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/class/song.class.php b/lib/class/song.class.php index b4541cf5..806a81f9 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -192,8 +192,8 @@ class Song extends database_object { $this->type = $override; } else { - preg_match('/\.([A-Za-z0-9]+)$/', $this->file,$results); - $this->type = strtolower($results['1']); + $data = pathinfo($this->file); + $this->type = strtolower($data['extension']); } switch ($this->type) { diff --git a/modules/localplay/shoutcast.controller.php b/modules/localplay/shoutcast.controller.php index e4471c54..b5db0aad 100644 --- a/modules/localplay/shoutcast.controller.php +++ b/modules/localplay/shoutcast.controller.php @@ -280,6 +280,15 @@ class AmpacheShoutCast extends localplay_controller { */ public function add($object) { + // Before we add this it must be a mp3 + $object->format_type(); + + if ($this->mime != 'audio/mpeg') { + debug_event('ShoutCast','Error: Unable to play ' . $this->mime . ' files with shoutcast, skipping','3'); + return false; + } + + // Take the filename and strip off the catalog's root_path and put our // prefix onto it $filename = $object->file; |