From 85b2bf6e5526314c1aa1ff3229b16d4deb9bdb50 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Mon, 12 Dec 2011 16:04:16 +0100 Subject: [PATCH] CC-3181 : re-uploaded to soundcloud creates the file name in a different format --- .../application/controllers/ApiController.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index e538d3147..2abdc31cc 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -450,8 +450,20 @@ class ApiController extends Zend_Controller_Action } if (isset($show_name)) { - $tmpTitle = "$show_name-$show_start_time"; - $tmpTitle = str_replace(" ", "-", $tmpTitle); + + $show_name = str_replace(" ", "-", $show_name); + + //2011-12-09-19-28-00-ofirrr-256kbps + $filename = $file->getName(); + + //replace the showname in the filepath incase it has been edited since the show started recording + //(some old bug) + $filename_parts = explode("-", $filename); + $new_name = array_slice($filename_parts, 0, 6); + $new_name[] = $show_name; + $new_name[] = $filename_parts[count($filename_parts)-1]; + + $tmpTitle = implode("-", $new_name); } else { $tmpTitle = $file->getName();