1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 10:49:37 +02:00

Add browse filter and light sidebar options

Add overload to force library item art display
This commit is contained in:
Afterster 2016-02-29 22:51:42 +01:00
parent 5f3d59ed74
commit 0630676eb6
26 changed files with 163 additions and 136 deletions

View file

@ -808,7 +808,7 @@ class Album extends database_object implements library_item
return $artist->get_description();
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
$id = null;
$type = null;
@ -817,7 +817,7 @@ class Album extends database_object implements library_item
$id = $this->id;
$type = 'album';
} else {
if (Art::has_db($this->artist_id, 'artist')) {
if (Art::has_db($this->artist_id, 'artist') || $force) {
$id = $this->artist_id;
$type = 'artist';
}

View file

@ -619,12 +619,12 @@ class Artist extends database_object implements library_item
return $this->summary;
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
$id = null;
$type = null;
if (Art::has_db($this->id, 'artist')) {
if (Art::has_db($this->id, 'artist') || $force) {
$id = $this->id;
$type = 'artist';
}

View file

@ -286,9 +286,9 @@ class Broadcast extends database_object implements library_item
return null;
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
if (Art::has_db($this->id, 'broadcast')) {
if (Art::has_db($this->id, 'broadcast') || $force) {
Art::display('broadcast', $this->id, $this->get_fullname(), $thumb, $this->link);
}
}

View file

@ -249,9 +249,9 @@ class Channel extends database_object implements media, library_item
return $this->description;
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
if (Art::has_db($this->id, 'channel')) {
if (Art::has_db($this->id, 'channel') || $force) {
Art::display('channel', $this->id, $this->get_fullname(), $thumb, $this->link);
}
}

View file

@ -97,9 +97,9 @@ class Label extends database_object implements library_item
return true;
}
public function display_art($thumb)
public function display_art($thumb, $force = false)
{
if (Art::has_db($this->id, 'label')) {
if (Art::has_db($this->id, 'label') || $force) {
Art::display('label', $this->id, $this->get_fullname(), $thumb, $this->link);
}
}

View file

@ -37,7 +37,7 @@ interface library_item extends playable_item
public function get_description();
public function display_art($thumb);
public function display_art($thumb, $force = false);
public function update(array $data);

View file

@ -165,9 +165,9 @@ class Live_Stream extends database_object implements media, library_item
return null;
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
if (Art::has_db($this->id, 'live_stream')) {
if (Art::has_db($this->id, 'live_stream') || $force) {
Art::display('live_stream', $this->id, $this->get_fullname(), $thumb, $this->link);
}
}

View file

@ -157,7 +157,7 @@ abstract class playlist_object extends database_object implements library_item
return null;
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
// no art
}

View file

@ -226,9 +226,9 @@ class Podcast extends database_object implements library_item
return $this->f_description;
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
if (Art::has_db($this->id, 'podcast')) {
if (Art::has_db($this->id, 'podcast') || $force) {
Art::display('podcast', $this->id, $this->get_fullname(), $thumb, $this->link);
}
}

View file

@ -206,7 +206,7 @@ class Podcast_Episode extends database_object implements media, library_item
return $this->f_description;
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
$id = null;
$type = null;
@ -215,7 +215,7 @@ class Podcast_Episode extends database_object implements media, library_item
$id = $this->id;
$type = 'podcast_episode';
} else {
if (Art::has_db($this->podcast, 'podcast')) {
if (Art::has_db($this->podcast, 'podcast') || $force) {
$id = $this->podcast;
$type = 'podcast';
}

View file

@ -1592,7 +1592,7 @@ class Song extends database_object implements media, library_item
return $album->get_description();
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
$id = null;
$type = null;
@ -1605,7 +1605,7 @@ class Song extends database_object implements media, library_item
$id = $this->album;
$type = 'album';
} else {
if (Art::has_db($this->artist, 'artist')) {
if (Art::has_db($this->artist, 'artist') || $force) {
$id = $this->artist;
$type = 'artist';
}

View file

@ -780,9 +780,9 @@ class Tag extends database_object implements library_item
return null;
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
if (Art::has_db($this->id, 'tag')) {
if (Art::has_db($this->id, 'tag') || $force) {
Art::display('tag', $this->id, $this->get_fullname(), $thumb, $this->link);
}
}

View file

@ -262,9 +262,9 @@ class TVShow extends database_object implements library_item
return $this->summary;
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
if (Art::has_db($this->id, 'tvshow')) {
if (Art::has_db($this->id, 'tvshow') || $force) {
Art::display('tvshow', $this->id, $this->get_fullname(), $thumb, $this->link);
}
}

View file

@ -213,7 +213,7 @@ class TVShow_Episode extends Video
return $season->get_description();
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
$id = null;
$type = null;
@ -227,7 +227,7 @@ class TVShow_Episode extends Video
$type = 'tvshow_season';
} else {
$season = new TVShow_Season($this->season);
if (Art::has_db($season->tvshow, 'tvshow')) {
if (Art::has_db($season->tvshow, 'tvshow') || $force) {
$id = $season->tvshow;
$type = 'tvshow';
}

View file

@ -227,7 +227,7 @@ class TVShow_Season extends database_object implements library_item
return $tvshow->get_description();
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
$id = null;
$type = null;
@ -236,7 +236,7 @@ class TVShow_Season extends database_object implements library_item
$id = $this->id;
$type = 'tvshow_season';
} else {
if (Art::has_db($this->tvshow, 'tvshow')) {
if (Art::has_db($this->tvshow, 'tvshow') || $force) {
$id = $this->tvshow;
$type = 'tvshow';
}

View file

@ -544,6 +544,9 @@ class Update
$update_string = "- Add upload rename pattern and ignore duplicate options.<br />";
$version[] = array('version' => '380007', 'description' => $update_string);
$update_string = "- Add browse filter and light sidebar options.<br />";
$version[] = array('version' => '380008', 'description' => $update_string);
return $version;
}
@ -3837,14 +3840,40 @@ class Update
$retval = true;
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`, `subcatagory`) " .
"VALUES ('upload_catalog_pattern','0','Rename uploaded file according to catalog pattern',0,'boolean','system','upload')";
"VALUES ('upload_catalog_pattern','0','Rename uploaded file according to catalog pattern',100,'boolean','system','upload')";
$retval &= Dba::write($sql);
$id = Dba::insert_id();
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')";
$retval &= Dba::write($sql, array($id));
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`, `subcatagory`) " .
"VALUES ('catalog_check_duplicate','0','Check library item at import time and don\'t import duplicates',0,'boolean','system','catalog')";
"VALUES ('catalog_check_duplicate','0','Check library item at import time and don\'t import duplicates',100,'boolean','system','catalog')";
$retval &= Dba::write($sql);
$id = Dba::insert_id();
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')";
$retval &= Dba::write($sql, array($id));
return $retval;
}
/**
* update_380008
*
* Add browse filter and light sidebar options
*/
public static function update_380008()
{
$retval = true;
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`, `subcatagory`) " .
"VALUES ('browse_filter','1','Show filter box on browse',25,'boolean','interface','library')";
$retval &= Dba::write($sql);
$id = Dba::insert_id();
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')";
$retval &= Dba::write($sql, array($id));
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`, `subcatagory`) " .
"VALUES ('sidebar_light','0','Light sidebar by default',25,'boolean','interface','theme')";
$retval &= Dba::write($sql);
$id = Dba::insert_id();
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'0')";

View file

@ -393,9 +393,9 @@ class Video extends database_object implements media, library_item
return '';
}
public function display_art($thumb = 2)
public function display_art($thumb = 2, $force = false)
{
if (Art::has_db($this->id, 'video')) {
if (Art::has_db($this->id, 'video') || $force) {
Art::display('video', $this->id, $this->get_fullname(), $thumb, $this->link);
}
}

View file

@ -195,9 +195,9 @@ class XML_Data
* This returns the formatted 'playlistTrack' string for an xml document
*
*/
private static function playlist_song_tracks_string($song,$playlist_data)
private static function playlist_song_tracks_string($song, $playlist_data)
{
if ($playlist_data == "") {
if (empty($playlist_data)) {
return "";
}
$playlist_track = "";
@ -424,7 +424,7 @@ class XML_Data
* This returns an xml document from an array of song ids.
* (Spiffy isn't it!)
*/
public static function songs($songs,$playlist_data='')
public static function songs($songs, $playlist_data='')
{
if (count($songs) > self::$limit or self::$offset > 0) {
$songs = array_slice($songs, self::$offset, self::$limit);