From 4349dbe4fdd47f3b70fe68695701fb36784237cf Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 13 Sep 2012 16:26:31 -0400 Subject: [PATCH 1/6] Added special handling for wav --- .../media-monitor2/media/monitor/metadata.py | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/python_apps/media-monitor2/media/monitor/metadata.py b/python_apps/media-monitor2/media/monitor/metadata.py index bde17bc45..aef5f8793 100644 --- a/python_apps/media-monitor2/media/monitor/metadata.py +++ b/python_apps/media-monitor2/media/monitor/metadata.py @@ -3,6 +3,9 @@ import mutagen import math import os import copy +import wave +import contextlib +from collections import namedtuple from mutagen.easymp4 import EasyMP4KeyError from media.monitor.exceptions import BadSongFile @@ -43,15 +46,19 @@ airtime2mutagen = { class FakeMutagen(dict): """ - Need this fake mutagen object so that airtime_special functions return a - proper default value instead of throwing an exceptions for files that - mutagen doesn't recognize + Need this fake mutagen object so that airtime_special functions + return a proper default value instead of throwing an exceptions for + files that mutagen doesn't recognize """ + FakeInfo = namedtuple('FakeInfo','length bitrate') def __init__(self,path): self.path = path - self.mime = True - self.info = True + self.mime = [] + self.info = FakeMutagen.FakeInfo(0.0, '') dict.__init__(self) + def set_length(self,l): + old_bitrate = self.info.bitrate + self.info = FakeMutagen.FakeInfo(l, old_bitrate) # Some airtime attributes are special because they must use the mutagen object # itself to calculate the value that they need. The lambda associated with each @@ -204,6 +211,15 @@ class Metadata(Loggable): self.logger.info("Could not get special key %s for %s" % (special_key, fpath)) self.logger.info(str(e)) + + # 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) + # Finally, we "normalize" all the metadata here: self.__metadata = mmp.normalized_metadata(self.__metadata, fpath) # Now we must load the md5: From 8e0f0033095cfce6c4ba93b4dbfab686baa2d943 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 13 Sep 2012 16:28:38 -0400 Subject: [PATCH 2/6] Formatting --- python_apps/media-monitor2/media/monitor/metadata.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python_apps/media-monitor2/media/monitor/metadata.py b/python_apps/media-monitor2/media/monitor/metadata.py index aef5f8793..c8749d48d 100644 --- a/python_apps/media-monitor2/media/monitor/metadata.py +++ b/python_apps/media-monitor2/media/monitor/metadata.py @@ -215,9 +215,9 @@ 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) + frames = f.getnframes() + rate = f.getframerate() + duration = frames/float(rate) full_mutagen.set_length(duration) # Finally, we "normalize" all the metadata here: From 3a0907b93ba496c1c8f0121e58491a0c858d3587 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Thu, 13 Sep 2012 16:47:45 -0400 Subject: [PATCH 3/6] CC-4428: Make sure to remove *_datatable column on upgrade from cc_pref -fixed --- install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql b/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql index ab129de75..71f59a40d 100644 --- a/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql +++ b/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql @@ -1,6 +1,9 @@ DELETE FROM cc_pref WHERE keystr = 'system_version'; INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '2.2.0'); +--DELETE user column order prefs, since the number of columns has increased in 2.2 +DELETE FROM cc_pref where keystr = 'library_datatable'; +DELETE FROM cc_pref where keystr = 'timeline_datatable'; INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_name', 'Airtime!', 'string'); INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_name', '', 'string'); From 0b917f385e9fda24c5df0fc4ce054740e6f6928a Mon Sep 17 00:00:00 2001 From: James Date: Thu, 13 Sep 2012 17:05:40 -0400 Subject: [PATCH 4/6] 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 5/6] 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 6/6] 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() {