id, $video->f_title, 8, null, false, 'preview');
+ $gart = Art::display('video', $video->id, $video->f_name, 8, null, false, 'preview');
}
if (!$gart) {
- $gart = Art::display('video', $video->id, $video->f_title, 7);
+ $gart = Art::display('video', $video->id, $video->f_name, 7);
} ?>
@@ -137,7 +137,7 @@
} ?>
f_title);
+ $videoprops[T_('Title')] = scrub_out($video->f_name);
$videoprops[T_('Length')] = scrub_out($video->f_time);
if (get_class($video) != Video::class) {
require Ui::find_template('show_partial_' . ObjectTypeToClassNameMapper::reverseMap(get_class($video)) . '.inc.php');
diff --git a/public/templates/show_video_row.inc.php b/public/templates/show_video_row.inc.php
index e53ccceea5..596b255458 100644
--- a/public/templates/show_video_row.inc.php
+++ b/public/templates/show_video_row.inc.php
@@ -64,11 +64,11 @@
get_default_art_kind() == 'preview') {
- $art_showed = Art::display('video', $libitem->id, $libitem->f_title, 9, $libitem->link, false, 'preview');
+ $art_showed = Art::display('video', $libitem->id, $libitem->f_name, 9, $libitem->link, false, 'preview');
}
if (!$art_showed) {
$thumb = (isset($browse) && !$browse->is_grid_view()) ? 7 : 6;
- Art::display('video', $libitem->id, $libitem->f_title, $thumb, $libitem->link);
+ Art::display('video', $libitem->id, $libitem->f_name, $thumb, $libitem->link);
} ?>
|
f_link; ?> |
diff --git a/src/Gui/Song/SongViewAdapter.php b/src/Gui/Song/SongViewAdapter.php
index 276b2654b2..c1903ac4e0 100644
--- a/src/Gui/Song/SongViewAdapter.php
+++ b/src/Gui/Song/SongViewAdapter.php
@@ -347,13 +347,13 @@ public function getProperties(): array
$songprops[T_('Year')] = $this->song->year;
$songprops[T_('Original Year')] = scrub_out($this->song->get_album_original_year($this->song->album));
$songprops[T_('Length')] = scrub_out($this->song->f_time);
- $songprops[T_('Links')] = "
song->f_artist) . "%22+%22" . rawurlencode($this->song->f_title) . "%22\" target=\"_blank\">" . UI::get_icon('google', T_('Search on Google ...')) . "";
- $songprops[T_('Links')] .= "
song->f_artist) . "%22+%22" . rawurlencode($this->song->f_title) . "%22\" target=\"_blank\">" . UI::get_icon('duckduckgo', T_('Search on DuckDuckGo ...')) . "";
- $songprops[T_('Links')] .= "
song->f_artist) . "%22+%22" . rawurlencode($this->song->f_title) . "%22&type=track\" target=\"_blank\">" . UI::get_icon('lastfm', T_('Search on Last.fm ...')) . "";
+ $songprops[T_('Links')] = "
song->f_artist) . "%22+%22" . rawurlencode($this->song->f_name) . "%22\" target=\"_blank\">" . UI::get_icon('google', T_('Search on Google ...')) . "";
+ $songprops[T_('Links')] .= "
song->f_artist) . "%22+%22" . rawurlencode($this->song->f_name) . "%22\" target=\"_blank\">" . UI::get_icon('duckduckgo', T_('Search on DuckDuckGo ...')) . "";
+ $songprops[T_('Links')] .= "
song->f_artist) . "%22+%22" . rawurlencode($this->song->f_name) . "%22&type=track\" target=\"_blank\">" . UI::get_icon('lastfm', T_('Search on Last.fm ...')) . "";
if ($this->song->mbid) {
$songprops[T_('Links')] .= "
song->mbid . "\" target=\"_blank\">" . UI::get_icon('musicbrainz', T_('Search on Musicbrainz ...')) . "";
} else {
- $songprops[T_('Links')] .= "
song->f_artist) . "%22&tag-lookup.track=%22" . rawurlencode($this->song->f_title) . "%22\" target=\"_blank\">" . UI::get_icon('musicbrainz', T_('Search on Musicbrainz ...')) . "";
+ $songprops[T_('Links')] .= "
song->f_artist) . "%22&tag-lookup.track=%22" . rawurlencode($this->song->f_name) . "%22\" target=\"_blank\">" . UI::get_icon('musicbrainz', T_('Search on Musicbrainz ...')) . "";
}
$songprops[T_('Comment')] = scrub_out($this->song->comment);
$label_string = '';
diff --git a/src/Module/Api/Daap_Api.php b/src/Module/Api/Daap_Api.php
index 36204b0601..6dbf88e387 100644
--- a/src/Module/Api/Daap_Api.php
+++ b/src/Module/Api/Daap_Api.php
@@ -512,7 +512,7 @@ private static function tlv_songs($songs, $meta)
foreach ($meta as $tag) {
switch ($tag) {
case 'dmap.itemname':
- $output .= self::tlv($tag, $song->f_title);
+ $output .= self::tlv($tag, $song->f_name);
break;
case 'dmap.containeritemid':
/* case 'dmap.persistentid': */ $output .= self::tlv($tag, $song->id);
diff --git a/src/Module/Api/Json_Data.php b/src/Module/Api/Json_Data.php
index c80101393d..92ca5acd98 100644
--- a/src/Module/Api/Json_Data.php
+++ b/src/Module/Api/Json_Data.php
@@ -779,7 +779,7 @@ public static function podcasts($podcasts, $user_id = null, $episodes = false, $
$rating = new Rating($podcast_id, 'podcast');
$flag = new Userflag($podcast_id, 'podcast');
$art_url = Art::url($podcast_id, 'podcast', Core::get_request('auth'));
- $podcast_name = $podcast->f_title;
+ $podcast_name = $podcast->f_name;
$podcast_description = $podcast->description;
$podcast_language = $podcast->f_language;
$podcast_copyright = $podcast->f_copyright;
@@ -845,8 +845,8 @@ public static function podcast_episodes($podcast_episodes, $user_id = null, $enc
$art_url = Art::url($episode->podcast, 'podcast', Core::get_request('auth'));
array_push($JSON, [
"id" => (string) $episode_id,
- "title" => $episode->f_title,
- "name" => $episode->f_title,
+ "title" => $episode->f_name,
+ "name" => $episode->f_name,
"description" => $episode->f_description,
"category" => $episode->f_category,
"author" => $episode->f_author,
@@ -917,8 +917,8 @@ public static function songs($songs, $user_id = null, $encode = true, $object =
$ourArray = array(
"id" => (string)$song->id,
- "title" => $song->f_title,
- "name" => $song->f_title,
+ "title" => $song->f_name,
+ "name" => $song->f_name,
"artist" => array(
"id" => (string) $song->artist,
"name" => $song->get_artist_name()),
@@ -1063,7 +1063,7 @@ public static function democratic($object_ids = array(), $user_id = null, $objec
array_push($JSON, array(
"id" => (string)$song->id,
- "title" => $song->f_title,
+ "title" => $song->f_name,
"artist" => array("id" => (string) $song->artist, "name" => $song->f_artist_full),
"album" => array("id" => (string) $song->album, "name" => $song->f_album_full),
"genre" => self::genre_array($song->tags),
diff --git a/src/Module/Api/Subsonic_Api.php b/src/Module/Api/Subsonic_Api.php
index a3594a7439..bb25543787 100644
--- a/src/Module/Api/Subsonic_Api.php
+++ b/src/Module/Api/Subsonic_Api.php
@@ -38,7 +38,6 @@
use Ampache\Module\Util\Mailer;
use Ampache\Module\Util\Recommendation;
use Ampache\Repository\AlbumRepositoryInterface;
-use Ampache\Repository\ArtistRepositoryInterface;
use Ampache\Repository\BookmarkRepositoryInterface;
use Ampache\Repository\LiveStreamRepositoryInterface;
use Ampache\Repository\Model\Album;
@@ -46,7 +45,6 @@
use Ampache\Repository\Model\Artist;
use Ampache\Repository\Model\Bookmark;
use Ampache\Repository\Model\Catalog;
-use Ampache\Repository\Model\ModelFactoryInterface;
use Ampache\Repository\Model\Playlist;
use Ampache\Repository\Model\Podcast;
use Ampache\Repository\Model\Podcast_Episode;
@@ -527,13 +525,17 @@ public static function getmusicdirectory($input)
{
$object_id = self::check_parameter($input, 'id');
$response = Subsonic_Xml_Data::createSuccessResponse('getmusicdirectory');
- if (Subsonic_Xml_Data::isArtist($object_id)) {
+ if ((int)$object_id === 0) {
+ $response = Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_DATA_NOTFOUND, "Directory not found", 'getmusicdirectory');
+ } elseif (Subsonic_Xml_Data::isArtist($object_id)) {
Subsonic_Xml_Data::addArtistDirectory($response, $object_id);
} elseif (Subsonic_Xml_Data::isAlbum($object_id)) {
Subsonic_Xml_Data::addAlbumDirectory($response, $object_id);
- } else {
- // is it a catalog?
+ } elseif (Catalog::create_from_id($object_id)) {
Subsonic_Xml_Data::addCatalogDirectory($response, $object_id);
+ } else {
+ debug_event(self::class, 'getmusicdirectory: Directory not found ' . $object_id, 4);
+ $response = Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_DATA_NOTFOUND, "Directory not found", 'getmusicdirectory');
}
self::apiOutput($input, $response);
}
@@ -581,8 +583,7 @@ public static function getartist($input)
$artist = new Artist(Subsonic_Xml_Data::getAmpacheId($artistid));
if ($artist->isNew()) {
- $response = Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_DATA_NOTFOUND, "Artist not found.",
- 'getartist');
+ $response = Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_DATA_NOTFOUND, "Artist not found.", 'getartist');
} else {
$response = Subsonic_Xml_Data::createSuccessResponse('getartist');
Subsonic_Xml_Data::addArtist($response, $artist, true, true);
@@ -779,7 +780,7 @@ public static function getrandomsongs($input)
}
if ($musicFolderId > 0) {
if (Subsonic_Xml_Data::isArtist($musicFolderId)) {
- $artist = static::getModelFactory()->createArtist(Subsonic_Xml_Data::getAmpacheId($musicFolderId));
+ $artist = new Artist(Subsonic_Xml_Data::getAmpacheId($musicFolderId));
$finput = $artist->f_name;
$operator = 4;
$ftype = "artist";
@@ -912,12 +913,12 @@ public static function search2($input, $elementName = "searchResult2")
}
}
- $artistCount = isset($input['artistCount']) ? $input['artistCount'] : 20;
- $artistOffset = $input['artistOffset'];
- $albumCount = isset($input['albumCount']) ? $input['albumCount'] : 20;
- $albumOffset = $input['albumOffset'];
- $songCount = isset($input['songCount']) ? $input['songCount'] : 20;
- $songOffset = $input['songOffset'];
+ $artistCount = $input['artistCount'] ?? 20;
+ $artistOffset = $input['artistOffset'] ?? 0;
+ $albumCount = $input['albumCount'] ?? 20;
+ $albumOffset = $input['albumOffset'] ?? 0;
+ $songCount = $input['songCount'] ?? 20;
+ $songOffset = $input['songOffset'] ?? 0;
$sartist = array();
$sartist['limit'] = $artistCount;
@@ -1038,8 +1039,7 @@ public static function createplaylist($input)
}
$response = Subsonic_Xml_Data::createSuccessResponse('createplaylist');
} else {
- $response = Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_MISSINGPARAM, '',
- 'createplaylist');
+ $response = Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_MISSINGPARAM, '', 'createplaylist');
}
self::apiOutput($input, $response);
}
@@ -1112,13 +1112,11 @@ public static function updateplaylist($input)
} elseif (is_string($input['songIndexToRemove'])) {
$songIndexToRemove = explode(',', $input['songIndexToRemove']);
}
- self::_updatePlaylist(Subsonic_Xml_Data::getAmpacheId($playlistId), $name, $songIdToAdd, $songIndexToRemove,
- $public);
+ self::_updatePlaylist(Subsonic_Xml_Data::getAmpacheId($playlistId), $name, $songIdToAdd, $songIndexToRemove, $public);
$response = Subsonic_Xml_Data::createSuccessResponse('updateplaylist');
} else {
- $response = Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_UNAUTHORIZED,
- 'Cannot edit a smart playlist.', 'updateplaylist');
+ $response = Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_UNAUTHORIZED, 'Cannot edit a smart playlist.', 'updateplaylist');
}
self::apiOutput($input, $response);
}
@@ -1182,10 +1180,8 @@ public static function stream($input)
$object = new Song(Subsonic_Xml_Data::getAmpacheId($fileid));
$url = $object->play_url($params, 'api', function_exists('curl_version'), $user_id);
} elseif (Subsonic_Xml_Data::isPodcastEp($fileid)) {
- $object = static::getPodcastEpisodeRepository()->findById(
- (int) Subsonic_Xml_Data::getAmpacheId($fileid)
- );
- $url = $object->play_url($params, 'api', function_exists('curl_version'), $user_id);
+ $object = new Podcast_episode((int) Subsonic_Xml_Data::getAmpacheId($fileid));
+ $url = $object->play_url($params, 'api', function_exists('curl_version'), $user_id);
}
// return an error on missing files
@@ -1214,10 +1210,8 @@ public static function download($input)
$object = new Song(Subsonic_Xml_Data::getAmpacheId($fileid));
$url = $object->play_url($params, 'api', function_exists('curl_version'), $user_id);
} elseif (Subsonic_Xml_Data::isPodcastEp($fileid)) {
- $object = static::getPodcastEpisodeRepository()->findById(
- (int) Subsonic_Xml_Data::getAmpacheId($fileid)
- );
- $url = $object->play_url($params, 'api', function_exists('curl_version'), $user_id);
+ $object = new Podcast_episode((int) Subsonic_Xml_Data::getAmpacheId($fileid));
+ $url = $object->play_url($params, 'api', function_exists('curl_version'), $user_id);
}
// return an error on missing files
if (empty($url)) {
@@ -1249,9 +1243,7 @@ public static function hls($input)
} else {
self::apiOutput(
$input,
- Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_DATA_NOTFOUND,
- 'Invalid id',
- 'hls'));
+ Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_DATA_NOTFOUND, 'Invalid id', 'hls'));
}
$media['object_id'] = Subsonic_Xml_Data::getAmpacheId($fileid);
@@ -1307,15 +1299,12 @@ public static function getcoverart($input)
$art = new Art(Subsonic_Xml_Data::getAmpacheId($sub_id), "album");
}
if (($type == 'song')) {
- $art = new Art(Subsonic_Xml_Data::getAmpacheId($sub_id), "song");
- if ($art != null && $art->id == null) {
+ $song_id = Subsonic_Xml_Data::getAmpacheId($sub_id);
+ $art = new Art(Subsonic_Xml_Data::getAmpacheId($sub_id), "song");
+ if (!AmpConfig::get('show_song_art', false) || !Art::has_db($song_id, 'song')) {
// in most cases the song doesn't have a picture, but the album does
- $song = new Song(Subsonic_Xml_Data::getAmpacheId(Subsonic_Xml_Data::getAmpacheId($sub_id)));
- $show_song_art = AmpConfig::get('show_song_art', false);
- $has_art = Art::has_db($song->id, 'song');
- $art_object = ($show_song_art && $has_art) ? $song->id : $song->album;
- $art_type = ($show_song_art && $has_art) ? 'song' : 'album';
- $art = new Art($art_object, $art_type);
+ $song = new Song($song_id);
+ $art = new Art($song->album, 'album');
}
}
if (($type == 'podcast')) {
@@ -1505,8 +1494,7 @@ private static function _setStar($input, $star)
$ids[] = array('id' => $aid, 'type' => 'artist');
}
} else {
- $response = Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_MISSINGPARAM,
- 'Missing parameter', '_setStar');
+ $response = Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_MISSINGPARAM, 'Missing parameter', '_setStar');
}
}
}
@@ -1645,7 +1633,7 @@ public static function createshare($input)
$libitem_id = self::check_parameter($input, 'id');
$description = $input['description'];
if (AmpConfig::get('share')) {
- $expire_days = static::getExpirationDateCalculator()->calculate((int) $input['expires']);
+ $expire_days = Share::get_expiry($input['expires'] ?? null);
$object_type = null;
if (is_array($libitem_id) && Subsonic_Xml_Data::isSong($libitem_id[0])) {
$song_id = Subsonic_Xml_Data::getAmpacheId($libitem_id[0]);
@@ -1705,7 +1693,7 @@ public static function deleteshare($input)
$user = User::get_from_username((string)$username);
$id = self::check_parameter($input, 'id');
if (AmpConfig::get('share')) {
- if (static::getShareRepository()->delete((int) $id, $user)) {
+ if (Share::delete_share((int) $id, $user)) {
$response = Subsonic_Xml_Data::createSuccessResponse('deleteshare');
} else {
$response = Subsonic_Xml_Data::createError(Subsonic_Xml_Data::SSERROR_DATA_NOTFOUND, '', 'deleteshare');
@@ -1734,7 +1722,7 @@ public static function updateshare($input)
$share = new Share(Subsonic_Xml_Data::getAmpacheId($share_id));
if ($share->id > 0) {
$expires = $share->expire_days;
- if (isset($input['expires'])) {
+ if (array_key_exists('expires', $input)) {
// Parse as a string to work on 32-bit computers
$expires = $input['expires'];
if (strlen((string)$expires) > 3) {
@@ -2196,10 +2184,8 @@ public static function getsimilarsongs($input, $child = "similarSongs")
return;
}
- $id = self::check_parameter($input, 'id');
- $count = $input['count'] ?? 50;
- $modelFactory = static::getModelFactory();
-
+ $id = self::check_parameter($input, 'id');
+ $count = $input['count'] ?? 50;
$songs = array();
if (Subsonic_Xml_Data::isArtist($id)) {
$similars = Recommendation::get_artists_like(Subsonic_Xml_Data::getAmpacheId($id));
diff --git a/src/Module/Api/Subsonic_Xml_Data.php b/src/Module/Api/Subsonic_Xml_Data.php
index 6a7f00d8ae..36f7021188 100644
--- a/src/Module/Api/Subsonic_Xml_Data.php
+++ b/src/Module/Api/Subsonic_Xml_Data.php
@@ -684,7 +684,7 @@ public static function addAlbum($xml, $album, $songs = false, $elementName = "al
$xalbum->addAttribute('id', (string)self::getAlbumId($album->id));
$xalbum->addAttribute('parent', (string) self::getArtistId($album->album_artist));
$xalbum->addAttribute('album', (string)self::checkName($album->f_name));
- $xalbum->addAttribute('title', (string)self::checkName($album->f_title));
+ $xalbum->addAttribute('title', (string)self::checkName($album->f_name));
$xalbum->addAttribute('name', (string)self::checkName($album->f_name));
$xalbum->addAttribute('isDir', 'true');
$xalbum->addAttribute('discNumber', (string)$album->disk);
@@ -972,8 +972,9 @@ public static function addArtistDirectory($xml, $artist_id)
$amp_id = self::getAmpacheId($artist_id);
$data = Artist::get_id_array($amp_id);
$xdir = $xml->addChild('directory');
+ debug_event(self::class, $amp_id . ' artist ' . $artist_id . ' DaTA Runtime Error ' . print_r($data, true), 5);
$xdir->addAttribute('id', (string)$artist_id);
- $xdir->addAttribute('parent', (string)Catalog::get_catalog_map('artist', $artist_id));
+ $xdir->addAttribute('parent', (string)$data['catalog_id']);
$xdir->addAttribute('name', (string)$data['f_name']);
$allalbums = static::getAlbumRepository()->getByArtist($amp_id);
foreach ($allalbums as $album_id) {
@@ -998,7 +999,7 @@ public static function addAlbumDirectory($xml, $album_id)
} else {
$xdir->addAttribute('parent', (string)$album->catalog);
}
- $xdir->addAttribute('name', (string)self::checkName($album->f_title));
+ $xdir->addAttribute('name', (string)self::checkName($album->f_name));
$disc_ids = $album->get_group_disks_ids();
$media_ids = static::getAlbumRepository()->getSongsGrouped($disc_ids);
@@ -1023,6 +1024,7 @@ public static function addCatalogDirectory($xml, $catalog_id)
self::addChildArray($xdir, $artist);
}
}
+
/**
* addGenres
* @param SimpleXMLElement $xml
@@ -1263,8 +1265,7 @@ public static function addNowPlaying($xml, $data)
$track = self::addSong($xplaynow, $d['media']->getId(), "entry");
if ($track !== null) {
$track->addAttribute('username', (string)$d['client']->username);
- $track->addAttribute('minutesAgo',
- (string)(abs((time() - ($d['expire'] - $d['media']->time)) / 60)));
+ $track->addAttribute('minutesAgo', (string)(abs((time() - ($d['expire'] - $d['media']->time)) / 60)));
$track->addAttribute('playerId', (string)$d['agent']);
}
}
@@ -1578,7 +1579,7 @@ public static function addPodcasts($xml, $podcasts, $includeEpisodes = true)
$xchannel = $xpodcasts->addChild('channel');
$xchannel->addAttribute('id', (string)self::getPodcastId($podcast->id));
$xchannel->addAttribute('url', (string)$podcast->feed);
- $xchannel->addAttribute('title', (string)self::checkName($podcast->f_title));
+ $xchannel->addAttribute('title', (string)self::checkName($podcast->f_name));
$xchannel->addAttribute('description', (string)$podcast->f_description);
if (Art::has_db($podcast->id, 'podcast')) {
$xchannel->addAttribute('coverArt', 'pod-' . self::getPodcastId($podcast->id));
@@ -1606,7 +1607,7 @@ private static function addPodcastEpisode($xml, $episode, $elementName = 'episod
$xepisode = $xml->addChild(htmlspecialchars($elementName));
$xepisode->addAttribute('id', (string)self::getPodcastEpId($episode->id));
$xepisode->addAttribute('channelId', (string)self::getPodcastId($episode->podcast));
- $xepisode->addAttribute('title', (string)self::checkName($episode->f_title));
+ $xepisode->addAttribute('title', (string)self::checkName($episode->f_name));
$xepisode->addAttribute('album', (string)$episode->f_podcast);
$xepisode->addAttribute('description', (string)self::checkName($episode->f_description));
$xepisode->addAttribute('duration', (string)$episode->time);
diff --git a/src/Module/Api/Upnp_Api.php b/src/Module/Api/Upnp_Api.php
index f3af743f6a..c2cc3efe70 100644
--- a/src/Module/Api/Upnp_Api.php
+++ b/src/Module/Api/Upnp_Api.php
@@ -1535,7 +1535,7 @@ public static function _callSearch($criteria, $filter, $start, $count)
foreach ($ids as $album_id) {
$album = new Album($album_id);
$album->format();
- //debug_event(self::class, $album->f_title, 5);
+ //debug_event(self::class, $album->f_name, 5);
$mediaItems[] = self::_itemAlbum($album, "amp://music/albums");
}
break;
@@ -1636,7 +1636,7 @@ private static function _itemAlbum($album, $parent)
'parentID' => $parent,
'restricted' => 'false',
'childCount' => $album->song_count,
- 'dc:title' => self::_replaceSpecialSymbols($album->f_title),
+ 'dc:title' => self::_replaceSpecialSymbols($album->f_name),
'upnp:class' => 'object.container.album.musicAlbum', // object.container.album.musicAlbum
//'upnp:class' => 'object.container',
'upnp:albumArtist' => $album->album_artist,
@@ -1707,7 +1707,7 @@ public static function _itemSong($song, $parent)
'id' => 'amp://music/songs/' . $song->id,
'parentID' => $parent,
'restricted' => 'false', // XXX
- 'dc:title' => self::_replaceSpecialSymbols($song->f_title),
+ 'dc:title' => self::_replaceSpecialSymbols($song->f_name),
'dc:date' => date("c", (int) $song->addition_time),
'dc:creator' => self::_replaceSpecialSymbols($song->f_artist),
'upnp:class' => (isset($arrFileType['class'])) ? $arrFileType['class'] : 'object.item.unknownItem',
@@ -1804,7 +1804,7 @@ private static function _itemVideo($video, $parent)
'id' => $parent . '/' . $video->id,
'parentID' => $parent,
'restricted' => '1',
- 'dc:title' => self::_replaceSpecialSymbols($video->f_title),
+ 'dc:title' => self::_replaceSpecialSymbols($video->f_name),
'upnp:class' => (isset($arrFileType['class'])) ? $arrFileType['class'] : 'object.item.unknownItem',
'upnp:albumArtURI' => $art_url,
'upnp:genre' => Tag::get_display($video->tags, false, 'video'),
@@ -1828,7 +1828,7 @@ private static function _itemPodcast($podcast, $parent)
'parentID' => $parent,
'restricted' => '1',
'childCount' => count($podcast->get_episodes()),
- 'dc:title' => self::_replaceSpecialSymbols($podcast->f_title),
+ 'dc:title' => self::_replaceSpecialSymbols($podcast->f_name),
'upnp:class' => 'object.container',
);
}
@@ -1850,7 +1850,7 @@ private static function _itemPodcastEpisode($episode, $parent)
'id' => 'amp://music/podcasts/' . $episode->podcast . '/' . $episode->id,
'parentID' => $parent,
'restricted' => '1',
- 'dc:title' => self::_replaceSpecialSymbols($episode->f_title),
+ 'dc:title' => self::_replaceSpecialSymbols($episode->f_name),
'upnp:album' => self::_replaceSpecialSymbols($episode->f_podcast),
'upnp:class' => (isset($arrFileType['class'])) ? $arrFileType['class'] : 'object.item.unknownItem',
'upnp:albumArtURI' => $art_url
diff --git a/src/Module/Api/Xml_Data.php b/src/Module/Api/Xml_Data.php
index d08071e980..ff6a176e20 100644
--- a/src/Module/Api/Xml_Data.php
+++ b/src/Module/Api/Xml_Data.php
@@ -432,7 +432,7 @@ public static function indexes($objects, $object_type, $user_id = null, $full_xm
case 'song':
$song = new Song($object_id);
$song->format();
- $string .= "<$object_type id=\"" . $object_id . "\">\n\t
f_title . "]]>\n\t
f_title . "]]>\n\t
artist . "\">get_artist_name() . "]]>\n\t
album . "\">get_album_name() . "]]>\n\t
albumartist . "\">get_album_artist_name() . "]]>\n\t
disk . "]]>\n\t
\n$object_type>\n";
+ $string .= "<$object_type id=\"" . $object_id . "\">\n\t
f_name . "]]>\n\t
f_name . "]]>\n\t
artist . "\">get_artist_name() . "]]>\n\t
album . "\">get_album_name() . "]]>\n\t
albumartist . "\">get_album_artist_name() . "]]>\n\t
disk . "]]>\n\t
\n$object_type>\n";
break;
case 'playlist':
if ((int) $object_id === 0) {
@@ -463,7 +463,7 @@ public static function indexes($objects, $object_type, $user_id = null, $full_xm
case 'podcast':
$podcast = new Podcast($object_id);
$podcast->format();
- $string .= "
\n\tf_title . "]]>\n\tdescription . "]]>\n\tf_language . "]]>\n\tf_copyright . "]]>\n\tfeed . "]]>\n\tf_generator . "]]>\n\tf_website . "]]>\n\tf_lastbuilddate . "]]>\n\tf_lastsync . "]]>\n\tlink . "]]>\n";
+ $string .= "\n\tf_name . "]]>\n\tdescription . "]]>\n\tf_language . "]]>\n\tf_copyright . "]]>\n\tfeed . "]]>\n\tf_generator . "]]>\n\tf_website . "]]>\n\tf_lastbuilddate . "]]>\n\tf_lastsync . "]]>\n\tlink . "]]>\n";
if ($include) {
$episodes = $podcast->get_episodes();
foreach ($episodes as $episode_id) {
@@ -836,7 +836,7 @@ public static function podcasts($podcasts, $user_id = null, $episodes = false)
$rating = new Rating($podcast_id, 'podcast');
$flag = new Userflag($podcast_id, 'podcast');
$art_url = Art::url($podcast_id, 'podcast', Core::get_request('auth'));
- $string .= "\n\tf_title . "]]>\n\tdescription . "]]>\n\tf_language . "]]>\n\tf_copyright . "]]>\n\tfeed . "]]>\n\tf_generator . "]]>\n\tf_website . "]]>\n\tf_lastbuilddate . "]]>\n\tf_lastsync . "]]>\n\tlink . "]]>\n\t\n\t" . (!$flag->get_flag($user_id, false) ? 0 : 1) . "\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . (string) ($rating->get_average_rating() ?: null) . "\n";
+ $string .= "\n\tf_name . "]]>\n\tdescription . "]]>\n\tf_language . "]]>\n\tf_copyright . "]]>\n\tfeed . "]]>\n\tf_generator . "]]>\n\tf_website . "]]>\n\tf_lastbuilddate . "]]>\n\tf_lastsync . "]]>\n\tlink . "]]>\n\t\n\t" . (!$flag->get_flag($user_id, false) ? 0 : 1) . "\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . (string) ($rating->get_average_rating() ?: null) . "\n";
if ($episodes) {
$items = $podcast->get_episodes();
if (count($items) > 0) {
@@ -872,7 +872,7 @@ public static function podcast_episodes($podcast_episodes, $user_id = null, $ful
$rating = new Rating($episode_id, 'podcast_episode');
$flag = new Userflag($episode_id, 'podcast_episode');
$art_url = Art::url($episode->podcast, 'podcast', Core::get_request('auth'));
- $string .= "\t\n\t\tf_title . "]]>\n\t\tf_title . "]]>\n\t\tf_description . "]]>\n\t\tf_category . "]]>\n\t\tf_author . "]]>\n\t\tf_artist_full . "]]>\n\t\tf_website . "]]>\n\t\tf_pubdate . "]]>\n\t\tf_state . "]]>\n\t\tf_time_h . "]]>\n\t\tf_size . "]]>\n\t\tf_file . "]]>\n\t\tmime . "]]>\n\t\tlink . "]]>\n\t\tplay_url('', 'api', false, $user_id) . "]]>\n\t\tcatalog . "]]>\n\t\t\n\t\t" . (!$flag->get_flag($user_id, false) ? 0 : 1) . "\n\t\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t\t" . (string) ($rating->get_average_rating() ?: null) . "\n\t\t" . $episode->total_count . "\n\t\t" . $episode->played . "\n\t\n";
+ $string .= "\t\n\t\tf_name . "]]>\n\t\tf_name . "]]>\n\t\tf_description . "]]>\n\t\tf_category . "]]>\n\t\tf_author . "]]>\n\t\tf_artist_full . "]]>\n\t\tf_website . "]]>\n\t\tf_pubdate . "]]>\n\t\tf_state . "]]>\n\t\tf_time_h . "]]>\n\t\tf_size . "]]>\n\t\tf_file . "]]>\n\t\tmime . "]]>\n\t\tlink . "]]>\n\t\tplay_url('', 'api', false, $user_id) . "]]>\n\t\tcatalog . "]]>\n\t\t\n\t\t" . (!$flag->get_flag($user_id, false) ? 0 : 1) . "\n\t\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t\t" . (string) ($rating->get_average_rating() ?: null) . "\n\t\t" . $episode->total_count . "\n\t\t" . $episode->played . "\n\t\n";
} // end foreach
return self::output_xml($string, $full_xml);
@@ -920,7 +920,7 @@ public static function songs($songs, $user_id = null, $full_xml = true)
$art_url = Art::url($art_object, $art_type, Core::get_request('auth'));
$playlist_track++;
- $string .= "id . "\">\n\tf_title . "]]>\n\tf_title . "]]>\n\tartist . "\">get_artist_name() . "]]>\n\talbum . "\">get_album_name() . "]]>\n\talbumartist . "\">get_album_artist_name() . "]]>\n\tdisk . "]]>\n\t\n" . $tag_string . "\tfile . "]]>\n\t" . $playlist_track . "\n\t\n\t" . $song->year . "\n\t" . $song->bitrate . "\n\t" . $song->rate . "\n\tmode . "]]>\n\tmime . "]]>\n\tplay_url('', 'api', false, $user_id) . "]]>\n\t" . $song->size . "\n\tmbid . "]]>\n\talbum_mbid . "]]>\n\tartist_mbid . "]]>\n\talbumartist_mbid . "]]>\n\t\n\t" . (!$flag->get_flag($user_id, false) ? 0 : 1) . "\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . (string) ($rating->get_average_rating() ?: null) . "\n\t" . $song->total_count . "\n\t" . $song->catalog . "\n\tcomposer . "]]>\n\t" . $song->channels . "\n\tcomment . "]]>\n\tf_license . "]]>\n\tlabel . "]]>\n\t" . $song->language . "\n\t" . $song->replaygain_album_gain . "\n\t" . $song->replaygain_album_peak . "\n\t" . $song->replaygain_track_gain . "\n\t" . $song->replaygain_track_peak . "\n\t" . $song->r128_album_gain . "\n\t" . $song->r128_track_gain . "\n";
+ $string .= "id . "\">\n\tf_name . "]]>\n\tf_name . "]]>\n\tartist . "\">get_artist_name() . "]]>\n\talbum . "\">get_album_name() . "]]>\n\talbumartist . "\">get_album_artist_name() . "]]>\n\tdisk . "]]>\n\t\n" . $tag_string . "\tfile . "]]>\n\t" . $playlist_track . "\n\t\n\t" . $song->year . "\n\t" . $song->bitrate . "\n\t" . $song->rate . "\n\tmode . "]]>\n\tmime . "]]>\n\tplay_url('', 'api', false, $user_id) . "]]>\n\t" . $song->size . "\n\tmbid . "]]>\n\talbum_mbid . "]]>\n\tartist_mbid . "]]>\n\talbumartist_mbid . "]]>\n\t\n\t" . (!$flag->get_flag($user_id, false) ? 0 : 1) . "\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . (string) ($rating->get_average_rating() ?: null) . "\n\t" . $song->total_count . "\n\t" . $song->catalog . "\n\tcomposer . "]]>\n\t" . $song->channels . "\n\tcomment . "]]>\n\tf_license . "]]>\n\tlabel . "]]>\n\t" . $song->language . "\n\t" . $song->replaygain_album_gain . "\n\t" . $song->replaygain_album_peak . "\n\t" . $song->replaygain_track_gain . "\n\t" . $song->replaygain_track_peak . "\n\t" . $song->r128_album_gain . "\n\t" . $song->r128_track_gain . "\n";
if (Song::isCustomMetadataEnabled()) {
foreach ($song->getMetadata() as $metadata) {
$meta_name = str_replace(array(' ', '(', ')', '/', '\\', '#'), '_',
@@ -993,7 +993,7 @@ public static function democratic($object_ids = array(), $user_id = null)
$rating = new Rating($song->id, 'song');
$art_url = Art::url($song->album, 'album', Core::get_request('auth'));
- $string .= "id . "\">\n\tf_title . "]]>\n\tf_title . "]]>\n\tartist . "\">f_artist_full . "]]>\n\talbum . "\">f_album_full . "]]>\n\tgenre . "\">f_genre . "]]>\n" . $tag_string . "\t\n\t\n\tmime . "]]>\n\tplay_url('', 'api', false, $user_id) . "]]>\n\t" . $song->size . "\n\t\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . ($rating->get_average_rating() ?: null) . "\n" . $song->total_count . "\n\t" . $democratic->get_vote($row_id) . "\n\n";
+ $string .= "id . "\">\n\tf_name . "]]>\n\tf_name . "]]>\n\tartist . "\">f_artist_full . "]]>\n\talbum . "\">f_album_full . "]]>\n\tgenre . "\">f_genre . "]]>\n" . $tag_string . "\t\n\t\n\tmime . "]]>\n\tplay_url('', 'api', false, $user_id) . "]]>\n\t" . $song->size . "\n\t\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . ($rating->get_user_rating($user_id) ?: null) . "\n\t" . ($rating->get_average_rating() ?: null) . "\n" . $song->total_count . "\n\t" . $democratic->get_vote($row_id) . "\n\n";
} // end foreach
return self::output_xml($string);
diff --git a/src/Module/Application/Song/ShowSongAction.php b/src/Module/Application/Song/ShowSongAction.php
index 76e20dcde3..09ecbb42f7 100644
--- a/src/Module/Application/Song/ShowSongAction.php
+++ b/src/Module/Application/Song/ShowSongAction.php
@@ -83,7 +83,7 @@ public function run(
$this->ui->showBoxTop(
sprintf(
T_('%s Details'),
- scrub_out($song->f_title)
+ scrub_out($song->f_name)
),
'box box_song_details'
);
diff --git a/src/Module/Channel/ChannelRunner.php b/src/Module/Channel/ChannelRunner.php
index 8ce8aeb378..a7922cd531 100644
--- a/src/Module/Channel/ChannelRunner.php
+++ b/src/Module/Channel/ChannelRunner.php
@@ -256,7 +256,7 @@ public function run(
fwrite($sock, substr($clchunk, 0, $subpos));
$client['length'] += $subpos;
if ($channel->media->id != $client['metadata_lastsong']) {
- $metadata = "StreamTitle='" . str_replace('-', ' ', $channel->media->f_artist) . "-" . $channel->media->f_title . "';";
+ $metadata = "StreamTitle='" . str_replace('-', ' ', $channel->media->f_artist) . "-" . $channel->media->f_name . "';";
$metadata .= chr(0x00);
$metadatalen = ceil(strlen($metadata) / 16);
$metadata = str_pad($metadata, $metadatalen * 16, chr(0x00), STR_PAD_RIGHT);
diff --git a/src/Module/Channel/HttpServer.php b/src/Module/Channel/HttpServer.php
index ea71b4d90b..260aff1676 100644
--- a/src/Module/Channel/HttpServer.php
+++ b/src/Module/Channel/HttpServer.php
@@ -209,7 +209,7 @@ public function serve(
$xsl .= "" . "\n";
$currentsong = "";
if ($channel->media) {
- $currentsong = $channel->media->f_artist . " - " . $channel->media->f_title;
+ $currentsong = $channel->media->f_artist . " - " . $channel->media->f_name;
}
$xsl .= "" . "\n";
$xsl .= "Current Song: | " . "\n";
diff --git a/src/Module/Playback/Localplay/HttpQ/AmpacheHttpq.php b/src/Module/Playback/Localplay/HttpQ/AmpacheHttpq.php
index 7d64b949dd..dbf4d636ea 100644
--- a/src/Module/Playback/Localplay/HttpQ/AmpacheHttpq.php
+++ b/src/Module/Playback/Localplay/HttpQ/AmpacheHttpq.php
@@ -480,7 +480,7 @@ public function get()
$data['oid'] = $url_data['oid'];
$song = new Song($data['oid']);
$song->format();
- $data['name'] = $song->f_title . ' - ' . $song->f_album . ' - ' . $song->f_artist;
+ $data['name'] = $song->f_name . ' - ' . $song->f_album . ' - ' . $song->f_artist;
$data['link'] = $song->f_link;
break;
case 'demo_id':
@@ -504,7 +504,7 @@ public function get()
$media->format();
switch ($row['type']) {
case 'song':
- $data['name'] = $media->f_title . ' - ' . $media->f_album . ' - ' . $media->f_artist;
+ $data['name'] = $media->f_name . ' - ' . $media->f_album . ' - ' . $media->f_artist;
$data['link'] = $media->f_link;
break;
case 'live_stream':
diff --git a/src/Module/Playback/Localplay/Mpd/AmpacheMpd.php b/src/Module/Playback/Localplay/Mpd/AmpacheMpd.php
index 693ccf21cf..72e854e8a9 100644
--- a/src/Module/Playback/Localplay/Mpd/AmpacheMpd.php
+++ b/src/Module/Playback/Localplay/Mpd/AmpacheMpd.php
@@ -471,7 +471,7 @@ public function get()
$data['oid'] = $url_data['oid'];
$song = new Song($data['oid']);
$song->format();
- $data['name'] = $song->f_title . ' - ' . $song->f_album . ' - ' . $song->f_artist;
+ $data['name'] = $song->f_name . ' - ' . $song->f_album . ' - ' . $song->f_artist;
$data['link'] = $song->f_link;
break;
case 'demo_id':
@@ -495,7 +495,7 @@ public function get()
$media->format();
switch ($row['type']) {
case 'song':
- $data['name'] = $media->f_title . ' - ' . $media->f_album . ' - ' . $media->f_artist;
+ $data['name'] = $media->f_name . ' - ' . $media->f_album . ' - ' . $media->f_artist;
$data['link'] = $media->f_link;
break;
case 'live_stream':
diff --git a/src/Module/Playback/Localplay/Vlc/AmpacheVlc.php b/src/Module/Playback/Localplay/Vlc/AmpacheVlc.php
index a4e8b5f87f..89d7586df1 100644
--- a/src/Module/Playback/Localplay/Vlc/AmpacheVlc.php
+++ b/src/Module/Playback/Localplay/Vlc/AmpacheVlc.php
@@ -502,7 +502,7 @@ public function get()
$data['oid'] = $url_data['oid'];
$song = new Song($data['oid']);
$song->format();
- $data['name'] = $song->f_title . ' - ' . $song->f_album . ' - ' . $song->f_artist;
+ $data['name'] = $song->f_name . ' - ' . $song->f_album . ' - ' . $song->f_artist;
$data['link'] = $song->f_link;
break;
case 'demo_id':
diff --git a/src/Module/Playback/Stream_Playlist.php b/src/Module/Playback/Stream_Playlist.php
index 9c3fb4bcc1..f56679cfb9 100644
--- a/src/Module/Playback/Stream_Playlist.php
+++ b/src/Module/Playback/Stream_Playlist.php
@@ -292,7 +292,7 @@ public static function media_object_to_url($object, $additional_params = '', $ur
$url['codec'] = $object->stream_type;
break;
case 'podcast_episode':
- $url['title'] = $object->f_title;
+ $url['title'] = $object->f_name;
$url['author'] = $object->f_podcast;
$url['info_url'] = $object->f_link;
$url['image_url'] = Art::url($object->podcast, 'podcast', $api_session, (AmpConfig::get('ajax_load') ? 3 : 4));
diff --git a/src/Module/User/Activity/TypeHandler/AlbumActivityTypeHandler.php b/src/Module/User/Activity/TypeHandler/AlbumActivityTypeHandler.php
index 7209de55c7..5e4fc1bdb1 100644
--- a/src/Module/User/Activity/TypeHandler/AlbumActivityTypeHandler.php
+++ b/src/Module/User/Activity/TypeHandler/AlbumActivityTypeHandler.php
@@ -54,7 +54,7 @@ public function registerActivity(
$album->format();
$artistName = $album->f_album_artist_name;
- $albumName = $album->f_title;
+ $albumName = $album->f_name;
if ($artistName && $albumName) {
$this->userActivityRepository->registerAlbumEntry(
diff --git a/src/Module/User/Activity/TypeHandler/SongActivityTypeHandler.php b/src/Module/User/Activity/TypeHandler/SongActivityTypeHandler.php
index caeb34a149..c3f10bd6e8 100644
--- a/src/Module/User/Activity/TypeHandler/SongActivityTypeHandler.php
+++ b/src/Module/User/Activity/TypeHandler/SongActivityTypeHandler.php
@@ -53,7 +53,7 @@ public function registerActivity(
$song = $this->modelFactory->createSong($objectId);
$song->format();
- $songName = $song->f_title;
+ $songName = $song->f_name;
$artistName = $song->f_artist;
$albumName = $song->f_album;
diff --git a/src/Module/Util/AmpacheRss.php b/src/Module/Util/AmpacheRss.php
index ffd750b95a..2d5ba34870 100644
--- a/src/Module/Util/AmpacheRss.php
+++ b/src/Module/Util/AmpacheRss.php
@@ -286,7 +286,7 @@ public static function load_recently_played($rsstoken = "")
$song->format();
$xml_array = array(
- 'title' => $song->f_title . ' - ' . $song->f_artist . ' - ' . $song->f_album,
+ 'title' => $song->f_name . ' - ' . $song->f_artist . ' - ' . $song->f_album,
'link' => str_replace('&', '&', $song->link),
'description' => $song->title . ' - ' . $song->f_artist_full . ' - ' . $song->f_album_full,
'comments' => $client->username,
diff --git a/src/Repository/Model/Album.php b/src/Repository/Model/Album.php
index 4e3993dba1..859988fc70 100644
--- a/src/Repository/Model/Album.php
+++ b/src/Repository/Model/Album.php
@@ -225,11 +225,6 @@ class Album extends database_object implements library_item
*/
public $f_year_link;
- /**
- * @var string $f_title
- */
- public $f_title;
-
/**
* @var string $f_release_type
*/
@@ -285,7 +280,6 @@ public function __construct($album_id)
}
// Little bit of formatting here
- $this->f_name = trim(trim((string) $info['prefix']) . ' ' . trim((string) $info['name']));
$this->total_duration = (int)$this->time;
$this->total_count = (int)$this->total_count;
$this->addition_time = (int)$this->addition_time;
@@ -299,6 +293,8 @@ public function __construct($album_id)
// Looking for other albums with same mbid, ordering by disk ascending
if (AmpConfig::get('album_group')) {
$this->allow_group_disks = true;
+ }
+ if ($this->allow_group_disks) {
// don't reset and query if it's all going to be the same
if (count($this->album_suite) > 1) {
$this->total_duration = 0;
@@ -313,6 +309,8 @@ public function __construct($album_id)
}
}
}
+ // finally; set up your formatted name
+ $this->f_name = $this->get_fullname();
return true;
} // constructor
@@ -597,18 +595,17 @@ public function format($details = true, $limit_threshold = '')
$this->tags = Tag::get_top_tags('album', $this->id);
$this->f_tags = Tag::get_display($this->tags, true, 'album');
}
- $this->f_title = $this->f_name;
$this->link = $web_path . '/albums.php?action=show&album=' . scrub_out($this->id);
$this->f_link = "link . "\" title=\"" . scrub_out($this->f_name) . "\">" . scrub_out($this->f_name);
// Looking if we need to display the release year
if ($show_year) {
- $this->f_title .= " (" . $this->year . ")";
+ $this->f_name .= " (" . $this->year . ")";
$this->f_link .= " (" . $this->year . ")";
}
// Looking if we need to combine or display disks
if ($this->disk && !$this->allow_group_disks && count($this->album_suite) > 1) {
- $this->f_title .= " [" . T_('Disk') . " " . $this->disk . "]";
+ $this->f_name .= " [" . T_('Disk') . " " . $this->disk . "]";
$this->f_link .= " [" . T_('Disk') . " " . $this->disk . "]";
}
$this->f_link .= "";
@@ -674,6 +671,20 @@ public function get_keywords()
*/
public function get_fullname()
{
+ // don't do anything if it's formatted
+ if (isset($this->f_name)) {
+ return $this->f_name;
+ }
+ $this->f_name = trim(trim($this->prefix . ' ' . trim($this->name)));
+ // Looking if we need to display the release year
+ if ($this->original_year && AmpConfig::get('use_original_year') && $this->original_year != $this->year) {
+ $this->f_name .= " (" . $this->year . ")";
+ }
+ // Looking if we need to combine or display disks
+ if ($this->disk && !$this->allow_group_disks && count($this->album_suite) > 1) {
+ $this->f_name .= " [" . T_('Disk') . " " . $this->disk . "]";
+ }
+
return $this->f_name;
}
diff --git a/src/Repository/Model/Artist.php b/src/Repository/Model/Artist.php
index a0e64cd8f2..c672fcadc0 100644
--- a/src/Repository/Model/Artist.php
+++ b/src/Repository/Model/Artist.php
@@ -197,7 +197,6 @@ public function __construct($artist_id = null, $catalog_init = 0)
return false;
}
- $this->catalog_id = $catalog_init;
/* Get the information from the db */
$info = $this->get_info($artist_id);
@@ -205,14 +204,15 @@ public function __construct($artist_id = null, $catalog_init = 0)
$this->$key = $value;
} // foreach info
- // set the full name
- $this->f_name = trim(trim((string) $info['prefix']) . ' ' . trim((string) $info['name']));
// make sure the int values are cast to integers
$this->total_count = (int)$this->total_count;
$this->time = (int)$this->time;
$this->album_count = (int)$this->album_count;
$this->album_group_count = (int)$this->album_group_count;
$this->song_count = (int)$this->song_count;
+ $this->catalog_id = (int)$catalog_init;
+
+ $this->get_fullname();
return true;
} // constructor
@@ -406,7 +406,7 @@ public static function get_id_arrays($catalogs = array())
}
}
} else {
- $sql = "SELECT DISTINCT `artist`.`id`, LTRIM(CONCAT(COALESCE(`artist`.`prefix`, ''), ' ', `artist`.`name`)) AS `f_name`, `artist`.`name`, $group_column AS `album_count`, `artist`.`song_count` FROM `artist` ORDER BY `artist`.`name`";
+ $sql = "SELECT DISTINCT `artist`.`id`, LTRIM(CONCAT(COALESCE(`artist`.`prefix`, ''), ' ', `artist`.`name`)) AS `f_name`, `artist`.`name`, $group_column AS `album_count`, `artist`.`song_count` FROM `artist` ORDER BY `artist`.`name`";
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results, false)) {
$results[] = $row;
@@ -426,7 +426,7 @@ public static function get_id_arrays($catalogs = array())
public static function get_id_array($artist_id)
{
$group_column = (AmpConfig::get('album_group')) ? '`artist`.`album_group_count`' : '`artist`.`album_count`';
- $sql = "SELECT DISTINCT `artist`.`id`, LTRIM(CONCAT(COALESCE(`artist`.`prefix`, ''), ' ', `artist`.`name`)) AS `f_name`, `artist`.`name`, $group_column AS `album_count`, `artist`.`song_count` FROM `artist` WHERE `artist`.`id` = ? ORDER BY `artist`.`name`";
+ $sql = "SELECT DISTINCT `artist`.`id`, LTRIM(CONCAT(COALESCE(`artist`.`prefix`, ''), ' ', `artist`.`name`)) AS `f_name`, `artist`.`name`, $group_column AS `album_count`, `artist`.`song_count`, `catalog_map`.`catalog_id` FROM `artist` LEFT JOIN `catalog_map` ON `catalog_map`.`object_type` = 'artist' AND `catalog_map`.`object_id` = `artist`.`id` AND `catalog_map`.`catalog_id` = (SELECT MIN(`catalog_map`.`catalog_id`) FROM `catalog_map` WHERE `catalog_map`.`object_type` = 'artist' AND `catalog_map`.`object_id` = `artist`.`id`) WHERE `artist`.`id` = ? ORDER BY `artist`.`name`";
$db_results = Dba::read($sql, array($artist_id));
$row = Dba::fetch_assoc($db_results, false);
@@ -470,7 +470,7 @@ public function format($details = true, $limit_threshold = '')
}
$this->songs = $this->song_count;
$this->albums = (AmpConfig::get('album_group')) ? $this->album_group_count : $this->album_count;
- $this->link = ($this->catalog_id)
+ $this->link = ($this->catalog_id > 0)
? AmpConfig::get('web_path') . '/artists.php?action=show&catalog=' . $this->catalog_id . '&artist=' . $this->id
: AmpConfig::get('web_path') . '/artists.php?action=show&artist=' . $this->id;
$this->f_link = "link . "\" title=\"" . scrub_out($this->f_name) . "\">" . scrub_out($this->f_name) . "";
@@ -520,7 +520,13 @@ public function get_keywords()
*/
public function get_fullname()
{
- return $this->f_name;
+ // don't do anything if it's formatted
+ if (isset($this->f_name)) {
+ return $this->f_name;
+ }
+
+ // set the full name
+ $this->f_name = trim(trim($this->prefix . ' ' . trim($this->name)));
}
/**
diff --git a/src/Repository/Model/Movie.php b/src/Repository/Model/Movie.php
index 927b2c19da..07c2ff0418 100644
--- a/src/Repository/Model/Movie.php
+++ b/src/Repository/Model/Movie.php
@@ -135,10 +135,10 @@ public function format($details = true)
{
parent::format($details);
- $this->f_original_name = trim((string)$this->prefix . " " . $this->f_title);
- $this->f_title = ($this->f_original_name ?: $this->f_title);
- $this->f_full_title = $this->f_title;
- $this->f_link = '' . scrub_out($this->f_title) . '';
+ $this->f_original_name = trim((string)$this->prefix . " " . $this->f_name);
+ $this->f_name = ($this->f_original_name ?: $this->f_name);
+ $this->f_full_title = $this->f_name;
+ $this->f_link = '' . scrub_out($this->f_name) . '';
return true;
} // format
diff --git a/src/Repository/Model/Podcast.php b/src/Repository/Model/Podcast.php
index 478690d21e..eb20314561 100644
--- a/src/Repository/Model/Podcast.php
+++ b/src/Repository/Model/Podcast.php
@@ -49,7 +49,7 @@ class Podcast extends database_object implements library_item
public $total_count;
public $episodes;
- public $f_title;
+ public $f_name;
public $f_website;
public $f_description;
public $f_language;
@@ -140,7 +140,7 @@ public function get_episodes($state_filter = '')
*/
public function format($details = true)
{
- $this->f_title = $this->title;
+ $this->f_name = $this->title;
$this->f_description = scrub_out($this->description);
$this->f_language = scrub_out($this->language);
$this->f_copyright = scrub_out($this->copyright);
@@ -149,7 +149,7 @@ public function format($details = true)
$this->f_lastbuilddate = date("c", (int)$this->lastbuilddate);
$this->f_lastsync = date("c", (int)$this->lastsync);
$this->link = AmpConfig::get('web_path') . '/podcast.php?action=show&podcast=' . $this->id;
- $this->f_link = '' . scrub_out($this->f_title) . '';
+ $this->f_link = '' . scrub_out($this->f_name) . '';
$this->f_website_link = "website . "\">" . $this->website . "";
return true;
@@ -165,7 +165,7 @@ public function get_keywords()
$keywords['podcast'] = array(
'important' => true,
'label' => T_('Podcast'),
- 'value' => $this->f_title
+ 'value' => $this->f_name
);
return $keywords;
@@ -178,7 +178,7 @@ public function get_keywords()
*/
public function get_fullname()
{
- return $this->f_title;
+ return $this->f_name;
}
/**
diff --git a/src/Repository/Model/Podcast_Episode.php b/src/Repository/Model/Podcast_Episode.php
index 325071d271..bf9cc13b6e 100644
--- a/src/Repository/Model/Podcast_Episode.php
+++ b/src/Repository/Model/Podcast_Episode.php
@@ -59,7 +59,7 @@ class Podcast_Episode extends database_object implements Media, library_item, Ga
public $enabled;
public $total_count;
public $catalog;
- public $f_title;
+ public $f_name;
public $f_file;
public $f_size;
public $f_time;
@@ -143,7 +143,7 @@ public function get_catalogs()
*/
public function format($details = true)
{
- $this->f_title = $this->title;
+ $this->f_name = $this->title;
$this->f_description = scrub_out($this->description);
$this->f_category = scrub_out($this->category);
$this->f_author = scrub_out($this->author);
@@ -161,15 +161,15 @@ public function format($details = true)
$this->f_time_h = $hour . ":" . $min_h . ":" . $sec;
// Format the Size
$this->f_size = Ui::format_bytes($this->size);
- $this->f_file = $this->f_title . '.' . $this->type;
+ $this->f_file = $this->f_name . '.' . $this->type;
$this->link = AmpConfig::get('web_path') . '/podcast_episode.php?action=show&podcast_episode=' . $this->id;
- $this->f_link = '' . scrub_out($this->f_title) . '';
+ $this->f_link = '' . scrub_out($this->f_name) . '';
if ($details) {
$podcast = new Podcast($this->podcast);
$podcast->format();
- $this->f_podcast = $podcast->f_title;
+ $this->f_podcast = $podcast->f_name;
$this->f_podcast_link = $podcast->f_link;
$this->f_file = $this->f_podcast . ' - ' . $this->f_file;
}
@@ -194,7 +194,7 @@ public function get_keywords()
$keywords['title'] = array(
'important' => true,
'label' => T_('Title'),
- 'value' => $this->f_title
+ 'value' => $this->f_name
);
return $keywords;
@@ -205,7 +205,7 @@ public function get_keywords()
*/
public function get_fullname()
{
- return $this->f_title;
+ return $this->f_name;
}
/**
@@ -412,7 +412,7 @@ private static function _update_item($field, $value, $song_id, $level)
*/
public function get_stream_name()
{
- return $this->f_podcast . " - " . $this->f_title;
+ return $this->f_podcast . " - " . $this->f_name;
}
/**
diff --git a/src/Repository/Model/Song.php b/src/Repository/Model/Song.php
index 17320be8ac..1be8882fba 100755
--- a/src/Repository/Model/Song.php
+++ b/src/Repository/Model/Song.php
@@ -210,9 +210,9 @@ class Song extends database_object implements Media, library_item, GarbageCollec
*/
public $r128_track_gain;
/**
- * @var string $f_title
+ * @var string $f_name
*/
- public $f_title;
+ public $f_name;
/**
* @var string $f_artist
*/
@@ -266,9 +266,9 @@ class Song extends database_object implements Media, library_item, GarbageCollec
*/
public $f_file;
/**
- * @var string $f_title_full
+ * @var string $f_name_full
*/
- public $f_title_full;
+ public $f_name_full;
/**
* @var string $f_link
*/
@@ -1673,12 +1673,12 @@ public function format($details = true)
$this->f_albumartist_full = $this->get_album_artist_name();
// Format the title
- $this->f_title = $this->title;
- $this->f_title_full = $this->f_title;
+ $this->f_name = $this->title;
+ $this->f_name_full = $this->f_name;
// Create Links for the different objects
$this->link = AmpConfig::get('web_path') . "/song.php?action=show_song&song_id=" . $this->id;
- $this->f_link = "link) . "\" title=\"" . scrub_out($this->f_artist) . " - " . scrub_out($this->f_title) . "\"> " . scrub_out($this->f_title) . "";
+ $this->f_link = "link) . "\" title=\"" . scrub_out($this->f_artist) . " - " . scrub_out($this->f_name) . "\"> " . scrub_out($this->f_name) . "";
$this->f_album_link = "album . "\" title=\"" . scrub_out($this->f_album_full) . "\"> " . scrub_out($this->f_album) . "";
$this->f_artist_link = "artist . "\" title=\"" . scrub_out($this->f_artist_full) . "\"> " . scrub_out($this->f_artist) . "";
if (!empty($this->albumartist)) {
@@ -1708,7 +1708,7 @@ public function format($details = true)
if ($this->track) {
$this->f_file .= $this->track . ' - ';
}
- $this->f_file .= $this->f_title . '.' . $this->type;
+ $this->f_file .= $this->f_name . '.' . $this->type;
$this->f_publisher = $this->label;
$this->f_composer = $this->composer;
@@ -1743,7 +1743,7 @@ public function get_keywords()
$keywords['title'] = array(
'important' => true,
'label' => T_('Title'),
- 'value' => $this->f_title
+ 'value' => $this->f_name
);
return $keywords;
@@ -1764,7 +1764,7 @@ public function get_totalcount()
*/
public function get_fullname()
{
- return $this->f_title;
+ return $this->f_name;
}
/**
@@ -2253,7 +2253,7 @@ public function run_custom_play_action($action_index, $codec = '')
$run = str_replace("%c", $codec, $run);
$run = str_replace("%a", $this->f_artist, $run);
$run = str_replace("%A", $this->f_album, $run);
- $run = str_replace("%t", $this->f_title, $run);
+ $run = str_replace("%t", $this->f_name, $run);
debug_event(self::class, "Running custom play action: " . $run, 3);
diff --git a/src/Repository/Model/Song_Preview.php b/src/Repository/Model/Song_Preview.php
index b473081426..daa46f1fa3 100644
--- a/src/Repository/Model/Song_Preview.php
+++ b/src/Repository/Model/Song_Preview.php
@@ -52,8 +52,8 @@ class Song_Preview extends database_object implements Media, playable_item
public $f_artist;
public $f_artist_full;
public $f_artist_link;
- public $f_title;
- public $f_title_full;
+ public $f_name;
+ public $f_name_full;
public $link;
public $f_link;
public $f_album_link;
@@ -242,11 +242,11 @@ public function format($details = true)
$this->f_artist = $this->f_artist_full;
// Format the title
- $this->f_title_full = $this->title;
- $this->f_title = $this->title;
+ $this->f_name_full = $this->title;
+ $this->f_name = $this->title;
$this->link = "#";
- $this->f_link = "link) . "\" title=\"" . scrub_out($this->f_artist) . " - " . scrub_out($this->title) . "\"> " . scrub_out($this->f_title) . "";
+ $this->f_link = "link) . "\" title=\"" . scrub_out($this->f_artist) . " - " . scrub_out($this->title) . "\"> " . scrub_out($this->f_name) . "";
$this->f_album_link = "album_mbid . "&artist=" . $this->artist . "\" title=\"" . $this->f_album . "\">" . $this->f_album . "";
// Format the track (there isn't really anything to do here)
@@ -260,7 +260,7 @@ public function format($details = true)
*/
public function get_fullname()
{
- return $this->f_title;
+ return $this->f_name;
}
/**
diff --git a/src/Repository/Model/TVShow_Episode.php b/src/Repository/Model/TVShow_Episode.php
index c2962c92df..d5171a35ea 100644
--- a/src/Repository/Model/TVShow_Episode.php
+++ b/src/Repository/Model/TVShow_Episode.php
@@ -179,8 +179,8 @@ public function format($details = true)
$season = new TVShow_Season($this->season);
$season->format($details);
- $this->f_title = ($this->original_name ?: $this->f_title);
- $this->f_link = '' . scrub_out($this->f_title) . '';
+ $this->f_name = ($this->original_name ?: $this->f_name);
+ $this->f_link = '' . scrub_out($this->f_name) . '';
$this->f_season = $season->f_name;
$this->f_season_link = $season->f_link;
$this->f_tvshow = $season->f_tvshow;
@@ -191,7 +191,7 @@ public function format($details = true)
$this->f_file .= ' - S' . sprintf('%02d', $season->season_number) . 'E' . sprintf('%02d',
$this->episode_number);
}
- $this->f_file .= ' - ' . $this->f_title;
+ $this->f_file .= ' - ' . $this->f_name;
$this->f_full_title = $this->f_file;
return true;
diff --git a/src/Repository/Model/Video.php b/src/Repository/Model/Video.php
index d4815357ef..9aa9218ad4 100644
--- a/src/Repository/Model/Video.php
+++ b/src/Repository/Model/Video.php
@@ -149,9 +149,9 @@ class Video extends database_object implements Media, library_item, GarbageColle
*/
public $addition_time;
/**
- * @var string $f_title
+ * @var string $f_name
*/
- public $f_title;
+ public $f_name;
/**
* @var string $f_full_title
*/
@@ -302,10 +302,10 @@ public static function build_cache($ids)
*/
public function format($details = true)
{
- $this->f_title = filter_var($this->title, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
- $this->f_full_title = $this->f_title;
+ $this->f_name = filter_var($this->title, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
+ $this->f_full_title = $this->f_name;
$this->link = AmpConfig::get('web_path') . "/video.php?action=show_video&video_id=" . $this->id;
- $this->f_link = "link . "\" title=\"" . $this->f_title . "\"> " . $this->f_title . "";
+ $this->f_link = "link . "\" title=\"" . $this->f_name . "\"> " . $this->f_name . "";
$this->f_codec = $this->video_codec . ' / ' . $this->audio_codec;
if ($this->resolution_x || $this->resolution_y) {
$this->f_resolution = $this->resolution_x . 'x' . $this->resolution_y;
@@ -339,7 +339,7 @@ public function format($details = true)
}
$this->f_length = floor($this->time / 60) . ' ' . T_('minutes');
- $this->f_file = $this->f_title . '.' . $this->type;
+ $this->f_file = $this->f_name . '.' . $this->type;
if ($this->release_date) {
$this->f_release_date = get_datetime((int) $this->release_date, 'short', 'none');
}
@@ -354,7 +354,7 @@ public function get_keywords()
$keywords = array();
$keywords['title'] = array('important' => true,
'label' => T_('Title'),
- 'value' => $this->f_title);
+ 'value' => $this->f_name);
return $keywords;
}
@@ -365,7 +365,7 @@ public function get_keywords()
*/
public function get_fullname()
{
- return $this->f_title;
+ return $this->f_name;
}
/**
diff --git a/tests/Module/Application/Song/ShowSongActionTest.php b/tests/Module/Application/Song/ShowSongActionTest.php
index b31ce4c328..55ab057e12 100644
--- a/tests/Module/Application/Song/ShowSongActionTest.php
+++ b/tests/Module/Application/Song/ShowSongActionTest.php
@@ -139,7 +139,7 @@ public function testRunRendersSongDetails(): void
$content = 'some-content';
$song->id = $song_id;
- $song->f_title = $title;
+ $song->f_name = $title;
$request->shouldReceive('getQueryParams')
->withNoArgs()
diff --git a/tests/Module/User/Activity/TypeHandler/AlbumActivityTypeHandlerTest.php b/tests/Module/User/Activity/TypeHandler/AlbumActivityTypeHandlerTest.php
index ecde82667e..b8390d3a6a 100644
--- a/tests/Module/User/Activity/TypeHandler/AlbumActivityTypeHandlerTest.php
+++ b/tests/Module/User/Activity/TypeHandler/AlbumActivityTypeHandlerTest.php
@@ -74,7 +74,7 @@ public function testRegisterActivityRegisterAlbumActivity(): void
->withNoArgs()
->once();
$album->f_album_artist_name = $albumArtistName;
- $album->f_title = $albumName;
+ $album->f_name = $albumName;
$album->mbid_group = $musicBrainzIdGroup;
$album->mbid = $musicBrainzId;
@@ -121,7 +121,7 @@ public function testRegisterActivityRegisterGenericActivity(): void
->withNoArgs()
->once();
$album->f_album_artist_name = $albumArtistName;
- $album->f_title = '';
+ $album->f_name = '';
$this->useractivityRepository->shouldReceive('registerGenericEntry')
->with(
diff --git a/tests/Module/User/Activity/TypeHandler/ArtistActivityTypeHandlerTest.php b/tests/Module/User/Activity/TypeHandler/ArtistActivityTypeHandlerTest.php
index aa97a3a142..225fba39b6 100644
--- a/tests/Module/User/Activity/TypeHandler/ArtistActivityTypeHandlerTest.php
+++ b/tests/Module/User/Activity/TypeHandler/ArtistActivityTypeHandlerTest.php
@@ -114,7 +114,7 @@ public function testRegisterActivityRegisterGenericActivity(): void
$artist->shouldReceive('format')
->withNoArgs()
->once();
- $artist->f_title = '';
+ $artist->f_name = '';
$this->useractivityRepository->shouldReceive('registerGenericEntry')
->with(
diff --git a/tests/Module/User/Activity/TypeHandler/SongActivityTypeHandlerTest.php b/tests/Module/User/Activity/TypeHandler/SongActivityTypeHandlerTest.php
index 2b696ba6b9..6a0e39c059 100644
--- a/tests/Module/User/Activity/TypeHandler/SongActivityTypeHandlerTest.php
+++ b/tests/Module/User/Activity/TypeHandler/SongActivityTypeHandlerTest.php
@@ -76,7 +76,7 @@ public function testRegisterActivityRegisterAlbumActivity(): void
$song->shouldReceive('format')
->withNoArgs()
->once();
- $song->f_title = $songName;
+ $song->f_name = $songName;
$song->f_artist = $artistName;
$song->f_album = $albumName;
$song->mbid = $songMusicBrainzId;
@@ -126,7 +126,7 @@ public function testRegisterActivityRegisterGenericActivity(): void
$song->shouldReceive('format')
->withNoArgs()
->once();
- $song->f_title = '';
+ $song->f_name = '';
$this->useractivityRepository->shouldReceive('registerGenericEntry')
->with(