diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index 93ada2b34..0c349d9f4 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 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() { 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'); diff --git a/python_apps/media-monitor2/media/monitor/metadata.py b/python_apps/media-monitor2/media/monitor/metadata.py index bde17bc45..c8749d48d 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: