CC-430: Audio normalization (Replaygain Support)

-values are now written through to database
This commit is contained in:
Martin Konecny 2012-07-15 22:13:04 -04:00
parent 39760f8494
commit 583695f98c
7 changed files with 13 additions and 12 deletions

View file

@ -949,10 +949,14 @@ class ApiController extends Zend_Controller_Action
{ {
// disable the view and the layout // disable the view and the layout
$this->view->layout()->disableLayout(); $this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$dir_id = $this->_getParam('dir_id'); $dir_id = $this->_getParam('dir_id');
//connect to db and get get sql //connect to db and get get sql
$this->view->rows = Application_Model_StoredFile::listAllFiles2($dir_id, 100); $rows = Application_Model_StoredFile::listAllFiles2($dir_id, 100);
echo json_encode($rows);
} }
public function updateReplayGainValueAction() public function updateReplayGainValueAction()
@ -961,6 +965,8 @@ class ApiController extends Zend_Controller_Action
// disable layout // disable layout
$this->view->layout()->disableLayout(); $this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest(); $request = $this->getRequest();
$data = json_decode($request->getParam('data')); $data = json_decode($request->getParam('data'));

View file

@ -615,7 +615,7 @@ class Application_Model_Schedule
'start' => $start, 'start' => $start,
'end' => Application_Model_Schedule::AirtimeTimeToPypoTime($item["end"]), 'end' => Application_Model_Schedule::AirtimeTimeToPypoTime($item["end"]),
'show_name' => $showName, 'show_name' => $showName,
'replay_gain' => $item["replay_gain"] 'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"]
); );
} }

View file

@ -974,7 +974,8 @@ Logging::log("getting media! - 2");
$sql = "SELECT id, filepath as fp" $sql = "SELECT id, filepath as fp"
." FROM CC_FILES" ." FROM CC_FILES"
." WHERE directory = $dir_id" ." WHERE directory = $dir_id"
." AND file_exists = 'TRUE'"; ." AND file_exists = 'TRUE'"
." AND replay_gain is NULL";
if (!is_null($limit) && is_int($limit)) { if (!is_null($limit) && is_int($limit)) {
$sql .= " LIMIT $limit"; $sql .= " LIMIT $limit";
} }

View file

@ -1,3 +0,0 @@
<?php
echo json_encode($this->rows);

View file

@ -98,7 +98,7 @@
<column name="soundcloud_error_msg" phpName="DbSoundcloudErrorMsg" type="VARCHAR" size="512" required="false"/> <column name="soundcloud_error_msg" phpName="DbSoundcloudErrorMsg" type="VARCHAR" size="512" required="false"/>
<column name="soundcloud_link_to_file" phpName="DbSoundcloudLinkToFile" type="VARCHAR" size="4096" required="false"/> <column name="soundcloud_link_to_file" phpName="DbSoundcloudLinkToFile" type="VARCHAR" size="4096" required="false"/>
<column name="soundcloud_upload_time" phpName="DbSoundCloundUploadTime" type="TIMESTAMP" size="6" required="false"/> <column name="soundcloud_upload_time" phpName="DbSoundCloundUploadTime" type="TIMESTAMP" size="6" required="false"/>
<column name="replay_gain" phpName="DbReplayGain" type="VARCHAR" size="16" required="false" defaultValue="0"/> <column name="replay_gain" phpName="DbReplayGain" type="VARCHAR" size="16" required="false"/>
<foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey"> <foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey">
<reference local="editedby" foreign="id"/> <reference local="editedby" foreign="id"/>
</foreign-key> </foreign-key>

View file

@ -6,4 +6,4 @@ flac
vorbis-tools vorbis-tools
calculate Replay Gain dB on upgrade. calculate Replay Gain dB on upgrade: the default value should be NULL.

View file

@ -5,9 +5,6 @@ import os
import logging import logging
import json import json
import sys
sys.path.append('/home/martin/workspace/airtime/python_apps/media-monitor2/')
from api_clients import api_client from api_clients import api_client
from media.update import replaygain from media.update import replaygain
@ -16,7 +13,7 @@ class ReplayGainUpdater(Thread):
""" """
The purpose of the class is to query the server for a list of files which do not have a ReplayGain The purpose of the class is to query the server for a list of files which do not have a ReplayGain
value calculated. This class will iterate over the list calculate the values, update the server and value calculated. This class will iterate over the list calculate the values, update the server and
repeat the process until the the server reports there are no files left. repeat the process until the server reports there are no files left.
This class will see heavy activity right after a 2.1->2.2 upgrade since 2.2 introduces ReplayGain This class will see heavy activity right after a 2.1->2.2 upgrade since 2.2 introduces ReplayGain
normalization. A fresh install of Airtime 2.2 will see this class not used at all since a file normalization. A fresh install of Airtime 2.2 will see this class not used at all since a file