20 lines
694 B
Ruby
20 lines
694 B
Ruby
class Release < ActiveRecord::Base
|
|
set_table_name 'musicbrainz.bh_release'
|
|
def self.getReleases(release_groups, group_by_release = false, only_official = false)
|
|
Release.all(:conditions => ['release_group IN(?) AND '. (only_official ? 'AND release_tyepe=1' : 'release_type IS NOT NULL'), release_groups], :order => 'date ASC, id ASC')
|
|
|
|
if ($group_by_release) {
|
|
$g_releases = array();
|
|
foreach ($releases as $release) {
|
|
if (!isset($g_releases[$release['release_group']])) {
|
|
$g_releases[$release['release_group']] = array();
|
|
}
|
|
$g_releases[$release['release_group']][$release['id']] = $release;
|
|
}
|
|
return $g_releases;
|
|
} else {
|
|
return $releases;
|
|
}
|
|
end
|
|
end
|