Permalink
Browse files

Removed label2 and show value that is sorted by or fall back to durat…

…ion.

Add lastPlayed sortorder for music
  • Loading branch information...
Razzeee committed Sep 19, 2015
1 parent 8cb3f36 commit 11615109eb126d7298980f3c239b84923ae75a7d
@@ -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>
@@ -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:
@@ -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++)
@@ -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 @@ class CAlbum
bCompilation = false;
iTimesPlayed = 0;
dateAdded.Reset();
lastPlayed.Reset();
songs.clear();
infoSongs.clear();
releaseType = Album;
@@ -89,6 +90,7 @@ class CAlbum
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 @@ class CAlbum
bool bCompilation;
int iTimesPlayed;
CDateTime dateAdded;
CDateTime lastPlayed;
VECSONGS songs; ///< Local songs
VECSONGS infoSongs; ///< Scraped songs
ReleaseType releaseType;

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -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)
@@ -575,6 +575,7 @@ class CMusicDatabase : public CDatabase
album_iTimesPlayed,
album_strReleaseType,
album_dtDateAdded,
album_dtLastPlayed,
album_enumCount // end of the enum, do not add past here
} AlbumFields;

@@ -615,6 +615,7 @@ void CMusicInfoTag::SetAlbum(const CAlbum& album)
SetDateAdded(album.dateAdded);
SetPlayCount(album.iTimesPlayed);
SetDatabaseId(album.idAlbum, MediaTypeAlbum);
SetLastPlayed(album.lastPlayed);

SetLoaded();
}
@@ -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
@@ -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();
}
@@ -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);
}
@@ -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;
@@ -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);
@@ -238,11 +238,8 @@ class CSettings : public CSettingCreator, public CSettingControlCreator
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;
@@ -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)
@@ -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())

0 comments on commit 1161510

Please sign in to comment.