CC-2932: Recorder: When show is recorded, the file name is generated

with UTC time.

- fixed
- new pybundle is created with 'pytz' package
This commit is contained in:
James 2011-10-05 17:27:00 -04:00
parent 7a03fc6a18
commit c35f77a9aa
4 changed files with 13 additions and 3 deletions

View File

@ -367,7 +367,7 @@ class ApiController extends Zend_Controller_Action
$show_inst->setRecordedFile($file_id);
$show_name = $show_inst->getName();
$show_genre = $show_inst->getGenre();
$show_start_time = $show_inst->getShowStart();
$show_start_time = ConvertToLocalDateTimeString($show_inst->getShowStart());
} catch (Exception $e){
//we've reached here probably because the show was

View File

@ -78,6 +78,7 @@ class Application_Model_RabbitMq
$end_timestamp = new DateTime("@".time() + 3600*2);
$temp['event_type'] = $event_type;
$temp['server_timezone'] = Application_Model_Preference::GetTimezone();
if($event_type = "update_schedule"){
$temp['shows'] = Application_Model_Show::getShows($now->format("Y-m-d H:i:s"), $end_timestamp->format("Y-m-d H:i:s"), $excludeInstance=NULL, $onlyRecord=TRUE);
}

View File

@ -8,6 +8,7 @@ import os
import sys
import shutil
import socket
import pytz
from configobj import ConfigObj
@ -174,6 +175,7 @@ class CommandListener(Thread):
self.shows_to_record = {}
self.time_till_next_show = 3600
self.logger.info("RecorderFetch: init complete")
self.server_timezone = '';
def init_rabbit_mq(self):
self.logger.info("Initializing RabbitMQ stuff")
@ -203,6 +205,7 @@ class CommandListener(Thread):
temp = m['shows']
if temp is not None:
self.parse_shows(temp)
self.server_timezone = m['server_timezone']
elif(command == 'cancel_recording'):
if self.sr.is_recording():
self.sr.cancel_recording()
@ -252,8 +255,14 @@ class CommandListener(Thread):
show_length = self.shows_to_record[start_time][0]
show_instance = self.shows_to_record[start_time][1]
show_name = self.shows_to_record[start_time][2]
self.sr = ShowRecorder(show_instance, show_name, show_length.seconds, start_time, filetype="mp3")
T = pytz.timezone(self.server_timezone)
start_time_on_UTC = getDateTimeObj(start_time)
start_time_on_server = start_time_on_UTC.replace(tzinfo=pytz.utc).astimezone(T)
start_time_formatted = '%(year)d-%(month)02d-%(day)02d %(hour)02d:%(min)02d:%(sec)02d' % \
{'year': start_time_on_server.year, 'month': start_time_on_server.month, 'day': start_time_on_server.day,\
'hour': start_time_on_server.hour, 'min': start_time_on_server.minute, 'sec': start_time_on_server.second}
self.sr = ShowRecorder(show_instance, show_name, show_length.seconds, start_time_formatted, filetype="mp3")
self.sr.start()
#remove show from shows to record.