diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-08-16 15:37:31 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-08-16 15:37:31 +0000 |
commit | ce094e4d95762791de7fa32b0a83ab0da7254d70 (patch) | |
tree | de1bade5cf1d376d0ad12b0578a197700bbbfa62 | |
parent | aeeb56a33bc863e3aea6f7e9fc96495492cbb2b6 (diff) | |
download | ampache-ce094e4d95762791de7fa32b0a83ab0da7254d70.tar.gz ampache-ce094e4d95762791de7fa32b0a83ab0da7254d70.tar.bz2 ampache-ce094e4d95762791de7fa32b0a83ab0da7254d70.zip |
first step towards multi-disk support, Thx Hugo Haas
-rw-r--r-- | lib/class/album.class.php | 6 | ||||
-rw-r--r-- | lib/class/catalog.class.php | 12 | ||||
-rw-r--r-- | lib/class/update.class.php | 35 | ||||
-rwxr-xr-x | lib/class/vainfo.class.php | 4 | ||||
-rw-r--r-- | lib/general.lib.php | 1 | ||||
-rw-r--r-- | modules/getid3/module.tag.id3v2.php | 1 |
6 files changed, 53 insertions, 6 deletions
diff --git a/lib/class/album.class.php b/lib/class/album.class.php index 25e720f8..23628b5f 100644 --- a/lib/class/album.class.php +++ b/lib/class/album.class.php @@ -30,6 +30,7 @@ class Album { public $id; public $name; public $full_name; // Prefix + Name, genereated by format(); + public $disk; public $year; public $prefix; @@ -145,7 +146,7 @@ class Album { $artist_sql = "AND `artist`='" . Dba::escape($artist) . "'"; } - $sql = "SELECT `id` FROM `song` WHERE `album`='$this->id' $artist_sql ORDER BY `track`, `title`"; + $sql = "SELECT `id` FROM `song` WHERE `album`='$this->id' $artist_sql ORDER BY `pos`, `track`, `title`"; if ($limit) { $sql .= " LIMIT $limit"; } $db_results = Dba::query($sql); @@ -670,6 +671,7 @@ class Album { $year = $data['year']; $artist = $data['artist']; $name = $data['name']; + $disk = $data['disk']; $current_id = $this->id; @@ -683,7 +685,7 @@ class Album { Catalog::clean_artists(); } - $album_id = Catalog::check_album($name,$year); + $album_id = Catalog::check_album($name,$year,$disk); if ($album_id != $this->id) { if (!is_array($songs)) { $songs = $this->get_songs(); } foreach ($songs as $song_id) { diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 6c72294b..b9e5aefd 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -953,6 +953,7 @@ class Catalog { $artist = $results['artist']; $album = $results['album']; $genre = $results['genre']; + $disk = $results['pos']; /* Clean up Old Vars */ unset($vainfo,$key); @@ -965,7 +966,7 @@ class Catalog { $new_song->f_artist = $artist; $new_song->genre = self::check_genre($genre); $new_song->f_genre = $new_song->get_genre_name(); - $new_song->album = self::check_album($album,$new_song->year); + $new_song->album = self::check_album($album,$new_song->year,$disk); $new_song->f_album = $album . " - " . $new_song->year; $new_song->title = self::check_title($new_song->title,$new_song->file); @@ -1723,12 +1724,13 @@ class Catalog { * check_album * Takes $album and checks if there then return id else insert and return id */ - public static function check_album($album,$album_year=0,$readonly='') { + public static function check_album($album,$album_year=0,$disk='',$readonly='') { /* Clean up the album name */ $album = trim($album); $album = Dba::escape($album); $album_year = intval($album_year); + $album_disk = intval($disk); // Set it once to reduce function calls $cache_limit = Config::get('album_cache_limit'); @@ -1755,6 +1757,7 @@ class Catalog { /* Setup the Query */ $sql = "SELECT `id` FROM `album` WHERE `name` = '$album'"; if ($album_year) { $sql .= " AND `year`='$album_year'"; } + if ($album_disk) { $sql .= " AND `disk`='$album_disk'"; } $db_results = Dba::query($sql); /* If it's found */ @@ -1777,7 +1780,7 @@ class Catalog { $prefix_txt = "'$prefix'"; } - $sql = "INSERT INTO `album` (`name`, `prefix`,`year`) VALUES ('$album',$prefix_txt,'$album_year')"; + $sql = "INSERT INTO `album` (`name`, `prefix`,`year`,`disk`) VALUES ('$album',$prefix_txt,'$album_year','$album_disk')"; $db_results = Dba::query($sql); $album_id = Dba::insert_id(); @@ -1890,6 +1893,7 @@ class Catalog { $size = $results['size']; $song_time = $results['time']; $track = $results['track']; + $disk = $results['pos']; $year = $results['year']; $comment = $results['comment']; $current_time = time(); @@ -1901,7 +1905,7 @@ class Catalog { */ $artist_id = self::check_artist($artist); $genre_id = self::check_genre($genre); - $album_id = self::check_album($album,$year); + $album_id = self::check_album($album,$year,$disk); $title = self::check_title($title,$file); $add_file = Dba::escape($file); diff --git a/lib/class/update.class.php b/lib/class/update.class.php index 2c5f5694..a5160c7e 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -227,6 +227,12 @@ class Update { $version[] = array('version' => '340008','description' => $update_string); + $update_string = '- Added disk to Album table.<br />' . + '- Added artist_data for artist images and bios.<br />' . + '- Added DNS to access list to allow for dns based ACLs.<br />'; + + $version[] = array('version' => '340009','description' => $update_string); + return $version; } // populate_version @@ -904,5 +910,34 @@ class Update { } // update_340008 + /** + * update_340009 + * This modifies the song table to handle pos fields + */ + public static function update_340009() { + + $sql = "ALTER TABLE `album` ADD `disk` smallint(5) UNSIGNED DEFAULT NULL"; + $db_results = Dba::query($sql); + + $sql = "ALTER TABLE `album` ADD INDEX (`disk`)"; + $db_results = Dba::query($sql); + + $sql = "ALTER TABLE `access_list` ADD `dns` VARCHAR( 255 ) NOT NULL AFTER `end`"; + $db_results = Dba::query($sql); + + $sql = "CREATE TABLE `artist_data` (" . + "`artist_id` INT( 11 ) UNSIGNED NOT NULL ," . + "`art` MEDIUMBLOB NOT NULL ," . + "`art_mime` VARCHAR( 32 ) NOT NULL ," . + "`thumb` BLOB NOT NULL ," . + "`thumb_mime` VARCHAR( 32 ) NOT NULL ," . + "`bio` TEXT NOT NULL , " . + "UNIQUE (`artist_id`) ) ENGINE = MYISAM"; + $db_results = Dba::query($sql); + + self::set_version('db_version','340009'); + + } // update_340009 + } // end update class ?> diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php index 7e3904c0..bc1c27b6 100755 --- a/lib/class/vainfo.class.php +++ b/lib/class/vainfo.class.php @@ -364,6 +364,10 @@ class vainfo { * so we now need to account for it :( */ switch ($tag) { + case 'pos': + $el = split('/', $data['0']); + $array['pos'] = $el[0]; + break; case 'track_number': $array['track'] = $this->_clean_tag($data['0'],$this->_file_encoding); break; diff --git a/lib/general.lib.php b/lib/general.lib.php index 408a4a99..8a1f2eea 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -233,6 +233,7 @@ function clean_tag_info($results,$key,$filename) { $info['title'] = stripslashes(trim($results[$key]['title'])); $info['year'] = intval($results[$key]['year']); $info['track'] = intval($results[$key]['track']); + $info['pos'] = intval($results[$key]['pos']); $info['comment'] = Dba::escape(str_replace($clean_array,$wipe_array,$results[$key]['comment'])); /* This are pulled from the info array */ diff --git a/modules/getid3/module.tag.id3v2.php b/modules/getid3/module.tag.id3v2.php index f1e7d39b..d6b98e2e 100644 --- a/modules/getid3/module.tag.id3v2.php +++ b/modules/getid3/module.tag.id3v2.php @@ -3151,6 +3151,7 @@ class getid3_id3v2 extends getid3_handler 'TPE2' => 'band', 'TPE3' => 'conductor', 'TPE4' => 'remixer', + 'TPOS' => 'pos', 'TPUB' => 'publisher', 'TRC' => 'isrc', 'TRCK' => 'track', |