From 12e27e659a72c94c4dc666e53951f7597ec9424f Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 13 Sep 2012 17:03:05 -0400 Subject: [PATCH 01/18] Extracted read_wave_duration out of code --- python_apps/media-monitor2/media/monitor/metadata.py | 8 +------- python_apps/media-monitor2/media/monitor/pure.py | 9 +++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/python_apps/media-monitor2/media/monitor/metadata.py b/python_apps/media-monitor2/media/monitor/metadata.py index c8749d48d..013fd8a27 100644 --- a/python_apps/media-monitor2/media/monitor/metadata.py +++ b/python_apps/media-monitor2/media/monitor/metadata.py @@ -3,8 +3,6 @@ import mutagen import math import os import copy -import wave -import contextlib from collections import namedtuple from mutagen.easymp4 import EasyMP4KeyError @@ -214,11 +212,7 @@ class Metadata(Loggable): # Hickity Hackity for .wav files. Properly do this later if mmp.extension(fpath) == 'wav': - with contextlib.closing(wave.open(fpath,'r')) as f: - frames = f.getnframes() - rate = f.getframerate() - duration = frames/float(rate) - full_mutagen.set_length(duration) + full_mutagen.set_length(mmp.read_wave_duration(fpath)) # Finally, we "normalize" all the metadata here: self.__metadata = mmp.normalized_metadata(self.__metadata, fpath) diff --git a/python_apps/media-monitor2/media/monitor/pure.py b/python_apps/media-monitor2/media/monitor/pure.py index 5a0cf9b90..72f0f5030 100644 --- a/python_apps/media-monitor2/media/monitor/pure.py +++ b/python_apps/media-monitor2/media/monitor/pure.py @@ -3,6 +3,8 @@ import copy import subprocess import os import math +import wave +import contextlib import shutil import re import sys @@ -97,6 +99,13 @@ def is_airtime_recorded(md): if not 'MDATA_KEY_CREATOR' in md: return False return md['MDATA_KEY_CREATOR'] == u'Airtime Show Recorder' +def read_wave_duration(path): + with contextlib.closing(wave.open(path,'r')) as f: + frames = f.getnframes() + rate = f.getframerate() + duration = frames/float(rate) + return duration + def clean_empty_dirs(path): """ walks path and deletes every empty directory it finds From 0b917f385e9fda24c5df0fc4ce054740e6f6928a Mon Sep 17 00:00:00 2001 From: James Date: Thu, 13 Sep 2012 17:05:40 -0400 Subject: [PATCH 02/18] CC-4430: Block: Please don't count the removed files in when calculating how many files meet the criteria - fixed --- airtime_mvc/application/models/Block.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index 93ada2b34..c40785d57 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -1297,6 +1297,9 @@ SQL; $i++; } } + + // check if file exists + $qry->add("file_exists", "true", Criteria::EQUAL); $qry->addAscendingOrderByColumn('random()'); } // construct limit restriction From 43503475fd8b29b1a4f6bcf51343674f1d01235a Mon Sep 17 00:00:00 2001 From: James Date: Thu, 13 Sep 2012 17:06:44 -0400 Subject: [PATCH 03/18] CC-4430: Block: Please don't count the removed files in when calculating how many files meet the criteria - CRLF fix --- airtime_mvc/application/models/Block.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index c40785d57..0c349d9f4 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -1297,8 +1297,8 @@ SQL; $i++; } } - - // check if file exists + + // check if file exists $qry->add("file_exists", "true", Criteria::EQUAL); $qry->addAscendingOrderByColumn('random()'); } From d93fcec490067e8c49140511c726fb8c867a3b96 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 13 Sep 2012 17:09:10 -0400 Subject: [PATCH 04/18] CC-4424: Clicking "edit" on playlist allows you to preview tracks that should be disabled - fixed --- airtime_mvc/public/js/airtime/library/spl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index 4cc478f6a..11d5221c6 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -307,6 +307,7 @@ var AIRTIME = (function(AIRTIME){ setCueEvents(); setFadeEvents(); setModified(json.modified); + AIRTIME.playlist.validatePlaylistElements(); redrawLib(); } @@ -409,8 +410,6 @@ var AIRTIME = (function(AIRTIME){ $pl.delegate(".spl_cue", {"click": openCueEditor}); - - mod.validatePlaylistElements(); $pl.delegate(".spl_block_expand", {"click": function(ev){ @@ -773,6 +772,7 @@ var AIRTIME = (function(AIRTIME){ }()); $pl.find("#spl_sortable").sortable(sortableConf); + AIRTIME.playlist.validatePlaylistElements(); } mod.fnNew = function() { From 8f48544bb7a5862c359596df78f3096fb2ecd653 Mon Sep 17 00:00:00 2001 From: denise Date: Thu, 13 Sep 2012 17:10:38 -0400 Subject: [PATCH 05/18] -implemented UI changes for Now Playing page --- .../views/scripts/form/showbuilder.phtml | 6 +- .../views/scripts/showbuilder/index.phtml | 6 +- airtime_mvc/public/css/media_library.css | 2 +- .../public/js/airtime/buttons/buttons.js | 80 +- .../public/js/airtime/showbuilder/builder.js | 93 +- .../js/airtime/showbuilder/main_builder.js | 2 +- .../js/datatables/plugin/dataTables.ColVis.js | 1743 +++++++++-------- .../plugin/dataTables.ColVis_orig.js | 995 ++++++++++ 8 files changed, 1969 insertions(+), 958 deletions(-) create mode 100644 airtime_mvc/public/js/datatables/plugin/dataTables.ColVis_orig.js diff --git a/airtime_mvc/application/views/scripts/form/showbuilder.phtml b/airtime_mvc/application/views/scripts/form/showbuilder.phtml index ddca06770..877f28849 100644 --- a/airtime_mvc/application/views/scripts/form/showbuilder.phtml +++ b/airtime_mvc/application/views/scripts/form/showbuilder.phtml @@ -2,9 +2,9 @@ element->getElement('sb_time_start'); ?> element->getElement('sb_date_end'); ?> element->getElement('sb_time_end'); ?> -
- -
+ + + Find Shows
diff --git a/airtime_mvc/application/views/scripts/showbuilder/index.phtml b/airtime_mvc/application/views/scripts/showbuilder/index.phtml index 6e708004c..f159ba99b 100644 --- a/airtime_mvc/application/views/scripts/showbuilder/index.phtml +++ b/airtime_mvc/application/views/scripts/showbuilder/index.phtml @@ -11,9 +11,9 @@
disableLib && !$this->showLib):?> -
- -
+ + Schedule files + sb_form; ?>
diff --git a/airtime_mvc/public/css/media_library.css b/airtime_mvc/public/css/media_library.css index 3b0db5046..06120698d 100644 --- a/airtime_mvc/public/css/media_library.css +++ b/airtime_mvc/public/css/media_library.css @@ -146,7 +146,7 @@ td.library_bitrate { } -.fg-toolbar .btn-toolbar {margin: 6px 5px 6px 2px;} +.fg-toolbar .btn-toolbar {margin: 6px 5px -6px 5px;} /* ///////////////////// ADVANCED SEARCH ///////////////////// */ diff --git a/airtime_mvc/public/js/airtime/buttons/buttons.js b/airtime_mvc/public/js/airtime/buttons/buttons.js index 7af88e352..23a904001 100644 --- a/airtime_mvc/public/js/airtime/buttons/buttons.js +++ b/airtime_mvc/public/js/airtime/buttons/buttons.js @@ -1,39 +1,45 @@ -var AIRTIME = (function(AIRTIME){ - var mod, - DEFAULT_CLASS = 'ui-button ui-state-default', - DISABLED_CLASS = 'ui-state-disabled'; - - if (AIRTIME.button === undefined) { - AIRTIME.button = {}; - } - mod = AIRTIME.button; - - mod.isDisabled = function(c) { - var button = $("."+c); - - if (button.hasClass(DISABLED_CLASS)) { - return true; - } - - return false; - }; - - mod.enableButton = function(c) { - var button = $("."+c); - - if (button.hasClass(DISABLED_CLASS)) { - button.removeClass(DISABLED_CLASS); - } - }; +var AIRTIME = (function(AIRTIME) { + var mod, DEFAULT_CLASS = 'ui-button ui-state-default', DISABLED_CLASS = 'ui-state-disabled'; + + if (AIRTIME.button === undefined) { + AIRTIME.button = {}; + } + mod = AIRTIME.button; + + mod.isDisabled = function(c) { + var button = $("." + c); + + if (button.hasClass(DISABLED_CLASS)) { + return true; + } + + return false; + }; + + mod.enableButton = function(c, useParent) { + if (useParent) { + var button = $("." + c).parent(); + } else { + var button = $("." + c); + } + + if (button.hasClass(DISABLED_CLASS)) { + button.removeClass(DISABLED_CLASS); + } + }; + + mod.disableButton = function(c, useParent) { + if (useParent) { + var button = $("." + c).parent(); + } else { + var button = $("." + c); + } + + if (!button.hasClass(DISABLED_CLASS)) { + button.addClass(DISABLED_CLASS); + } + }; + + return AIRTIME; - mod.disableButton = function(c) { - var button = $("."+c); - - if (!button.hasClass(DISABLED_CLASS)) { - button.addClass(DISABLED_CLASS); - } - }; - - return AIRTIME; - }(AIRTIME || {})); \ No newline at end of file diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index 8af595775..942bfbf0d 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -66,10 +66,10 @@ var AIRTIME = (function(AIRTIME){ var $selectable = $sbTable.find("tbody").find("input:checkbox"); if ($selectable.length !== 0) { - AIRTIME.button.enableButton("sb-button-select"); + AIRTIME.button.enableButton("btn-group #timeline-select", true); } else { - AIRTIME.button.disableButton("sb-button-select"); + AIRTIME.button.disableButton("btn-group #timeline-select", true); } }; @@ -77,10 +77,10 @@ var AIRTIME = (function(AIRTIME){ var $over = $sbTable.find(".sb-over.sb-allowed"); if ($over.length !== 0) { - AIRTIME.button.enableButton("sb-button-trim"); + AIRTIME.button.enableButton("icon-cut", true); } else { - AIRTIME.button.disableButton("sb-button-trim"); + AIRTIME.button.disableButton("icon-cut", true); } }; @@ -88,10 +88,10 @@ var AIRTIME = (function(AIRTIME){ var $selected = $sbTable.find("tbody").find("input:checkbox").filter(":checked"); if ($selected.length !== 0) { - AIRTIME.button.enableButton("sb-button-delete"); + AIRTIME.button.enableButton("icon-trash", true); } else { - AIRTIME.button.disableButton("sb-button-delete"); + AIRTIME.button.disableButton("icon-trash", true); } }; @@ -99,10 +99,10 @@ var AIRTIME = (function(AIRTIME){ var $current = $sbTable.find("."+NOW_PLAYING_CLASS); if ($current.length !== 0) { - AIRTIME.button.enableButton("sb-button-current"); + AIRTIME.button.enableButton("icon-step-forward", true); } else { - AIRTIME.button.disableButton("sb-button-current"); + AIRTIME.button.disableButton("icon-step-forward", true); } }; @@ -113,10 +113,10 @@ var AIRTIME = (function(AIRTIME){ userType = localStorage.getItem('user-type'); if ($current.length !== 0 && (userType === 'A' || userType === 'P')) { - AIRTIME.button.enableButton("sb-button-cancel"); + AIRTIME.button.enableButton("icon-ban-circle", true); } else { - AIRTIME.button.disableButton("sb-button-cancel"); + AIRTIME.button.disableButton("icon-ban-circle", true); } }; @@ -333,15 +333,15 @@ var AIRTIME = (function(AIRTIME){ /* * Icon hover states in the toolbar. */ - $sbContent.on("mouseenter", ".fg-toolbar ul li", function(ev) { + $sbContent.on("mouseenter", "#timeline-select .dropdown-toggle", function(ev) { $el = $(this); if (!$el.hasClass("ui-state-disabled")) { $el.addClass("ui-state-hover"); - $("#show_builder .ui-icon-document-b").contextMenu(true); + $("#timeline-select .caret").contextMenu(true); } else { - $("#show_builder .ui-icon-document-b").contextMenu(false); + $("#timeline-select .caret").contextMenu(false); } }); $sbContent.on("mouseleave", ".fg-toolbar ul li", function(ev) { @@ -958,37 +958,44 @@ var AIRTIME = (function(AIRTIME){ //start setup of the builder toolbar. $toolbar = $(".sb-content .fg-toolbar"); + + $menu = $("
"); + $menu.append("
" + + "" + + "" + + "
") + .append("
" + + "
") + .append("
" + + "
") + .append("
" + + "
") + .append("
" + + "
"); + + $toolbar.append($menu); + $menu = undefined; - $ul = $("