diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-08-28 01:12:29 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-08-28 01:12:29 +0000 |
commit | a447c570d7a9374d831a215ab3b0f46e9eb66612 (patch) | |
tree | bf9ff200b52a768aa622745168244b41caf205d3 | |
parent | bc62960f42fbe3b6979c28cc5cffa0cc6f557056 (diff) |
added: some missing labels to jsonrpc and a bylastplayed sort method for videos. Part of #9517, thanks to Nuka1195
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@33243 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | xbmc/FileItem.cpp | 3 | ||||
-rw-r--r-- | xbmc/SortFileItem.cpp | 12 | ||||
-rw-r--r-- | xbmc/SortFileItem.h | 2 | ||||
-rw-r--r-- | xbmc/VideoDatabase.cpp | 1 | ||||
-rw-r--r-- | xbmc/lib/libjsonrpc/FileItemHandler.cpp | 14 |
5 files changed, 32 insertions, 0 deletions
diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp index c0d67b88f6..35840c294d 100644 --- a/xbmc/FileItem.cpp +++ b/xbmc/FileItem.cpp @@ -1539,6 +1539,9 @@ void CFileItemList::Sort(SORT_METHOD sortMethod, SORT_ORDER sortOrder) case SORT_METHOD_FULLPATH:
FillSortFields(SSortFileItem::ByFullPath);
break;
+ case SORT_METHOD_LASTPLAYED:
+ FillSortFields(SSortFileItem::ByLastPlayed);
+ break;
default:
break;
}
diff --git a/xbmc/SortFileItem.cpp b/xbmc/SortFileItem.cpp index 6e46d7153f..0e5d625137 100644 --- a/xbmc/SortFileItem.cpp +++ b/xbmc/SortFileItem.cpp @@ -136,6 +136,18 @@ void SSortFileItem::ByFullPath(CFileItemPtr &item) item->SetSortLabel(label); } +void SSortFileItem::ByLastPlayed(CFileItemPtr &item) +{ + if (!item) return; + + if (item->HasVideoInfoTag()) + item->SetSortLabel(item->GetVideoInfoTag()->m_lastPlayed); + else if (item->HasMusicInfoTag()) // TODO: No last played info in the fileitem for music + item->SetSortLabel(item->GetMusicInfoTag()->GetTitle()); + else + item->SetSortLabel(item->GetLabel()); +} + void SSortFileItem::ByDate(CFileItemPtr &item) { if (!item) return; diff --git a/xbmc/SortFileItem.h b/xbmc/SortFileItem.h index e8b6c088f0..48dda5cbe0 100644 --- a/xbmc/SortFileItem.h +++ b/xbmc/SortFileItem.h @@ -74,6 +74,7 @@ struct SSortFileItem static void ByEpisodeNum(CFileItemPtr &item); static void ByProductionCode(CFileItemPtr &item); + static void ByLastPlayed(CFileItemPtr &item); static void ByBitrate(CFileItemPtr &item); }; @@ -111,6 +112,7 @@ typedef enum { SORT_METHOD_STUDIO_IGNORE_THE, SORT_METHOD_FULLPATH, SORT_METHOD_LABEL_IGNORE_FOLDERS, + SORT_METHOD_LASTPLAYED, SORT_METHOD_UNSORTED, SORT_METHOD_BITRATE, SORT_METHOD_MAX diff --git a/xbmc/VideoDatabase.cpp b/xbmc/VideoDatabase.cpp index 8cab062443..f76cd49166 100644 --- a/xbmc/VideoDatabase.cpp +++ b/xbmc/VideoDatabase.cpp @@ -2783,6 +2783,7 @@ CVideoInfoTag CVideoDatabase::GetDetailsForEpisode(auto_ptr<Dataset> &pDS, bool details.m_strMPAARating = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_MPAA).get_asString(); details.m_strShowTitle = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_NAME).get_asString(); details.m_strStudio = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_STUDIO).get_asString(); + details.m_strPremiered = pDS->fv(VIDEODB_DETAILS_EPISODE_TVSHOW_AIRED).get_asString(); GetStreamDetailsForFileId(details.m_streamDetails, details.m_iFileId); diff --git a/xbmc/lib/libjsonrpc/FileItemHandler.cpp b/xbmc/lib/libjsonrpc/FileItemHandler.cpp index 47dd70c1c8..7f208eb305 100644 --- a/xbmc/lib/libjsonrpc/FileItemHandler.cpp +++ b/xbmc/lib/libjsonrpc/FileItemHandler.cpp @@ -70,6 +70,18 @@ void CFileItemHandler::FillVideoDetails(const CVideoInfoTag *videoInfo, const CS result["playcount"] = videoInfo->m_playCount; if (field.Equals("rating")) result["rating"] = (double)videoInfo->m_fRating; + if (field.Equals("writer") && !videoInfo->m_strWritingCredits.IsEmpty()) + result["writer"] = videoInfo->m_strWritingCredits.c_str(); + if (field.Equals("studio") && !videoInfo->m_strStudio.IsEmpty()) + result["studio"] = videoInfo->m_strStudio.c_str(); + if (field.Equals("mpaa") && !videoInfo->m_strMPAARating.IsEmpty()) + result["mpaa"] = videoInfo->m_strMPAARating.c_str(); + if (field.Equals("premiered") && !videoInfo->m_strPremiered.IsEmpty()) + result["premiered"] = videoInfo->m_strPremiered.c_str(); + if (field.Equals("album") && !videoInfo->m_strAlbum.IsEmpty()) + result["album"] = videoInfo->m_strAlbum.c_str(); + if (field.Equals("artist") && !videoInfo->m_strArtist.IsEmpty()) + result["artist"] = videoInfo->m_strArtist.c_str(); } void CFileItemHandler::FillMusicDetails(const CMusicInfoTag *musicInfo, const CStdString &field, Value &result) @@ -271,6 +283,8 @@ bool CFileItemHandler::ParseSortMethods(const CStdString &method, const bool &ig sortmethod = ignorethe ? SORT_METHOD_STUDIO_IGNORE_THE : SORT_METHOD_STUDIO; else if (method.Equals("fullpath")) sortmethod = SORT_METHOD_FULLPATH; + else if (method.Equals("lastplayed")) + sortmethod = SORT_METHOD_LASTPLAYED; else if (method.Equals("unsorted")) sortmethod = SORT_METHOD_UNSORTED; else if (method.Equals("max")) |