diff options
-rw-r--r-- | system/settings/settings.xml | 27 | ||||
-rw-r--r-- | xbmc/filesystem/PluginDirectory.cpp | 6 | ||||
-rw-r--r-- | xbmc/music/Album.cpp | 6 | ||||
-rw-r--r-- | xbmc/music/Album.h | 5 | ||||
-rw-r--r-- | xbmc/music/GUIViewStateMusic.cpp | 150 | ||||
-rw-r--r-- | xbmc/music/MusicDatabase.cpp | 6 | ||||
-rw-r--r-- | xbmc/music/MusicDatabase.h | 1 | ||||
-rw-r--r-- | xbmc/music/tags/MusicInfoTag.cpp | 1 | ||||
-rw-r--r-- | xbmc/music/windows/GUIWindowMusicPlaylist.cpp | 11 | ||||
-rw-r--r-- | xbmc/music/windows/GUIWindowMusicPlaylistEditor.cpp | 2 | ||||
-rw-r--r-- | xbmc/settings/AdvancedSettings.cpp | 2 | ||||
-rw-r--r-- | xbmc/settings/AdvancedSettings.h | 1 | ||||
-rw-r--r-- | xbmc/settings/Settings.cpp | 4 | ||||
-rw-r--r-- | xbmc/settings/Settings.h | 3 | ||||
-rw-r--r-- | xbmc/utils/LabelFormatter.cpp | 2 | ||||
-rw-r--r-- | xbmc/video/GUIViewStateVideo.cpp | 10 |
16 files changed, 82 insertions, 155 deletions
diff --git a/system/settings/settings.xml b/system/settings/settings.xml index a0e3f2d215..bc81310b7e 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -1865,13 +1865,6 @@ <heading>16016</heading> </control> </setting> - <setting id="musicfiles.trackformatright" type="string" label="13387" help="36276"> - <level>2</level> - <default>%D</default> - <control type="edit" format="string"> - <heading>16016</heading> - </control> - </setting> <setting id="musicfiles.nowplayingtrackformat" type="string" label="13307" help="36277"> <level>4</level> <default></default> @@ -1882,16 +1875,6 @@ <heading>16016</heading> </control> </setting> - <setting id="musicfiles.nowplayingtrackformatright" type="string" label="13387" help="36278"> - <level>4</level> - <default></default> - <constraints> - <allowempty>true</allowempty> - </constraints> - <control type="edit" format="string"> - <heading>16016</heading> - </control> - </setting> <setting id="musicfiles.librarytrackformat" type="string" label="13307" help="36279"> <level>4</level> <default></default> @@ -1902,16 +1885,6 @@ <heading>16016</heading> </control> </setting> - <setting id="musicfiles.librarytrackformatright" type="string" label="13387" help="36280"> - <level>4</level> - <default></default> - <constraints> - <allowempty>true</allowempty> - </constraints> - <control type="edit" format="string"> - <heading>16016</heading> - </control> - </setting> <setting id="musicfiles.findremotethumbs" type="boolean" label="14059" help="36281"> <level>0</level> <default>true</default> diff --git a/xbmc/filesystem/PluginDirectory.cpp b/xbmc/filesystem/PluginDirectory.cpp index db378b8cef..6e848d0404 100644 --- a/xbmc/filesystem/PluginDirectory.cpp +++ b/xbmc/filesystem/PluginDirectory.cpp @@ -345,10 +345,8 @@ void CPluginDirectory::AddSortMethod(int handle, SORT_METHOD sortMethod, const s } case SORT_METHOD_PLAYLIST_ORDER: { - std::string strTrackLeft=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - std::string strTrackRight=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); - - dir->m_listItems->AddSortMethod(SortByPlaylistOrder, 559, LABEL_MASKS(strTrackLeft, strTrackRight)); + std::string strTrack=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); + dir->m_listItems->AddSortMethod(SortByPlaylistOrder, 559, LABEL_MASKS(strTrack, "%D")); break; } case SORT_METHOD_EPISODE: diff --git a/xbmc/music/Album.cpp b/xbmc/music/Album.cpp index fb2b95baf2..5836a63f11 100644 --- a/xbmc/music/Album.cpp +++ b/xbmc/music/Album.cpp @@ -109,6 +109,7 @@ CAlbum::CAlbum(const CFileItem& item) bCompilation = tag.GetCompilation(); iTimesPlayed = 0; dateAdded.Reset(); + lastPlayed.Reset(); releaseType = tag.GetAlbumReleaseType(); } @@ -208,6 +209,11 @@ void CAlbum::SetDateAdded(const std::string& strDateAdded) dateAdded.SetFromDBDateTime(strDateAdded); } +void CAlbum::SetLastPlayed(const std::string& strLastPlayed) +{ + lastPlayed.SetFromDBDateTime(strLastPlayed); +} + std::string CAlbum::ReleaseTypeToString(CAlbum::ReleaseType releaseType) { for (size_t i = 0; i < RELEASE_TYPES_SIZE; i++) diff --git a/xbmc/music/Album.h b/xbmc/music/Album.h index ad73ad6d25..63965530aa 100644 --- a/xbmc/music/Album.h +++ b/xbmc/music/Album.h @@ -37,7 +37,7 @@ class CAlbum { public: CAlbum(const CFileItem& item); - CAlbum() { idAlbum = 0; iRating = 0; iYear = 0; iTimesPlayed = 0; dateAdded.Reset(); releaseType = Album; }; + CAlbum() { idAlbum = 0; iRating = 0; iYear = 0; iTimesPlayed = 0; dateAdded.Reset(); lastPlayed.Reset(); releaseType = Album; }; bool operator<(const CAlbum &a) const; void MergeScrapedAlbum(const CAlbum& album, bool override = true); @@ -65,6 +65,7 @@ public: bCompilation = false; iTimesPlayed = 0; dateAdded.Reset(); + lastPlayed.Reset(); songs.clear(); infoSongs.clear(); releaseType = Album; @@ -89,6 +90,7 @@ public: std::string GetReleaseType() const; void SetReleaseType(const std::string& strReleaseType); void SetDateAdded(const std::string& strDateAdded); + void SetLastPlayed(const std::string& strLastPlayed); static std::string ReleaseTypeToString(ReleaseType releaseType); static ReleaseType ReleaseTypeFromString(const std::string& strReleaseType); @@ -125,6 +127,7 @@ public: bool bCompilation; int iTimesPlayed; CDateTime dateAdded; + CDateTime lastPlayed; VECSONGS songs; ///< Local songs VECSONGS infoSongs; ///< Scraped songs ReleaseType releaseType; diff --git a/xbmc/music/GUIViewStateMusic.cpp b/xbmc/music/GUIViewStateMusic.cpp index 40992802b4..aa786d820e 100644 --- a/xbmc/music/GUIViewStateMusic.cpp +++ b/xbmc/music/GUIViewStateMusic.cpp @@ -67,25 +67,11 @@ VECSOURCES& CGUIViewStateWindowMusic::GetSources() CGUIViewStateMusicSearch::CGUIViewStateMusicSearch(const CFileItemList& items) : CGUIViewStateWindowMusic(items) { - std::string strTrackLeft=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_LIBRARYTRACKFORMAT); - if (strTrackLeft.empty()) - strTrackLeft = CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - std::string strTrackRight=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_LIBRARYTRACKFORMATRIGHT); - if (strTrackRight.empty()) - strTrackRight = CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); - - std::string strAlbumLeft = g_advancedSettings.m_strMusicLibraryAlbumFormat; - if (strAlbumLeft.empty()) - strAlbumLeft = "%B"; // album - std::string strAlbumRight = g_advancedSettings.m_strMusicLibraryAlbumFormatRight; - if (strAlbumRight.empty()) - strAlbumRight = "%A"; // artist - SortAttribute sortAttribute = SortAttributeNone; if (CSettings::GetInstance().GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING)) sortAttribute = SortAttributeIgnoreArticle; - AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D", "%L", "%A")); // Title, Artist, Duration| empty, empty + AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D", "%L", "%A")); // Title - Artist, Duration | Label, Artist SetSortMethod(SortByTitle); const CViewState *viewState = CViewStateSettings::GetInstance().Get("musicnavsongs"); @@ -105,23 +91,13 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item CMusicDatabaseDirectory dir; NODE_TYPE NodeType=dir.GetDirectoryChildType(items.GetPath()); - std::string strTrackLeft=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_LIBRARYTRACKFORMAT); - if (strTrackLeft.empty()) - strTrackLeft = CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - std::string strTrackRight=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_LIBRARYTRACKFORMATRIGHT); - if (strTrackRight.empty()) - strTrackRight = CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); - - std::string strAlbumLeft = g_advancedSettings.m_strMusicLibraryAlbumFormat; - if (strAlbumLeft.empty()) - strAlbumLeft = "%B"; // album - std::string strAlbumRight = g_advancedSettings.m_strMusicLibraryAlbumFormatRight; - if (strAlbumRight.empty()) - strAlbumRight = "%A"; // artist - - CLog::Log(LOGDEBUG,"Album format left = [%s]", strAlbumLeft.c_str()); - CLog::Log(LOGDEBUG,"Album format right = [%s]", strAlbumRight.c_str()); - + std::string strTrack=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_LIBRARYTRACKFORMAT); + if (strTrack.empty()) + strTrack = CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); + std::string strAlbum = g_advancedSettings.m_strMusicLibraryAlbumFormat; + if (strAlbum.empty()) + strAlbum = "%B"; // album + CLog::Log(LOGDEBUG,"Custom album format = [%s]", strAlbum.c_str()); SortAttribute sortAttribute = SortAttributeNone; if (CSettings::GetInstance().GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING)) sortAttribute = SortAttributeIgnoreArticle; @@ -184,17 +160,17 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item case NODE_TYPE_YEAR_ALBUM: { // album - AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined + AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%F", "", strAlbum, "%B")); // Filename, empty | Userdefined, Album // artist - AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined + AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%F", "", strAlbum, "%A")); // Filename, empty | Userdefined, Artist // artist / year - AddSortMethod(SortByArtistThenYear, sortAttribute, 578, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined + AddSortMethod(SortByArtistThenYear, sortAttribute, 578, LABEL_MASKS("%F", "", strAlbum, "%A / %Y")); // Filename, empty | Userdefined, Artist / Year // year - AddSortMethod(SortByYear, 562, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); + AddSortMethod(SortByYear, 562, LABEL_MASKS("%F", "", strAlbum, "%Y")); // Filename, empty | Userdefined, Year // album date added - AddSortMethod(SortByDateAdded, sortAttribute, 570, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined + AddSortMethod(SortByDateAdded, sortAttribute, 570, LABEL_MASKS("%F", "", strAlbum, "%a")); // Filename, empty | Userdefined, dateAdded // play count - AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined + AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%F", "", strAlbum, "%V")); // Filename, empty | Userdefined, Play count const CViewState *viewState = CViewStateSettings::GetInstance().Get("musicnavalbums"); SetSortMethod(viewState->m_sortDescription); @@ -204,7 +180,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item break; case NODE_TYPE_ALBUM_RECENTLY_ADDED: { - AddSortMethod(SortByNone, 552, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined + AddSortMethod(SortByNone, 552, LABEL_MASKS("%F", "", strAlbum, "%a")); // Filename, empty | Userdefined, dateAdded SetSortMethod(SortByNone); SetViewAsControl(CViewStateSettings::GetInstance().Get("musicnavalbums")->m_viewMode); @@ -214,7 +190,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item break; case NODE_TYPE_ALBUM_RECENTLY_ADDED_SONGS: { - AddSortMethod(SortByNone, 552, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty + AddSortMethod(SortByNone, 552, LABEL_MASKS(strTrack, "%a")); // Userdefined, dateAdded | empty, empty SetSortMethod(SortByNone); SetViewAsControl(CViewStateSettings::GetInstance().Get("musicnavsongs")->m_viewMode); @@ -224,27 +200,21 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item break; case NODE_TYPE_ALBUM_RECENTLY_PLAYED: { - AddSortMethod(SortByNone, 568, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined - SetSortMethod(SortByNone); + AddSortMethod(SortByLastPlayed, 568, LABEL_MASKS("%F", "", strAlbum, "%p")); // Filename, empty | Userdefined, last played SetViewAsControl(CViewStateSettings::GetInstance().Get("musicnavalbums")->m_viewMode); - - SetSortOrder(SortOrderNone); } break; case NODE_TYPE_ALBUM_RECENTLY_PLAYED_SONGS: { - AddSortMethod(SortByNone, 568, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty - SetSortMethod(SortByNone); + AddSortMethod(SortByLastPlayed, 568, LABEL_MASKS(strTrack, "%p")); // Userdefined, last played | empty, empty SetViewAsControl(CViewStateSettings::GetInstance().Get("musicnavalbums")->m_viewMode); - - SetSortOrder(SortOrderNone); } break; case NODE_TYPE_ALBUM_TOP100: { - AddSortMethod(SortByNone, 551, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined + AddSortMethod(SortByNone, 551, LABEL_MASKS("%F", "", strAlbum, "%V")); // Filename, empty | Userdefined, Play count SetSortMethod(SortByNone); SetViewAsControl(DEFAULT_VIEW_LIST); @@ -256,7 +226,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Title, Duration| empty, empty AddSortMethod(SortByArtistThenYear, sortAttribute, 578, LABEL_MASKS("%A - %T", "%D")); // Artist, Title, Duration| empty, empty AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty - AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrackLeft, strTrackRight)); + AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrack, "%D")); AddSortMethod(SortByTime, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty AddSortMethod(SortByRating, 563, LABEL_MASKS("%T - %A", "%R")); // Title - Artist, Rating AddSortMethod(SortByDateAdded, 570, LABEL_MASKS("%T - %A", "%a")); // Title - Artist, DateAdded | empty, empty @@ -272,12 +242,12 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item case NODE_TYPE_YEAR_SONG: case NODE_TYPE_SONG: { - AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty + AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrack, "%N")); // Userdefined, Track Number| empty, empty AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Title, Artist, Duration| empty, empty AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Title, Duration| empty, empty AddSortMethod(SortByArtistThenYear, sortAttribute, 578, LABEL_MASKS("%A - %T", "%D")); // Artist, Title, Duration| empty, empty - AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrackLeft, strTrackRight)); + AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrack, "%D")); AddSortMethod(SortByTime, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty AddSortMethod(SortByRating, 563, LABEL_MASKS("%T - %A", "%R")); // Title - Artist, Rating AddSortMethod(SortByYear, 562, LABEL_MASKS("%T - %A", "%Y")); // Title, Artist, Year @@ -350,20 +320,18 @@ CGUIViewStateMusicSmartPlaylist::CGUIViewStateMusicSmartPlaylist(const CFileItem if (items.GetContent() == "songs" || items.GetContent() == "mixed") { - std::string strTrackLeft=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - std::string strTrackRight=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); - - AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty + std::string strTrack=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); + AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrack, "%N")); // Userdefined, Track Number| empty, empty AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Titel, Artist, Duration| empty, empty AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Titel, Duration| empty, empty AddSortMethod(SortByArtistThenYear, sortAttribute, 578, LABEL_MASKS("%A - %T", "%D")); // Artist, Titel, Duration| empty, empty - AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrackLeft, strTrackRight)); + AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrack, "%D")); AddSortMethod(SortByTime, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty AddSortMethod(SortByRating, 563, LABEL_MASKS("%T - %A", "%R")); // Titel, Artist, Rating| empty, empty if (items.IsSmartPlayList() || items.IsLibraryFolder()) - AddPlaylistOrder(items, LABEL_MASKS(strTrackLeft, strTrackRight)); + AddPlaylistOrder(items, LABEL_MASKS(strTrack, "%D")); else { SetSortMethod(viewState->m_sortDescription); @@ -374,24 +342,20 @@ CGUIViewStateMusicSmartPlaylist::CGUIViewStateMusicSmartPlaylist(const CFileItem } else if (items.GetContent() == "albums") { - std::string strAlbumLeft = g_advancedSettings.m_strMusicLibraryAlbumFormat; - if (strAlbumLeft.empty()) - strAlbumLeft = "%B"; // album - std::string strAlbumRight = g_advancedSettings.m_strMusicLibraryAlbumFormatRight; - if (strAlbumRight.empty()) - strAlbumRight = "%A"; // artist - + std::string strAlbum = g_advancedSettings.m_strMusicLibraryAlbumFormat; + if (strAlbum.empty()) + strAlbum = "%B"; // album // album - AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined + AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%F", "", strAlbum, "")); // Filename, empty | Userdefined, empty // artist - AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined + AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%F", "", strAlbum, "%A")); // Filename, empty | Userdefined, Artist // artist / year - AddSortMethod(SortByArtistThenYear, sortAttribute, 578, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined + AddSortMethod(SortByArtistThenYear, sortAttribute, 578, LABEL_MASKS("%F", "", strAlbum, "%A / %Y")); // Filename, empty | Userdefined, Artist / Year // year - AddSortMethod(SortByYear, 562, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); + AddSortMethod(SortByYear, 562, LABEL_MASKS("%F", "", strAlbum, "%Y")); if (items.IsSmartPlayList() || items.IsLibraryFolder()) - AddPlaylistOrder(items, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); + AddPlaylistOrder(items, LABEL_MASKS("%F", "", strAlbum, "%D")); else { SetSortMethod(viewState->m_sortDescription); @@ -418,17 +382,15 @@ CGUIViewStateMusicPlaylist::CGUIViewStateMusicPlaylist(const CFileItemList& item SortAttribute sortAttribute = SortAttributeNone; if (CSettings::GetInstance().GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING)) sortAttribute = SortAttributeIgnoreArticle; - - std::string strTrackLeft=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - std::string strTrackRight=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); - - AddSortMethod(SortByPlaylistOrder, 559, LABEL_MASKS(strTrackLeft, strTrackRight)); - AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty + + std::string strTrack=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); + AddSortMethod(SortByPlaylistOrder, 559, LABEL_MASKS(strTrack, "")); + AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrack, "%N")); // Userdefined, Track Number| empty, empty AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Titel, Artist, Duration| empty, empty AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Titel, Duration| empty, empty AddSortMethod(SortByArtistThenYear, sortAttribute, 578, LABEL_MASKS("%A - %T", "%D")); // Artist, Titel, Duration| empty, empty - AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrackLeft, strTrackRight)); + AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrack, "%D")); AddSortMethod(SortByTime, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty AddSortMethod(SortByRating, 563, LABEL_MASKS("%T - %A", "%R")); // Titel, Artist, Rating| empty, empty @@ -474,9 +436,8 @@ CGUIViewStateWindowMusicNav::CGUIViewStateWindowMusicNav(const CFileItemList& it AddSortMethod(SortByArtistThenYear, sortAttribute, 578, LABEL_MASKS("%A - %T", "%Y")); AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%B - %T", "%Y")); - std::string strTrackLeft=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - std::string strTrackRight=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); - AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty + std::string strTrack=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); + AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrack, "%N")); // Userdefined, Track Number| empty, empty } else { @@ -560,16 +521,14 @@ CGUIViewStateWindowMusicSongs::CGUIViewStateWindowMusicSongs(const CFileItemList } else { - std::string strTrackLeft=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - std::string strTrackRight=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); - - AddSortMethod(SortByLabel, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", ""), // Userdefined, Userdefined | FolderName, empty + std::string strTrack=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); + AddSortMethod(SortByLabel, 551, LABEL_MASKS(strTrack, "%D", "%L", ""), // Userdefined, Duration | FolderName, empty CSettings::GetInstance().GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING) ? SortAttributeIgnoreArticle : SortAttributeNone); - AddSortMethod(SortBySize, 553, LABEL_MASKS(strTrackLeft, "%I", "%L", "%I")); // Userdefined, Size | FolderName, Size - AddSortMethod(SortByBitrate, 623, LABEL_MASKS(strTrackLeft, "%X", "%L", "%X")); // Userdefined, Bitrate | FolderName, Bitrate - AddSortMethod(SortByDate, 552, LABEL_MASKS(strTrackLeft, "%J", "%L", "%J")); // Userdefined, Date | FolderName, Date - AddSortMethod(SortByFile, 561, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty - AddSortMethod(SortByListeners, 20455,LABEL_MASKS(strTrackLeft, "%W", "%L", "%W")); + AddSortMethod(SortBySize, 553, LABEL_MASKS(strTrack, "%I", "%L", "%I")); // Userdefined, Size | FolderName, Size + AddSortMethod(SortByBitrate, 623, LABEL_MASKS(strTrack, "%X", "%L", "%X")); // Userdefined, Bitrate | FolderName, Bitrate + AddSortMethod(SortByDate, 552, LABEL_MASKS(strTrack, "%J", "%L", "%J")); // Userdefined, Date | FolderName, Date + AddSortMethod(SortByFile, 561, LABEL_MASKS(strTrack, "%F", "%L", "")); // Userdefined, FileName | FolderName, empty + AddSortMethod(SortByListeners, 20455,LABEL_MASKS(strTrack, "%W", "%L", "%W")); const CViewState *viewState = CViewStateSettings::GetInstance().Get("musicfiles"); SetSortMethod(viewState->m_sortDescription); @@ -593,14 +552,11 @@ VECSOURCES& CGUIViewStateWindowMusicSongs::GetSources() CGUIViewStateWindowMusicPlaylist::CGUIViewStateWindowMusicPlaylist(const CFileItemList& items) : CGUIViewStateWindowMusic(items) { - std::string strTrackLeft=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_NOWPLAYINGTRACKFORMAT); - if (strTrackLeft.empty()) - strTrackLeft = CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - std::string strTrackRight=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_NOWPLAYINGTRACKFORMATRIGHT); - if (strTrackRight.empty()) - strTrackRight = CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); - - AddSortMethod(SortByNone, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty + std::string strTrack=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_NOWPLAYINGTRACKFORMAT); + if (strTrack.empty()) + strTrack = CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); + + AddSortMethod(SortByNone, 551, LABEL_MASKS(strTrack, "%D", "%L", "")); // Userdefined, Duration | FolderName, empty SetSortMethod(SortByNone); SetViewAsControl(DEFAULT_VIEW_LIST); diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index 91be41e093..764c121cb4 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -310,7 +310,8 @@ void CMusicDatabase::CreateViews() " bCompilation, " " (SELECT MIN(song.iTimesPlayed) FROM song WHERE song.idAlbum = album.idAlbum) AS iTimesPlayed, " " strReleaseType, " - " (SELECT MAX(song.dateAdded) FROM song WHERE song.idAlbum = album.idAlbum) AS dateAdded " + " (SELECT MAX(song.dateAdded) FROM song WHERE song.idAlbum = album.idAlbum) AS dateAdded, " + " (SELECT MAX(song.lastplayed) FROM song WHERE song.idAlbum = album.idAlbum) AS lastplayed " "FROM album" ); @@ -1797,6 +1798,7 @@ CAlbum CMusicDatabase::GetAlbumFromDataset(const dbiplus::sql_record* const reco album.iTimesPlayed = record->at(offset + album_iTimesPlayed).get_asInt(); album.SetReleaseType(record->at(offset + album_strReleaseType).get_asString()); album.SetDateAdded(record->at(offset + album_dtDateAdded).get_asString()); + album.SetLastPlayed(record->at(offset + album_dtLastPlayed).get_asString()); return album; } @@ -3950,7 +3952,7 @@ void CMusicDatabase::UpdateTables(int version) int CMusicDatabase::GetSchemaVersion() const { - return 54; + return 55; } unsigned int CMusicDatabase::GetSongIDs(const Filter &filter, std::vector<std::pair<int,int> > &songIDs) diff --git a/xbmc/music/MusicDatabase.h b/xbmc/music/MusicDatabase.h index ef497c0e86..01618ed666 100644 --- a/xbmc/music/MusicDatabase.h +++ b/xbmc/music/MusicDatabase.h @@ -575,6 +575,7 @@ private: album_iTimesPlayed, album_strReleaseType, album_dtDateAdded, + album_dtLastPlayed, album_enumCount // end of the enum, do not add past here } AlbumFields; diff --git a/xbmc/music/tags/MusicInfoTag.cpp b/xbmc/music/tags/MusicInfoTag.cpp index 9ddc82ffa5..9f184b56dd 100644 --- a/xbmc/music/tags/MusicInfoTag.cpp +++ b/xbmc/music/tags/MusicInfoTag.cpp @@ -615,6 +615,7 @@ void CMusicInfoTag::SetAlbum(const CAlbum& album) SetDateAdded(album.dateAdded); SetPlayCount(album.iTimesPlayed); SetDatabaseId(album.idAlbum, MediaTypeAlbum); + SetLastPlayed(album.lastPlayed); SetLoaded(); } diff --git a/xbmc/music/windows/GUIWindowMusicPlaylist.cpp b/xbmc/music/windows/GUIWindowMusicPlaylist.cpp index 39b8c0ba1c..2470e943e0 100644 --- a/xbmc/music/windows/GUIWindowMusicPlaylist.cpp +++ b/xbmc/music/windows/GUIWindowMusicPlaylist.cpp @@ -448,13 +448,10 @@ void CGUIWindowMusicPlayList::OnItemLoaded(CFileItem* pItem) if (pItem->HasMusicInfoTag() && pItem->GetMusicInfoTag()->Loaded()) { // set label 1+2 from tags if (m_guiState.get()) m_hideExtensions = m_guiState->HideExtensions(); - std::string strTrackLeft=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_NOWPLAYINGTRACKFORMAT); - if (strTrackLeft.empty()) - strTrackLeft = CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - std::string strTrackRight=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_NOWPLAYINGTRACKFORMATRIGHT); - if (strTrackRight.empty()) - strTrackRight = CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); - CLabelFormatter formatter(strTrackLeft, strTrackRight); + std::string strTrack=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_NOWPLAYINGTRACKFORMAT); + if (strTrack.empty()) + strTrack = CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); + CLabelFormatter formatter(strTrack, "%D"); formatter.FormatLabels(pItem); } // if (pItem->m_musicInfoTag.Loaded()) else diff --git a/xbmc/music/windows/GUIWindowMusicPlaylistEditor.cpp b/xbmc/music/windows/GUIWindowMusicPlaylistEditor.cpp index 4dca91ab21..e3bb05e34e 100644 --- a/xbmc/music/windows/GUIWindowMusicPlaylistEditor.cpp +++ b/xbmc/music/windows/GUIWindowMusicPlaylistEditor.cpp @@ -416,7 +416,7 @@ void CGUIWindowMusicPlaylistEditor::OnSavePlaylist() void CGUIWindowMusicPlaylistEditor::AppendToPlaylist(CFileItemList &newItems) { OnRetrieveMusicInfo(newItems); - FormatItemLabels(newItems, LABEL_MASKS(CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT), CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT), "%L", "")); + FormatItemLabels(newItems, LABEL_MASKS(CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT), "%D", "%L", "")); m_playlist->Append(newItems); UpdatePlaylist(); } diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp index 98b31505b5..19451afa53 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -275,7 +275,6 @@ void CAdvancedSettings::Initialize() m_bMusicLibraryCleanOnUpdate = false; m_iMusicLibraryRecentlyAddedItems = 25; m_strMusicLibraryAlbumFormat = ""; - m_strMusicLibraryAlbumFormatRight = ""; m_prioritiseAPEv2tags = false; m_musicItemSeparator = " / "; m_videoItemSeparator = " / "; @@ -739,7 +738,6 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) XMLUtils::GetBoolean(pElement, "allitemsonbottom", m_bMusicLibraryAllItemsOnBottom); XMLUtils::GetBoolean(pElement, "cleanonupdate", m_bMusicLibraryCleanOnUpdate); XMLUtils::GetString(pElement, "albumformat", m_strMusicLibraryAlbumFormat); - XMLUtils::GetString(pElement, "albumformatright", m_strMusicLibraryAlbumFormatRight); XMLUtils::GetString(pElement, "itemseparator", m_musicItemSeparator); XMLUtils::GetInt(pElement, "dateadded", m_iMusicLibraryDateAdded); } diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h index 7c3759d27a..35754a4038 100644 --- a/xbmc/settings/AdvancedSettings.h +++ b/xbmc/settings/AdvancedSettings.h @@ -272,7 +272,6 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler bool m_bMusicLibraryAllItemsOnBottom; bool m_bMusicLibraryCleanOnUpdate; std::string m_strMusicLibraryAlbumFormat; - std::string m_strMusicLibraryAlbumFormatRight; bool m_prioritiseAPEv2tags; std::string m_musicItemSeparator; std::string m_videoItemSeparator; diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp index 93434cd31a..879c82d8b7 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp @@ -281,11 +281,8 @@ const std::string CSettings::SETTING_MUSICPLAYER_CROSSFADEALBUMTRACKS = "musicpl const std::string CSettings::SETTING_MUSICPLAYER_VISUALISATION = "musicplayer.visualisation"; const std::string CSettings::SETTING_MUSICFILES_USETAGS = "musicfiles.usetags"; const std::string CSettings::SETTING_MUSICFILES_TRACKFORMAT = "musicfiles.trackformat"; -const std::string CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT = "musicfiles.trackformatright"; const std::string CSettings::SETTING_MUSICFILES_NOWPLAYINGTRACKFORMAT = "musicfiles.nowplayingtrackformat"; -const std::string CSettings::SETTING_MUSICFILES_NOWPLAYINGTRACKFORMATRIGHT = "musicfiles.nowplayingtrackformatright"; const std::string CSettings::SETTING_MUSICFILES_LIBRARYTRACKFORMAT = "musicfiles.librarytrackformat"; -const std::string CSettings::SETTING_MUSICFILES_LIBRARYTRACKFORMATRIGHT = "musicfiles.librarytrackformatright"; const std::string CSettings::SETTING_MUSICFILES_FINDREMOTETHUMBS = "musicfiles.findremotethumbs"; const std::string CSettings::SETTING_AUDIOCDS_AUTOACTION = "audiocds.autoaction"; const std::string CSettings::SETTING_AUDIOCDS_USECDDB = "audiocds.usecddb"; @@ -1031,7 +1028,6 @@ void CSettings::InitializeISettingCallbacks() settingSet.insert(CSettings::SETTING_MUSICLIBRARY_EXPORT); settingSet.insert(CSettings::SETTING_MUSICLIBRARY_IMPORT); settingSet.insert(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - settingSet.insert(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); settingSet.insert(CSettings::SETTING_VIDEOLIBRARY_FLATTENTVSHOWS); settingSet.insert(CSettings::SETTING_VIDEOLIBRARY_REMOVE_DUPLICATES); settingSet.insert(CSettings::SETTING_VIDEOLIBRARY_GROUPMOVIESETS); diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h index aa1cbaf045..c529a7cf01 100644 --- a/xbmc/settings/Settings.h +++ b/xbmc/settings/Settings.h @@ -238,11 +238,8 @@ public: static const std::string SETTING_MUSICPLAYER_VISUALISATION; static const std::string SETTING_MUSICFILES_USETAGS; static const std::string SETTING_MUSICFILES_TRACKFORMAT; - static const std::string SETTING_MUSICFILES_TRACKFORMATRIGHT; static const std::string SETTING_MUSICFILES_NOWPLAYINGTRACKFORMAT; - static const std::string SETTING_MUSICFILES_NOWPLAYINGTRACKFORMATRIGHT; static const std::string SETTING_MUSICFILES_LIBRARYTRACKFORMAT; - static const std::string SETTING_MUSICFILES_LIBRARYTRACKFORMATRIGHT; static const std::string SETTING_MUSICFILES_FINDREMOTETHUMBS; static const std::string SETTING_AUDIOCDS_AUTOACTION; static const std::string SETTING_AUDIOCDS_USECDDB; diff --git a/xbmc/utils/LabelFormatter.cpp b/xbmc/utils/LabelFormatter.cpp index 64c9c75f30..13d5faaf02 100644 --- a/xbmc/utils/LabelFormatter.cpp +++ b/xbmc/utils/LabelFormatter.cpp @@ -330,6 +330,8 @@ std::string CLabelFormatter::GetMaskContent(const CMaskString &mask, const CFile case 'p': // Last played if (movie && movie->m_lastPlayed.IsValid()) value = movie->m_lastPlayed.GetAsLocalizedDate(); + if (music && music->GetLastPlayed().IsValid()) + value = music->GetLastPlayed().GetAsLocalizedDate(); break; case 'r': // userrating if (movie && movie->m_iUserRating != 0) diff --git a/xbmc/video/GUIViewStateVideo.cpp b/xbmc/video/GUIViewStateVideo.cpp index ae0a73cdce..130aeda254 100644 --- a/xbmc/video/GUIViewStateVideo.cpp +++ b/xbmc/video/GUIViewStateVideo.cpp @@ -312,9 +312,8 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it if (CMediaSettings::GetInstance().GetWatchedMode(items.GetContent()) == WatchedModeAll) AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V")); // Title, Playcount | empty, empty - std::string strTrackLeft=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - std::string strTrackRight=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); - AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty + std::string strTrack=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); + AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrack, "%N")); // Userdefined, Track Number | empty, empty const CViewState *viewState = CViewStateSettings::GetInstance().Get("videonavmusicvideos"); SetSortMethod(viewState->m_sortDescription); @@ -525,9 +524,8 @@ CGUIViewStateVideoMusicVideos::CGUIViewStateVideoMusicVideos(const CFileItemList if (CMediaSettings::GetInstance().GetWatchedMode(items.GetContent()) == WatchedModeAll) AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V")); // Title, Playcount | empty, empty - std::string strTrackLeft=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); - std::string strTrackRight=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMATRIGHT); - AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty + std::string strTrack=CSettings::GetInstance().GetString(CSettings::SETTING_MUSICFILES_TRACKFORMAT); + AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrack, "%N")); // Userdefined, Track Number | empty, empty const CViewState *viewState = CViewStateSettings::GetInstance().Get("videonavmusicvideos"); if (items.IsSmartPlayList() || items.IsLibraryFolder()) |