CC-4380: Show ReplayGain value in the Library page

- temp commit
This commit is contained in:
James 2012-09-10 12:35:32 -04:00
parent e5de4f560d
commit 4d3c624607
6 changed files with 25 additions and 14 deletions

View file

@ -652,7 +652,7 @@ class Application_Model_StoredFile
$displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length", $displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length",
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url", "year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
"bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime", "bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime",
"language", "filepath","owner","conductor" "language", "filepath", "owner", "conductor", "replay_gain"
); );
//Logging::info($datatables); //Logging::info($datatables);

View file

@ -100,7 +100,7 @@ class CcFilesTableMap extends TableMap {
$this->addColumn('SOUNDCLOUD_ERROR_MSG', 'DbSoundcloudErrorMsg', 'VARCHAR', false, 512, null); $this->addColumn('SOUNDCLOUD_ERROR_MSG', 'DbSoundcloudErrorMsg', 'VARCHAR', false, 512, null);
$this->addColumn('SOUNDCLOUD_LINK_TO_FILE', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 4096, null); $this->addColumn('SOUNDCLOUD_LINK_TO_FILE', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 4096, null);
$this->addColumn('SOUNDCLOUD_UPLOAD_TIME', 'DbSoundCloundUploadTime', 'TIMESTAMP', false, 6, null); $this->addColumn('SOUNDCLOUD_UPLOAD_TIME', 'DbSoundCloundUploadTime', 'TIMESTAMP', false, 6, null);
$this->addColumn('REPLAY_GAIN', 'DbReplayGain', 'VARCHAR', false, 16, null); $this->addColumn('REPLAY_GAIN', 'DbReplayGain', 'NUMERIC', false, null, null);
$this->addForeignKey('OWNER_ID', 'DbOwnerId', 'INTEGER', 'cc_subjs', 'ID', false, null, null); $this->addForeignKey('OWNER_ID', 'DbOwnerId', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
// validators // validators
} // initialize() } // initialize()

View file

@ -1892,20 +1892,29 @@ abstract class BaseCcFilesQuery extends ModelCriteria
/** /**
* Filter the query on the replay_gain column * Filter the query on the replay_gain column
* *
* @param string $dbReplayGain The value to use as filter. * @param string|array $dbReplayGain The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE) * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return CcFilesQuery The current query, for fluid interface * @return CcFilesQuery The current query, for fluid interface
*/ */
public function filterByDbReplayGain($dbReplayGain = null, $comparison = null) public function filterByDbReplayGain($dbReplayGain = null, $comparison = null)
{ {
if (null === $comparison) { if (is_array($dbReplayGain)) {
if (is_array($dbReplayGain)) { $useMinMax = false;
if (isset($dbReplayGain['min'])) {
$this->addUsingAlias(CcFilesPeer::REPLAY_GAIN, $dbReplayGain['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbReplayGain['max'])) {
$this->addUsingAlias(CcFilesPeer::REPLAY_GAIN, $dbReplayGain['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbReplayGain)) {
$dbReplayGain = str_replace('*', '%', $dbReplayGain);
$comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(CcFilesPeer::REPLAY_GAIN, $dbReplayGain, $comparison); return $this->addUsingAlias(CcFilesPeer::REPLAY_GAIN, $dbReplayGain, $comparison);

View file

@ -74,7 +74,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"/> <column name="replay_gain" phpName="DbReplayGain" type="NUMERIC" required="false"/>
<column name="owner_id" phpName="DbOwnerId" type="INTEGER" required="false"/> <column name="owner_id" phpName="DbOwnerId" type="INTEGER" required="false"/>
<foreign-key foreignTable="cc_subjs" phpName="FkOwner" name="cc_files_owner_fkey"> <foreign-key foreignTable="cc_subjs" phpName="FkOwner" name="cc_files_owner_fkey">
<reference local="owner_id" foreign="id"/> <reference local="owner_id" foreign="id"/>

View file

@ -92,7 +92,7 @@ CREATE TABLE "cc_files"
"soundcloud_error_msg" VARCHAR(512), "soundcloud_error_msg" VARCHAR(512),
"soundcloud_link_to_file" VARCHAR(4096), "soundcloud_link_to_file" VARCHAR(4096),
"soundcloud_upload_time" TIMESTAMP(6), "soundcloud_upload_time" TIMESTAMP(6),
"replay_gain" VARCHAR(16), "replay_gain" NUMERIC,
"owner_id" INTEGER, "owner_id" INTEGER,
PRIMARY KEY ("id") PRIMARY KEY ("id")
); );
@ -633,7 +633,7 @@ CREATE TABLE "cc_webstream"
"id" serial NOT NULL, "id" serial NOT NULL,
"name" VARCHAR(255) NOT NULL, "name" VARCHAR(255) NOT NULL,
"description" VARCHAR(255) NOT NULL, "description" VARCHAR(255) NOT NULL,
"url" VARCHAR(255) NOT NULL, "url" VARCHAR(512) NOT NULL,
"length" interval default '00:00:00' NOT NULL, "length" interval default '00:00:00' NOT NULL,
"creator_id" INTEGER NOT NULL, "creator_id" INTEGER NOT NULL,
"mtime" TIMESTAMP(6) NOT NULL, "mtime" TIMESTAMP(6) NOT NULL,

View file

@ -36,7 +36,8 @@ var AIRTIME = (function(AIRTIME) {
"track_title" : "s", "track_title" : "s",
"track_num" : "n", "track_num" : "n",
"year" : "n", "year" : "n",
"owner" : "s" "owner" : "s",
"replay_gain" : "n"
}; };
if (AIRTIME.library === undefined) { if (AIRTIME.library === undefined) {
@ -414,7 +415,8 @@ var AIRTIME = (function(AIRTIME) {
/* Mime */ { "sTitle" : "Mime" , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" } , /* Mime */ { "sTitle" : "Mime" , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" } ,
/* Language */ { "sTitle" : "Language" , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } , /* Language */ { "sTitle" : "Language" , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } ,
/* Owner */ { "sTitle" : "Owner" , "mDataProp" : "owner" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } , /* Owner */ { "sTitle" : "Owner" , "mDataProp" : "owner" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } ,
/* Conductor */ { "sTitle" : "Conductor" , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" } /* Conductor */ { "sTitle" : "Conductor" , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" },
/* Replay Gain */ { "sTitle" : "Replay Gain" , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" }
], ],
"bProcessing": true, "bProcessing": true,