From 43a9b63fb526b2864847435f19e02cbe13735daa Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 9 Mar 2011 22:25:02 -0500 Subject: [PATCH 1/7] CC-1848 -began progress, not complete yet. Show can be deleted from database while it is playing, need to notify pypo as well --- .zfproject.xml | 4 ++++ .../controllers/ScheduleController.php | 22 +++++++++++++++++++ .../schedule/cancel-current-show.phtml | 1 + public/js/airtime/schedule/schedule.js | 10 +++++++++ 4 files changed, 37 insertions(+) create mode 100644 application/views/scripts/schedule/cancel-current-show.phtml diff --git a/.zfproject.xml b/.zfproject.xml index c9da28565..9767ec927 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -71,6 +71,7 @@ + @@ -335,6 +336,9 @@ + + + diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index e589f7fe9..b0924ebb6 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -153,6 +153,15 @@ class ScheduleController extends Zend_Controller_Action } $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/show-content-dialog'.$params, 'callback' => 'window["buildContentDialog"]'), 'title' => 'Show Content'); + + if (strtotime($show->getShowStart()) <= strtotime($today_timestamp) && + strtotime($today_timestamp) < strtotime($show->getShowEnd())) { + $menu[] = array('action' => array('type' => 'fn', + //'url' => '/Schedule/cancel-current-show'.$params, + 'callback' => "window['confirmCancelShow']($id)"), + 'title' => 'Cancel Current Show'); + } + if (strtotime($today_timestamp) < strtotime($show->getShowStart())) { if ($user->isAdmin()) { $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance'); @@ -392,6 +401,19 @@ class ScheduleController extends Zend_Controller_Action $show->cancelShow($showInstance->getShowStart()); } } + + public function cancelCurrentShowAction() + { + $userInfo = Zend_Auth::getInstance()->getStorage()->read(); + $user = new User($userInfo->id); + + if($user->isAdmin()) { + $showInstanceId = $this->_getParam('id'); + $show = new ShowInstance($showInstanceId); + $show->clearShow(); + $show->deleteShow(); + } + } } diff --git a/application/views/scripts/schedule/cancel-current-show.phtml b/application/views/scripts/schedule/cancel-current-show.phtml new file mode 100644 index 000000000..837c66731 --- /dev/null +++ b/application/views/scripts/schedule/cancel-current-show.phtml @@ -0,0 +1 @@ +

View script for controller Schedule and script/action name cancelCurrentShow
\ No newline at end of file diff --git a/public/js/airtime/schedule/schedule.js b/public/js/airtime/schedule/schedule.js index 48b256a10..79c364e4c 100644 --- a/public/js/airtime/schedule/schedule.js +++ b/public/js/airtime/schedule/schedule.js @@ -155,6 +155,16 @@ function makeScheduleDialog(dialog, json) { setScheduleDialogEvents(dialog); } +function confirmCancelShow(show_instance_id){ + if(confirm('Erase current show and stop playback?')){ + var url = "/Schedule/cancel-current-show/id/"+show_instance_id; + $.ajax({ + url: url, + success: function(data){scheduleRefetchEvents();} + }); + } +} + function buildContentDialog(json){ var dialog = $(json.dialog); From 00f5c6de4117e42617c0964252e104beed922733 Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 9 Mar 2011 22:25:55 -0500 Subject: [PATCH 2/7] CC-1938 -improved update message for doctrine --- install/DoctrineMigrations/migrations.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/DoctrineMigrations/migrations.xml b/install/DoctrineMigrations/migrations.xml index bcadb0e1c..bab01e8a6 100644 --- a/install/DoctrineMigrations/migrations.xml +++ b/install/DoctrineMigrations/migrations.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://doctrine-project.org/schemas/migrations/configuration http://doctrine-project.org/schemas/migrations/configuration.xsd"> - Doctrine Sandbox Migrations + Airtime 1.7 Database Upgrade DoctrineMigrations From d2fdb0008a0eee8ee8dac8646477f1b3cc710b2b Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 10 Mar 2011 16:41:41 -0500 Subject: [PATCH 3/7] CC-1848 -shows in progress can now be cancelled. --- application/models/Schedule.php | 3 ++- pypo/api_clients/api_client.py | 11 +++++------ pypo/config.cfg | 4 ++-- pypo/install/pypo-uninstall.py | 2 +- pypo/pypo-cli.py | 3 +-- pypo/pypofetch.py | 5 +++-- pypo/pypopush.py | 32 ++++++++++++++++++++++++++++---- pypo/scripts/ls_lib.liq | 15 +++++++++++++-- pypo/scripts/ls_script.liq | 23 ++++++++++++----------- 9 files changed, 67 insertions(+), 31 deletions(-) diff --git a/application/models/Schedule.php b/application/models/Schedule.php index 1bff6cf76..5fe66f2ca 100644 --- a/application/models/Schedule.php +++ b/application/models/Schedule.php @@ -733,7 +733,8 @@ class Schedule { } $result = array(); - $result['status'] = array('range' => array('start' => $range_start, 'end' => $range_end), 'version' => "1.1"); + $result['status'] = array('range' => array('start' => $range_start, 'end' => $range_end), + 'version' => "1.1"); $result['playlists'] = $playlists; $result['check'] = 1; diff --git a/pypo/api_clients/api_client.py b/pypo/api_clients/api_client.py index 5fd04b522..6994cf3fd 100644 --- a/pypo/api_clients/api_client.py +++ b/pypo/api_clients/api_client.py @@ -115,7 +115,6 @@ class AirTimeApiClient(ApiClientInterface): url = url.replace("%%api_key%%", self.config["api_key"]) try: - logger.debug("Trying to contact %s", url) response = urllib.urlopen(url) data = response.read() logger.debug("Data: %s", data) @@ -278,7 +277,7 @@ class AirTimeApiClient(ApiClientInterface): logger.info("API-Message %s", response['message']) except Exception, e: - logger.critical("Unable to connect - %s", e) + logger.error("Unable to connect - %s", e) return response @@ -304,7 +303,7 @@ class AirTimeApiClient(ApiClientInterface): logger.info("API-Message %s", response['message']) except Exception, e: - logger.critical("Exception: %s", e) + logger.error("Exception: %s", e) return response @@ -475,7 +474,7 @@ class ObpApiClient(): except Exception, e: print e api_status = False - logger.critical("Unable to connect to the OBP API - %s", e) + logger.error("Unable to connect to the OBP API - %s", e) return response @@ -510,7 +509,7 @@ class ObpApiClient(): except Exception, e: print e api_status = False - logger.critical("Unable to connect to the OBP API - %s", e) + logger.error("Unable to connect to the OBP API - %s", e) return response @@ -530,7 +529,7 @@ class ObpApiClient(): except Exception, e: print e api_status = False - logger.critical("Unable to handle the OBP API request - %s", e) + logger.error("Unable to handle the OBP API request - %s", e) return response diff --git a/pypo/config.cfg b/pypo/config.cfg index cbe7f38d7..638558fbf 100644 --- a/pypo/config.cfg +++ b/pypo/config.cfg @@ -42,7 +42,7 @@ cache_for = 24 #how long to hold the cache, in hours # the time you expect to "lock-in" your schedule. So if your schedule is set # 24 hours in advance, this can be set to poll every 12 hours. # -poll_interval = 30 # in seconds. +poll_interval = 5 # in seconds. # Push interval in seconds. @@ -52,7 +52,7 @@ poll_interval = 30 # in seconds. # # It's hard to imagine a situation where this should be more than 1 second. # -push_interval = 1 # in seconds +push_interval = 2 # in seconds # 'pre' or 'otf'. 'pre' cues while playlist preparation # while 'otf' (on the fly) cues while loading into ls diff --git a/pypo/install/pypo-uninstall.py b/pypo/install/pypo-uninstall.py index 3d698faac..0b225cc7e 100644 --- a/pypo/install/pypo-uninstall.py +++ b/pypo/install/pypo-uninstall.py @@ -15,7 +15,7 @@ def remove_path(path): os.system("rm -rf " + path) def remove_user(username): - os.system("killall -u " + username) + os.system("killall -u %s 2>&1 1>/dev/null" % username) #allow all process to be completely closed before we attempt to delete user print "Waiting for processes to close..." diff --git a/pypo/pypo-cli.py b/pypo/pypo-cli.py index 7a27b13be..3c0402908 100755 --- a/pypo/pypo-cli.py +++ b/pypo/pypo-cli.py @@ -67,8 +67,7 @@ logging.config.fileConfig("logging.cfg") try: config = ConfigObj('config.cfg') POLL_INTERVAL = float(config['poll_interval']) - PUSH_INTERVAL = 0.5 - #PUSH_INTERVAL = float(config['push_interval']) + PUSH_INTERVAL = float(config['push_interval']) LS_HOST = config['ls_host'] LS_PORT = config['ls_port'] except Exception, e: diff --git a/pypo/pypofetch.py b/pypo/pypofetch.py index d1665ae3e..aaeda54f5 100644 --- a/pypo/pypofetch.py +++ b/pypo/pypofetch.py @@ -91,14 +91,15 @@ class PypoFetch: tn = telnetlib.Telnet(LS_HOST, LS_PORT) - #encode in latin-1 due to this bug: http://bugs.python.org/issue1772794 + #encode in latin-1 due to telnet protocol not supporting utf-8 tn.write(('vars.stream_metadata_type %s\n' % stream_metadata['format']).encode('latin-1')) tn.write(('vars.station_name %s\n' % stream_metadata['station_name']).encode('latin-1')) + tn.write('exit\n') logger.debug(tn.read_all()) except Exception, e: - logger.critical("Exception %s", e) + logger.error("Exception %s", e) status = 0 return status diff --git a/pypo/pypopush.py b/pypo/pypopush.py index 6da24da72..266443b8f 100644 --- a/pypo/pypopush.py +++ b/pypo/pypopush.py @@ -36,8 +36,8 @@ class PypoPush: gives the number of seconds of the window of opportunity for the scheduler to catch when a playlist is to be played. """ - self.push_ahead = 15 - self.push_ahead2 = 10 + self.push_ahead = 10 + self.push_ahead2 = self.push_ahead -5 def set_export_source(self, export_source): self.export_source = export_source @@ -59,23 +59,30 @@ class PypoPush: tcoming = time.localtime(time.time() + self.push_ahead) tcoming2 = time.localtime(time.time() + self.push_ahead2) - tnow = time.localtime(time.time()) + str_tcoming_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming[0], tcoming[1], tcoming[2], tcoming[3], tcoming[4], tcoming[5]) str_tcoming2_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming2[0], tcoming2[1], tcoming2[2], tcoming2[3], tcoming2[4], tcoming2[5]) + currently_on_air = False if self.schedule == None: logger.warn('Unable to loop schedule - maybe write in progress?') logger.warn('Will try again in next loop.') else: for pkey in self.schedule: + plstart = pkey[0:19] + start = self.schedule[pkey]['start'] + end = self.schedule[pkey]['end'] + playedFlag = (pkey in playedItems) and playedItems[pkey].get("played", 0) - if pkey[0:19] == str_tcoming_s or (pkey[0:19] < str_tcoming_s and pkey[0:19] > str_tcoming2_s and not playedFlag): + + if plstart == str_tcoming_s or (plstart < str_tcoming_s and plstart > str_tcoming2_s and not playedFlag): logger.debug('Preparing to push playlist scheduled at: %s', pkey) playlist = self.schedule[pkey] ptype = playlist['subtype'] + currently_on_air = True # We have a match, replace the current playlist and # force liquidsoap to refresh. @@ -95,6 +102,23 @@ class PypoPush: logger.debug("Doing callback to server to update 'played' status.") self.api_client.notify_scheduled_item_start_playing(pkey, self.schedule) + if self.schedule != None: + tnow = time.localtime(time.time()) + str_tnow_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tnow[0], tnow[1], tnow[2], tnow[3], tnow[4], tnow[5]) + for pkey in self.schedule: + start = self.schedule[pkey]['start'] + end = self.schedule[pkey]['end'] + + if start <= str_tnow_s and str_tnow_s < end: + currently_on_air = True + + if not currently_on_air: + tn = telnetlib.Telnet(LS_HOST, LS_PORT) + tn.write('source.skip\n'.encode('latin-1')) + tn.write('exit\n') + tn.read_all() + #logger.info('source.skip') + #logger.debug(tn.read_all()) def push_liquidsoap(self, pkey, schedule, ptype): logger = logging.getLogger() diff --git a/pypo/scripts/ls_lib.liq b/pypo/scripts/ls_lib.liq index f9cfd58ce..27ed94f06 100644 --- a/pypo/scripts/ls_lib.liq +++ b/pypo/scripts/ls_lib.liq @@ -42,8 +42,19 @@ end def add_skip_command(s) # A command to skip def skip(_) - source.skip(s) - "Done!" + # get playing (active) queue and flush it + l = list.hd(server.execute("queue.secondary_queue")) + l = string.split(separator=" ",l) + list.iter(fun (rid) -> ignore(server.execute("queue.ignore #{rid}")), l) + + l = list.hd(server.execute("queue.primary_queue")) + l = string.split(separator=" ", l) + if list.length(l) > 0 then + source.skip(s) + "Skipped" + else + "Not skipped" + end end # Register the command: server.register(namespace="source", diff --git a/pypo/scripts/ls_script.liq b/pypo/scripts/ls_script.liq index 571a00b25..a35495839 100644 --- a/pypo/scripts/ls_script.liq +++ b/pypo/scripts/ls_script.liq @@ -4,8 +4,9 @@ set("log.file.path", log_file) set("log.stdout", true) set("server.telnet", true) +set("server.telnet.port", 1234) -queue = request.queue(id="queue", conservative=true) +queue = request.queue(id="queue", length=0.5) queue = audio_to_stereo(queue) pypo_data = ref '0' @@ -31,22 +32,22 @@ s = fallback(track_sensitive=false, [queue, default]) s = on_metadata(notify, s) s = crossfade(s) # Attach a skip command to the source s: -add_skip_command(s) -web_stream_source = input.http(id="web_stream", autostart = false, buffer=0.5, max=20., "") +#web_stream_source = input.http(id="web_stream", autostart = false, buffer=0.5, max=20., "") #once the stream is started, give it a sink so that liquidsoap doesn't #create buffer overflow warnings in the log file. -output.dummy(fallible=true, web_stream_source) +#output.dummy(fallible=true, web_stream_source) -s = switch(track_sensitive = false, - transitions=[to_live,to_live], - [ - ({ !web_stream_enabled }, web_stream_source), - ({ true }, s) - ] -) +#s = switch(track_sensitive = false, +# transitions=[to_live,to_live], +# [ +# ({ !web_stream_enabled }, web_stream_source), +# ({ true }, s) +# ] +#) +add_skip_command(s) s = map_metadata(append_title, s) From 2f8aeeb2c01c74f8128a8c92ec1db5922d77086c Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 10 Mar 2011 16:46:36 -0500 Subject: [PATCH 4/7] CC-2053 -disabled persistent db connections for now... --- application/Bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/Bootstrap.php b/application/Bootstrap.php index ce6c1127c..9911b8931 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -23,7 +23,7 @@ require_once 'Users.php'; global $CC_CONFIG, $CC_DBC; $dsn = $CC_CONFIG['dsn']; -$CC_DBC = DB::connect($dsn, TRUE); +$CC_DBC = DB::connect($dsn, FALSE); if (PEAR::isError($CC_DBC)) { echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n"; exit(1); From 55745d1a4a882a070bd01851d0d086c847ac0a01 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 10 Mar 2011 19:28:57 -0500 Subject: [PATCH 5/7] CC-2025 Indicate songs that are over-booked --- application/models/Nowplaying.php | 5 +- public/css/images/icon_overlap.png | Bin 0 -> 1062 bytes public/css/styles.css | 89 ++++++++++++++++++++--- public/js/playlist/nowplayingdatagrid.js | 9 +++ 4 files changed, 89 insertions(+), 14 deletions(-) create mode 100644 public/css/images/icon_overlap.png diff --git a/application/models/Nowplaying.php b/application/models/Nowplaying.php index 726825a5f..884b5cd05 100644 --- a/application/models/Nowplaying.php +++ b/application/models/Nowplaying.php @@ -82,10 +82,11 @@ class Application_Model_Nowplaying $type = "n"; } + $over = ""; if (strtotime($item['item_ends']) > strtotime($item['show_ends'])) - $type = "over"; + $over = "x"; - array_push($data, array($type, $item["item_starts"], $item["item_starts"], $item["item_ends"], $item["clip_length"], $item["track_title"], $item["artist_name"], $item["album_title"], $item["playlist_name"], $item["show_name"], $item["instance_id"])); + array_push($data, array($type, $item["item_starts"], $item["item_starts"], $item["item_ends"], $item["clip_length"], $item["track_title"], $item["artist_name"], $item["album_title"], $item["playlist_name"], $item["show_name"], $over, $item["instance_id"])); } } diff --git a/public/css/images/icon_overlap.png b/public/css/images/icon_overlap.png new file mode 100644 index 0000000000000000000000000000000000000000..27563a6b1785e25b2d6b06c2714daf5706e9daa4 GIT binary patch literal 1062 zcmaJ=O-vI(7~P~M5DfGni9e@t@nE9eo$U{8H?3H@MVe4-N+T#2m))V=!0xQO11%iX zh!+zNN<3-f#TYaOV&Z`qqlA-s(1fFg0}>4;7z`wMGSt~ZiwEl_v-6Yp-uJ$5zPXj| zJ=ffHtchWm=47{&p|g(;ccY8`ufA>gNT;JDF+lq8Fe%6uVqz*DLLjNjIg~-NI&tMa ziZF}|XxRZWkm?Z?taGx1;flIR*$fluD4Mb|f(RHwIn9W&KVL1dKvSb^e;@@@W*p_U z?nw*vP4;G$$q^;2vK?nYq$pAW9T6E6^-;qXi&3_sE7G-d%(I{ZAtOI7dXM^4+ev$ffovphhARrdW4|p^NJ9Hy^p2QEOl7SNL_oe=q}3U2{A>U zFBA$~!N*}M#|zQZJ%2KDhDd=WR z*0A@=L<`0jWs?^;=%iEyrc(ch>Us@rlMLGT`%hszJ7FR|gKRuzDfHro+ni9Q7`Kp2 zu$9Glv|7b<9usWmu?gaR0no1*DlXU+bSfn#4V%b@f|62{rF>4)RI$?=f-oKq`eS}U z5E3xf3H_4S?}uH%P*C#4s$2;xV>&WOm8vvB4=#LtGCQ)i*zjqy<>pr8o~Ay=Ei=#WTgPv2WRuNLqq&#K!|s`P7wtYhaU>GlUh`*PLv`VoD=Zs#4(&A9J3khGzxnXuAY_hmuB}VyP3QeH$waR- I*LnHIA1nA_p#T5? literal 0 HcmV?d00001 diff --git a/public/css/styles.css b/public/css/styles.css index 26c2f8e6a..c736e2ebf 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -142,6 +142,9 @@ select { color:#969696; padding-right:12px; } +.text-row.rebroadcast, #master-panel .text-row.rebroadcast { + color:#969696; +} .now-playing-info { height:25px; background:#3a3a3a url(images/playinfo_bg.png) repeat-x 0 0; @@ -157,10 +160,6 @@ select { overflow:hidden; margin-bottom:3px; } -.now-playing-info .time-flow { - float:right; - margin-right:6px; -} .time-elapsed { color:#9b9b9b; padding-right:6px; @@ -443,7 +442,7 @@ dl.inline-list dd { .datatable tr.odd.selected td { background-color: #c5deeb; } -.datatable tr:hover td { +.datatable tr.odd:hover td, .datatable tr.even:hover td { background-color: #95d5f7 !important; } @@ -1198,10 +1197,12 @@ button, input { height:25px; margin-right:6px } -.button-bar-top .input_text.hasDatepicker { +.button-bar-top .input_text.hasDatepicker, .input_text.hasDatepicker { background:url(images/input_with_calendar_bg.png) no-repeat right 0; } - +.input_text.hasTimepicker { + background:url(images/input_with_time_bg.png) no-repeat right 0; +} ul.errors { display:block; clear:left; @@ -1298,8 +1299,8 @@ ul.errors li { } /*---//////////////////// NOW PLAYING COLORS ////////////////////---*/ -.playing-song { - background-color:#ff753c; +.playing-song, .datatable tr.playing-song:hover td { + background-color:#ff753c !important; } .playing-list { background-color:#b0dcf2; @@ -1307,9 +1308,15 @@ ul.errors li { .odd.playing-list { background-color:#bfe5f8; } -.gap { - background-color:#da5454; +.gap, .datatable tr.gap:hover td { + background-color:#da5454 !important; } +.group, tr td.group { + background-color:#0aa2be; + color:#FFF; +} + + /*---//////////////////// END NOW PLAYING COLORS ////////////////////---*/ .icon-link, .ui-widget-content a.icon-link { color: #646464; @@ -1412,4 +1419,62 @@ ul.errors li { } .gray-logo { margin:5px 0 0 20px; -} \ No newline at end of file +} +.formrow-repeat { + list-style-type:none; + margin:0; + padding:0; +} +.formrow-repeat li { + list-style-type:none; + margin:0 0 7px 0; + padding:0; + height:26px; + display:block; +} +.formrow-repeat li .ui-button-icon-only { + width:1.8em; +} +.formrow-repeat li .ui-button-icon-only .ui-button-text, .formrow-repeat li .ui-button-icons-only .ui-button-text { + padding: 3px 3px 4px; +} + +.formrow-repeat li .ui-button-icon-only .ui-icon { + left: 48%; + margin-top: -9px; + position: absolute; + top: 50%; +} +.formrow-repeat li .ui-button .ui-button-text { + display: block; + line-height: 110%; +} +.formrow-repeat li .inline-text { + color: #666666; + padding: 0 6px 0 0; +} +.formrow-repeat li .input_text, .formrow-repeat li .input_select { + margin-right:6px; +} +.formrow-repeat li .hasDatepicker, .formrow-repeat li .input_select { + width:160px; +} +.formrow-repeat li .hasTimepicker { + width:80px; +} +.recording-show { + float: right; + background:url(images/record_icon.png) no-repeat 0 0; + width:23px; + height:23px; +} + +.datatable td .info-icon { + margin:-4px 3px -3px 0; + float:right; +} + +.time-flow { + float:right; + margin-right:4px; +} diff --git a/public/js/playlist/nowplayingdatagrid.js b/public/js/playlist/nowplayingdatagrid.js index 9d4151e2f..33e077a19 100644 --- a/public/js/playlist/nowplayingdatagrid.js +++ b/public/js/playlist/nowplayingdatagrid.js @@ -50,6 +50,14 @@ function notifyShowStart(show){ updateDataTable(); } +function statusColumn(obj) { + var sReturn = obj.aData[ obj.iDataColumn ]; + if ( sReturn == "x" ) { + sReturn = ''; + } + return sReturn; +} + var columns = [{"sTitle": "type", "bVisible":false}, {"sTitle":"Date"}, {"sTitle":"Start"}, @@ -60,6 +68,7 @@ var columns = [{"sTitle": "type", "bVisible":false}, {"sTitle":"Album"}, {"sTitle":"Playlist"}, {"sTitle":"Show"}, + {"sTitle":"Status", "fnRender":statusColumn}, {"sTitle":"instance_id", "bVisible":false}]; function getDateString(){ From a947306222f3ea928dd41e2c2f12664f1f1b73dd Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 11 Mar 2011 13:56:13 -0500 Subject: [PATCH 6/7] CC-2002 GUI changes done --- application/models/Shows.php | 2 +- .../views/scripts/partialviews/header.phtml | 16 ++++++++++------ public/css/images/record_icon.png | Bin 0 -> 1648 bytes public/js/playlist/playlist.js | 6 +++++- 4 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 public/css/images/record_icon.png diff --git a/application/models/Shows.php b/application/models/Shows.php index c36a987b2..976bb253f 100644 --- a/application/models/Shows.php +++ b/application/models/Shows.php @@ -737,7 +737,7 @@ class Show_DAL{ $date = $timestamp[0]; $time = $timestamp[1]; - $sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id" + $sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id, si.record" ." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s" ." WHERE si.show_id = s.id" ." AND si.starts <= TIMESTAMP '$timeNow'" diff --git a/application/views/scripts/partialviews/header.phtml b/application/views/scripts/partialviews/header.phtml index 2eea3063c..4905d0d10 100644 --- a/application/views/scripts/partialviews/header.phtml +++ b/application/views/scripts/partialviews/header.phtml @@ -9,13 +9,17 @@
Next:
-
-
 
-
-
-
+
+
 
+
+ + + 00:00 +
+
+
+
-
ON AIR
diff --git a/public/css/images/record_icon.png b/public/css/images/record_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..5e468705b2240448eb7c7993fa006f781ac83ad9 GIT binary patch literal 1648 zcmaJ?drT8|96yF}#(^@>z}Q@l0*WGiQs8cF5onR3?GWo)(K?UzfD_s)?ezhIj{<^* z38JHliZUEn#!CiHK;m$SFab9-#<)}v4aQAiI>$tv?23TAhK1v$6`Z+j>W9HB)K0@q4#JY}YfF-bUq>ymH{7_pHJN-?z(H|nO) zA`vW9>j*@xK!toRh2&E)ObH8uBO@VJL`WbM#$qr8^f0yn5`+i@42TagS#-t>myav- zDpXC(aFuVl(41Vm5mXv7G9T4q22>fT#Z}-`!7w&=E>oV=Mp?8mqsQ-vyb&( zW1hJpy<^|bnwC7w+8$MtUe}VQ&YFLt835iH7V^U+raO(Bdc{k^Tt-JHg5F5Dt8dJ+x-jWeA92T|ite z-_CMQ0vocAwOiX=I-wBWCpo_EKJ$2mop}%4+>Q^(jqIiIWrG=a>Z=OlHxI^=9z=diSBNp9Q6JH1ib`$K=0 z2ijUJ=&9b4(sn=`zsxV++t#di*)sGpyt-!Xp%o<}OHSFf17^{18a+*WxwyqPe9bQ| z$k0<5nq@0~U~U2*Pz!T|mK=^%R~upWp$Z58d$rjixwi}(>UkcGp3&U;aZNCkb0&sC$J}Ld)Y~!Qqg;N z$5^|F4p}*}=$pQeB+EIT{RtJTmnH8Ox+R)*)@a6npe9HzjrKcA6lJG6Mk=jk1xK{i z+zsP->k8xcChKi~6||O0qe>brdnR9$R#tOsXkEThH6Gm)6%R-Bo?kThFwaC&$D$B(}&`lAu-kI3)pova%f-`ljpca2vi*x`Chxp?5xfMG|| z;+G@m6_R7+eXPRMBO|XWn;~qZnkznRllI+6UD+0+E^pv)j-D#m-P3bn)25s_YxKHD zPG6mU4za(?+`9D@Go|S+b!-f0-)MAvdOa%hXX&kCslWemVfnd|iPvW01SYlKulE~Y z{^IYGO*Wf<^0lVVu1s#ej-8j(W-_W$;r 0) + if (currentShow.length > 0){ $('#playlist').text(currentShow[0].name); + var recElem = $('.recording-show'); + currentShow[0].record ? recElem.show(): recElem.hide(); + } + $('#show-length').empty(); if (currentShow.length > 0){ $('#show-length').text(convertDateToHHMM(currentShow[0].showStartPosixTime) + " - " + convertDateToHHMM(currentShow[0].showEndPosixTime)); From cbb534dfda5a905cd6cd097a37596598d62b8fc9 Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 11 Mar 2011 13:59:20 -0500 Subject: [PATCH 7/7] CC-2057 -database tables to drop are generated dynamically --- install/airtime-install.php | 1 + install/airtime-uninstall.php | 153 ++++------------------------------ install/installInit.php | 6 ++ 3 files changed, 21 insertions(+), 139 deletions(-) diff --git a/install/airtime-install.php b/install/airtime-install.php index 2c47b65c3..984928e74 100644 --- a/install/airtime-install.php +++ b/install/airtime-install.php @@ -41,6 +41,7 @@ installPostgresScriptingLanguage(); echo "* Creating Database Tables".PHP_EOL; createAirtimeDatabaseTables(); +doctrineMigrateTables(__DIR__); echo "* Storage Directory Setup".PHP_EOL; storageDirectorySetup($CC_CONFIG); diff --git a/install/airtime-uninstall.php b/install/airtime-uninstall.php index 4e52f8dcf..5f425610d 100644 --- a/install/airtime-uninstall.php +++ b/install/airtime-uninstall.php @@ -22,15 +22,6 @@ checkIfRoot(); echo "******************************* Uninstall Begin ********************************".PHP_EOL; - - - -function airtime_uninstall_delete_files($p_path) -{ - $command = "rm -rf $p_path"; - exec($command); -} - //------------------------------------------------------------------------ // Delete the database // Note: Do not put a call to airtime_db_connect() @@ -48,142 +39,26 @@ $command = "sudo -u postgres dropdb {$CC_CONFIG['dsn']['database']} 2> /dev/null if ($dbDeleteFailed) { echo " * Couldn't delete the database, so deleting all the DB tables...".PHP_EOL; airtime_db_connect(true); - if (!PEAR::isError($CC_DBC)) { - if (airtime_db_table_exists($CC_CONFIG['prefTable'])) { - echo " * Removing database table ".$CC_CONFIG['prefTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['prefTable']; - airtime_install_query($sql, false); - $CC_DBC->dropSequence($CC_CONFIG['prefTable']."_id"); + if (!PEAR::isError($CC_DBC)) { + $sql = "select * from pg_tables where tableowner = 'airtime'"; + $rows = airtime_get_query($sql); + + foreach ($rows as $row){ + $tablename = $row["tablename"]; + echo " * Removing database table $tablename..."; + + if (airtime_db_table_exists($tablename)){ + $sql = "DROP TABLE $tablename CASCADE"; + airtime_install_query($sql, false); + + $CC_DBC->dropSequence($tablename."_id"); + } echo "done.".PHP_EOL; - } else { - echo " * Skipping: database table $CC_CONFIG[prefTable]".PHP_EOL; } } - - if (airtime_db_table_exists($CC_CONFIG['transTable'])) { - echo " * Removing database table ".$CC_CONFIG['transTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['transTable']; - airtime_install_query($sql, false); - - $CC_DBC->dropSequence($CC_CONFIG['transTable']."_id"); - echo "done.".PHP_EOL; - } else { - echo " * Skipping: database table $CC_CONFIG[transTable]".PHP_EOL; - } - - if (airtime_db_table_exists($CC_CONFIG['filesTable'])) { - echo " * Removing database table ".$CC_CONFIG['filesTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['filesTable']." CASCADE"; - airtime_install_query($sql); - $CC_DBC->dropSequence($CC_CONFIG['filesTable']."_id"); - - } else { - echo " * Skipping: database table $CC_CONFIG[filesTable]".PHP_EOL; - } - - if (airtime_db_table_exists($CC_CONFIG['playListTable'])) { - echo " * Removing database table ".$CC_CONFIG['playListTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['playListTable']." CASCADE"; - airtime_install_query($sql); - $CC_DBC->dropSequence($CC_CONFIG['playListTable']."_id"); - - } else { - echo " * Skipping: database table $CC_CONFIG[playListTable]".PHP_EOL; - } - - if (airtime_db_table_exists($CC_CONFIG['playListContentsTable'])) { - echo " * Removing database table ".$CC_CONFIG['playListContentsTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['playListContentsTable']; - airtime_install_query($sql); - $CC_DBC->dropSequence($CC_CONFIG['playListContentsTable']."_id"); - - } else { - echo " * Skipping: database table $CC_CONFIG[playListContentsTable]".PHP_EOL; - } - - if (airtime_db_table_exists($CC_CONFIG['accessTable'])) { - echo " * Removing database table ".$CC_CONFIG['accessTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['accessTable']; - airtime_install_query($sql); - } else { - echo " * Skipping: database table $CC_CONFIG[accessTable]".PHP_EOL; - } - - if (airtime_db_table_exists($CC_CONFIG['permTable'])) { - echo " * Removing database table ".$CC_CONFIG['permTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['permTable']; - airtime_install_query($sql, false); - - $CC_DBC->dropSequence($CC_CONFIG['permTable']."_id"); - echo "done.".PHP_EOL; - } else { - echo " * Skipping: database table $CC_CONFIG[permTable]".PHP_EOL; - } - - if (airtime_db_table_exists($CC_CONFIG['sessTable'])) { - echo " * Removing database table ".$CC_CONFIG['sessTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['sessTable']; - airtime_install_query($sql); - } else { - echo " * Skipping: database table $CC_CONFIG[sessTable]".PHP_EOL; - } - - if (airtime_db_table_exists($CC_CONFIG['subjTable'])) { - echo " * Removing database table ".$CC_CONFIG['subjTable']."..."; - $CC_DBC->dropSequence($CC_CONFIG['subjTable']."_id"); - - $sql = "DROP TABLE ".$CC_CONFIG['subjTable']." CASCADE"; - airtime_install_query($sql, false); - - echo "done.".PHP_EOL; - } else { - echo " * Skipping: database table $CC_CONFIG[subjTable]".PHP_EOL; - } - - if (airtime_db_table_exists($CC_CONFIG['smembTable'])) { - echo " * Removing database table ".$CC_CONFIG['smembTable']."..."; - $sql = "DROP TABLE ".$CC_CONFIG['smembTable']; - airtime_install_query($sql, false); - - $CC_DBC->dropSequence($CC_CONFIG['smembTable']."_id"); - echo "done.".PHP_EOL; - } else { - echo " * Skipping: database table $CC_CONFIG[smembTable]".PHP_EOL; - } - - if (airtime_db_table_exists($CC_CONFIG['scheduleTable'])) { - echo " * Removing database table ".$CC_CONFIG['scheduleTable']."..."; - airtime_install_query("DROP TABLE ".$CC_CONFIG['scheduleTable']); - } else { - echo " * Skipping: database table $CC_CONFIG[scheduleTable]".PHP_EOL; - } - - if (airtime_db_table_exists($CC_CONFIG['backupTable'])) { - echo " * Removing database table ".$CC_CONFIG['backupTable']."..."; - airtime_install_query("DROP TABLE ".$CC_CONFIG['backupTable']); - } else { - echo " * Skipping: database table $CC_CONFIG[backupTable]".PHP_EOL; - } } -//Delete Database -//system("dropdb -h localhost -U airtime -W airtime"); -//select * from pg_stat_activity where datname='airtime'; -/* -$rows = airtime_get_query("select procpid from pg_stat_activity where datname='airtime'"); -$rowsCount = count($rows); -for ($i=0; $i<$rowsCount; $i++){ - $command = "kill -2 {$rows[$i]['procpid']}"; - echo $command.PHP_EOL; - system($command); -} -echo "still here!"; -system("dropdb -h localhost -U airtime -W airtime"); -exit; -*/ - - //------------------------------------------------------------------------ // Delete the user //------------------------------------------------------------------------ diff --git a/install/installInit.php b/install/installInit.php index db511c11f..251907cd9 100644 --- a/install/installInit.php +++ b/install/installInit.php @@ -188,3 +188,9 @@ function doctrineMigrateTables($dir){ $command = "php $dir/../library/doctrine/migrations/doctrine-migrations.phar --configuration=$dir/DoctrineMigrations/migrations.xml --db-configuration=$dir/../library/doctrine/migrations/migrations-db.php --no-interaction migrations:migrate"; system($command); } + +function airtime_uninstall_delete_files($p_path) +{ + $command = "rm -rf $p_path"; + exec($command); +}