From d06f02f1f5a05925ef3c74bde4bb2413dd9de1f0 Mon Sep 17 00:00:00 2001 From: denise Date: Tue, 21 Aug 2012 14:08:30 -0400 Subject: [PATCH] CC-4244: Playlist Builder: Original Length should not be changed after setting Cue in/out value -fixed --- airtime_mvc/application/models/Block.php | 6 +++++- airtime_mvc/application/models/Playlist.php | 13 ++++++++++--- .../application/views/scripts/playlist/update.phtml | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index d5816fab5..28991a0eb 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -192,7 +192,7 @@ class Application_Model_Block $files = array(); $sql = <<<"EOT" - SELECT pc.id as id, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, bl.type, + SELECT pc.id as id, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, bl.type, f.length as orig_length, f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_blockcontents AS pc LEFT JOIN cc_files AS f ON pc.file_id=f.id LEFT JOIN cc_block AS bl ON pc.block_id = bl.id @@ -220,6 +220,10 @@ EOT; $fades = $this->getFadeInfo($row['position']); $row['fadein'] = $fades[0]; $row['fadeout'] = $fades[1]; + + //format original length + $formatter = new LengthFormatter($row['orig_length']); + $row['orig_length'] = $formatter->format(); } return $rows; diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index 29dcd03f8..82bfb4eb3 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -171,7 +171,8 @@ class Application_Model_Playlist f.track_title, f.artist_name AS creator, f.file_exists AS EXISTS, - f.filepath AS path + f.filepath AS path, + f.length AS orig_length FROM cc_playlistcontents AS pc JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} @@ -188,7 +189,8 @@ class Application_Model_Playlist (ws.name || ': ' || ws.url) AS title, sub.login AS creator, 't'::boolean AS EXISTS, - ws.url AS path + ws.url AS path, + ws.length AS orig_length FROM cc_playlistcontents AS pc JOIN cc_webstream AS ws ON pc.stream_id=ws.id LEFT JOIN cc_subjs AS sub ON sub.id = ws.creator_id @@ -206,7 +208,8 @@ class Application_Model_Playlist bl.name AS title, sbj.login AS creator, 't'::boolean AS EXISTS, - NULL::text AS path + NULL::text AS path, + bl.length AS orig_length FROM cc_playlistcontents AS pc JOIN cc_block AS bl ON pc.block_id=bl.id JOIN cc_subjs AS sbj ON bl.creator_id=sbj.id @@ -240,6 +243,10 @@ SQL; $fades = $this->getFadeInfo($row['position']); $row['fadein'] = $fades[0]; $row['fadeout'] = $fades[1]; + + //format original length + $formatter = new LengthFormatter($row['orig_length']); + $row['orig_length'] = $formatter->format(); } return $rows; diff --git a/airtime_mvc/application/views/scripts/playlist/update.phtml b/airtime_mvc/application/views/scripts/playlist/update.phtml index 280437d87..a66b9f94a 100644 --- a/airtime_mvc/application/views/scripts/playlist/update.phtml +++ b/airtime_mvc/application/views/scripts/playlist/update.phtml @@ -55,7 +55,7 @@ if ($item['type'] == 2) { 'id' => $item["id"], 'cueIn' => $item['cuein'], 'cueOut' => $item['cueout'], - 'origLength' => $item['length'])); ?> + 'origLength' => $item['orig_length'])); ?>