Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
denise 2012-09-13 17:11:10 -04:00
commit c35c76351b
4 changed files with 29 additions and 7 deletions

View File

@ -1297,6 +1297,9 @@ SQL;
$i++; $i++;
} }
} }
// check if file exists
$qry->add("file_exists", "true", Criteria::EQUAL);
$qry->addAscendingOrderByColumn('random()'); $qry->addAscendingOrderByColumn('random()');
} }
// construct limit restriction // construct limit restriction

View File

@ -307,6 +307,7 @@ var AIRTIME = (function(AIRTIME){
setCueEvents(); setCueEvents();
setFadeEvents(); setFadeEvents();
setModified(json.modified); setModified(json.modified);
AIRTIME.playlist.validatePlaylistElements();
redrawLib(); redrawLib();
} }
@ -409,8 +410,6 @@ var AIRTIME = (function(AIRTIME){
$pl.delegate(".spl_cue", $pl.delegate(".spl_cue",
{"click": openCueEditor}); {"click": openCueEditor});
mod.validatePlaylistElements();
$pl.delegate(".spl_block_expand", $pl.delegate(".spl_block_expand",
{"click": function(ev){ {"click": function(ev){
@ -773,6 +772,7 @@ var AIRTIME = (function(AIRTIME){
}()); }());
$pl.find("#spl_sortable").sortable(sortableConf); $pl.find("#spl_sortable").sortable(sortableConf);
AIRTIME.playlist.validatePlaylistElements();
} }
mod.fnNew = function() { mod.fnNew = function() {

View File

@ -1,6 +1,9 @@
DELETE FROM cc_pref WHERE keystr = 'system_version'; DELETE FROM cc_pref WHERE keystr = 'system_version';
INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '2.2.0'); 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 ('s1_name', 'Airtime!', 'string');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_name', '', 'string'); INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s2_name', '', 'string');

View File

@ -3,6 +3,9 @@ import mutagen
import math import math
import os import os
import copy import copy
import wave
import contextlib
from collections import namedtuple
from mutagen.easymp4 import EasyMP4KeyError from mutagen.easymp4 import EasyMP4KeyError
from media.monitor.exceptions import BadSongFile from media.monitor.exceptions import BadSongFile
@ -43,15 +46,19 @@ airtime2mutagen = {
class FakeMutagen(dict): class FakeMutagen(dict):
""" """
Need this fake mutagen object so that airtime_special functions return a Need this fake mutagen object so that airtime_special functions
proper default value instead of throwing an exceptions for files that return a proper default value instead of throwing an exceptions for
mutagen doesn't recognize files that mutagen doesn't recognize
""" """
FakeInfo = namedtuple('FakeInfo','length bitrate')
def __init__(self,path): def __init__(self,path):
self.path = path self.path = path
self.mime = True self.mime = []
self.info = True self.info = FakeMutagen.FakeInfo(0.0, '')
dict.__init__(self) 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 # 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 # 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" % self.logger.info("Could not get special key %s for %s" %
(special_key, fpath)) (special_key, fpath))
self.logger.info(str(e)) 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: # Finally, we "normalize" all the metadata here:
self.__metadata = mmp.normalized_metadata(self.__metadata, fpath) self.__metadata = mmp.normalized_metadata(self.__metadata, fpath)
# Now we must load the md5: # Now we must load the md5: