CC-1665: Scheduled stream rebroadcasting and recording

-fixed web stream length not showing up correctly
This commit is contained in:
Martin Konecny 2012-07-20 22:49:34 -04:00
parent 8b2facaa96
commit be8262b67c
3 changed files with 9 additions and 8 deletions

View file

@ -172,12 +172,12 @@ class Application_Model_Playlist
$rows = $query->find($this->con); $rows = $query->find($this->con);
*/ */
$sql = <<<"EOT" $sql = <<<"EOT"
((SELECT pc.file_id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, ((SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_playlistcontents AS pc f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_playlistcontents AS pc
LEFT JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} AND type = 0) LEFT JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} AND type = 0)
UNION ALL UNION ALL
(SELECT pc.file_id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout, (SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
ws.name as title, ws.login as creator, NULL::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc (ws.name || ': ' || ws.url) as title, ws.login as creator, 't'::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc
LEFT JOIN cc_webstream AS ws on pc.file_id=ws.id WHERE pc.playlist_id = {$this->id} AND type = 1)); LEFT JOIN cc_webstream AS ws on pc.file_id=ws.id WHERE pc.playlist_id = {$this->id} AND type = 1));
EOT; EOT;
Logging::debug($sql); Logging::debug($sql);
@ -201,17 +201,18 @@ filepath
album_title album_title
#length #length
*/ */
$offset = 0; $offset = 0;
foreach ($rows as &$row) { foreach ($rows as &$row) {
Logging::log($row); Logging::log($row);
$clipSec = Application_Model_Playlist::playlistTimeToSeconds($row['cliplength']); $clipSec = Application_Model_Playlist::playlistTimeToSeconds($row['length']);
$offset += $clipSec; $offset += $clipSec;
$offset_cliplength = Application_Model_Playlist::secondsToPlaylistTime($offset); $offset_cliplength = Application_Model_Playlist::secondsToPlaylistTime($offset);
//format the length for UI. //format the length for UI.
$formatter = new LengthFormatter($row['cliplength']); $formatter = new LengthFormatter($row['length']);
$row['cliplength'] = $formatter->format(); $row['length'] = $formatter->format();
$formatter = new LengthFormatter($offset_cliplength); $formatter = new LengthFormatter($offset_cliplength);
$row['offset'] = $formatter->format(); $row['offset'] = $formatter->format();

View file

@ -32,7 +32,7 @@
<span><?php echo $row["track_title"] ?></span> <span><?php echo $row["track_title"] ?></span>
<span><?php echo $row["creator"] ?></span> <span><?php echo $row["creator"] ?></span>
<span><?php echo $row["album_title"] ?></span> <span><?php echo $row["album_title"] ?></span>
<span><?php echo $row["cliplength"] ?></span> <span><?php echo $row["length"] ?></span>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>

View file

@ -17,7 +17,7 @@ if (count($items)) : ?>
<?php endif; ?> <?php endif; ?>
<div class="text-row top"> <div class="text-row top">
<span class="spl_playlength"><?php echo $item["cliplength"] ?></span> <span class="spl_playlength"><?php echo $item["length"] ?></span>
<span class="spl_cue ui-state-default"></span> <span class="spl_cue ui-state-default"></span>
<span class="spl_title"><?php echo $item['track_title'] ?></span> <span class="spl_title"><?php echo $item['track_title'] ?></span>
</div> </div>