bool CDirectoryNodeAlbum::GetContent(CFileItemList& items) const { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); bool bSuccess=musicdatabase.GetAlbumsNav(BuildPath(), items, params.GetGenreId(), params.GetArtistId()); musicdatabase.Close(); return bSuccess; }
bool CDirectoryNodeTitleMusicVideos::GetContent(CFileItemList& items) const { CVideoDatabase videodatabase; if (!videodatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); bool bSuccess=videodatabase.GetMusicVideosNav(BuildPath(), items, params.GetGenreId(), params.GetYear(), params.GetActorId(), params.GetDirectorId(), params.GetStudioId(), params.GetAlbumId(), params.GetTagId()); videodatabase.Close(); return bSuccess; }
bool CDirectoryNodeArtist::GetContent(CFileItemList& items) { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); bool bSuccess = musicdatabase.GetArtistsNav(BuildPath(), items, params.GetGenreId(), g_guiSettings.GetBool("musiclibrary.albumartistsonly")); musicdatabase.Close(); return bSuccess; }
bool CDirectoryNodeSong::GetContent(CFileItemList& items) { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); CStdString strBaseDir=BuildPath(); bool bSuccess=musicdatabase.GetSongsNav(strBaseDir, items, params.GetGenreId(), params.GetArtistId(), params.GetAlbumId()); musicdatabase.Close(); return bSuccess; }
bool CDirectoryNodeTitleMovies::GetContent(CFileItemList& items) const { CVideoDatabase videodatabase; if (!videodatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); CStdString strBaseDir=BuildPath(); bool bSuccess=videodatabase.GetMoviesNav(strBaseDir, items, params.GetGenreId(), params.GetYear(), params.GetActorId(), params.GetDirectorId(), params.GetStudioId(), params.GetCountryId(), params.GetSetId(), params.GetTagId()); videodatabase.Close(); return bSuccess; }
bool CDirectoryNodeSeasons::GetContent(CFileItemList& items) const { CVideoDatabase videodatabase; if (!videodatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); int iFlatten = CSettings::Get().GetInt("videolibrary.flattentvshows"); bool bSuccess=videodatabase.GetSeasonsNav(BuildPath(), items, params.GetActorId(), params.GetDirectorId(), params.GetGenreId(), params.GetYear(), params.GetTvShowId()); bool bFlatten = (items.GetObjectCount() == 1 && iFlatten == 1) || iFlatten == 2; if (items.GetObjectCount() == 2 && iFlatten == 1) if (items[0]->GetVideoInfoTag()->m_iSeason == 0 || items[1]->GetVideoInfoTag()->m_iSeason == 0) bFlatten = true; // flatten if one season + specials if (iFlatten > 0 && !bFlatten && CMediaSettings::Get().GetWatchedMode("tvshows") == WatchedModeUnwatched) { int count = 0; for(int i = 0; i < items.Size(); i++) { if (items[i]->GetProperty("unwatchedepisodes").asInteger() != 0 && items[i]->GetVideoInfoTag()->m_iSeason != 0) count++; } bFlatten = (count < 2); // flatten if there is only 1 unwatched season (not counting specials) } if (bFlatten) { // flatten if one season or flatten always items.Clear(); CVideoDbUrl videoUrl; if (!videoUrl.FromString(BuildPath())) return false; videoUrl.AppendPath("-2/"); bSuccess=videodatabase.GetEpisodesNav(videoUrl.ToString(), items, params.GetGenreId(), params.GetYear(), params.GetActorId(), params.GetDirectorId(), params.GetTvShowId()); items.SetPath(videoUrl.ToString()); } videodatabase.Close(); return bSuccess; }
bool CDirectoryNodeSong::GetContent(CFileItemList& items) const { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); CStdString strBaseDir = BuildPath(); bool bSuccess = musicdatabase.GetSongsNav(strBaseDir, items, params.GetGenreId(), params.GetArtistId(), params.GetAlbumId()); //spotify //TODO scan through all addons that provide songs, also create a better naming system for addon sources bSuccess = g_spotify->GetTracks(items, strBaseDir,musicdatabase.GetArtistById(params.GetArtistId()),params.GetAlbumId()); musicdatabase.Close(); return bSuccess; }
bool CDirectoryNodeEpisodes::GetContent(CFileItemList& items) const { CVideoDatabase videodatabase; if (!videodatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); int season = (int)params.GetSeason(); if (season == -2) season = -1; bool bSuccess=videodatabase.GetEpisodesNav(BuildPath(), items, params.GetGenreId(), params.GetYear(), params.GetActorId(), params.GetDirectorId(), params.GetTvShowId(), season); videodatabase.Close(); return bSuccess; }
bool CDirectoryNodeSeasons::GetContent(CFileItemList& items) { CVideoDatabase videodatabase; if (!videodatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); bool bSuccess=videodatabase.GetSeasonsNav(BuildPath(), items, params.GetActorId(), params.GetDirectorId(), params.GetGenreId(), params.GetYear(), params.GetTvShowId()); if (items.Size() == 1 && g_guiSettings.GetBool("videolibrary.singleseason")) { items.Clear(); videodatabase.GetEpisodesNav(BuildPath()+"-1/",items,params.GetGenreId(),params.GetYear(),params.GetActorId(),params.GetDirectorId(),params.GetTvShowId()); items.m_strPath = BuildPath()+"-1/"; } videodatabase.Close(); return bSuccess; }
bool CDirectoryNodeSeasons::GetContent(CFileItemList& items) { CVideoDatabase videodatabase; if (!videodatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); int iFlatten = g_guiSettings.GetInt("videolibrary.flattentvshows"); bool bSuccess=videodatabase.GetSeasonsNav(BuildPath(), items, params.GetActorId(), params.GetDirectorId(), params.GetGenreId(), params.GetYear(), params.GetTvShowId()); if ((items.GetObjectCount() == 1 && iFlatten == 1) || iFlatten == 2) { // flatten if one season or flatten always items.Clear(); bSuccess=videodatabase.GetEpisodesNav(BuildPath()+"-1/",items,params.GetGenreId(),params.GetYear(),params.GetActorId(),params.GetDirectorId(),params.GetTvShowId()); items.m_strPath = BuildPath()+"-1/"; } videodatabase.Close(); return bSuccess; }
bool CDirectoryNodeSeasons::GetContent(CFileItemList& items) { CVideoDatabase videodatabase; if (!videodatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); int iFlatten = g_guiSettings.GetInt("videolibrary.flattentvshows"); bool bSuccess=videodatabase.GetSeasonsNav(BuildPath(), items, params.GetActorId(), params.GetDirectorId(), params.GetGenreId(), params.GetYear(), params.GetTvShowId()); bool bFlatten = (items.GetObjectCount() == 1 && iFlatten == 1) || iFlatten == 2; if (items.GetObjectCount() == 2 && iFlatten == 1) if (items[0]->GetVideoInfoTag()->m_iSeason == 0 || items[1]->GetVideoInfoTag()->m_iSeason == 0) bFlatten = true; // flatten if one season + specials if (!bFlatten && g_settings.GetWatchMode("tvshows") == VIDEO_SHOW_UNWATCHED) { int count = 0; for(int i = 0; i < items.Size(); i++) { if (items[i]->GetPropertyInt("unwatchedepisodes") != 0 && items[i]->GetVideoInfoTag()->m_iSeason != 0) count++; } bFlatten = (count < 2); // flatten if there is only 1 unwatched season (not counting specials) } if (bFlatten) { // flatten if one season or flatten always items.Clear(); bSuccess=videodatabase.GetEpisodesNav(BuildPath()+"-1/",items,params.GetGenreId(),params.GetYear(),params.GetActorId(),params.GetDirectorId(),params.GetTvShowId()); items.m_strPath = BuildPath()+"-1/"; } videodatabase.Close(); return bSuccess; }
bool CMusicDbUrl::parse() { // the URL must start with musicdb:// if (m_url.GetProtocol() != "musicdb" || m_url.GetFileName().empty()) return false; CStdString path = m_url.Get(); NODE_TYPE dirType = CMusicDatabaseDirectory::GetDirectoryType(path); NODE_TYPE childType = CMusicDatabaseDirectory::GetDirectoryChildType(path); switch (dirType) { case NODE_TYPE_ARTIST: m_type = "artists"; break; case NODE_TYPE_ALBUM: case NODE_TYPE_ALBUM_RECENTLY_ADDED: case NODE_TYPE_ALBUM_RECENTLY_PLAYED: case NODE_TYPE_ALBUM_TOP100: case NODE_TYPE_ALBUM_COMPILATIONS: case NODE_TYPE_YEAR_ALBUM: m_type = "albums"; break; case NODE_TYPE_ALBUM_RECENTLY_ADDED_SONGS: case NODE_TYPE_ALBUM_RECENTLY_PLAYED_SONGS: case NODE_TYPE_ALBUM_TOP100_SONGS: case NODE_TYPE_ALBUM_COMPILATIONS_SONGS: case NODE_TYPE_SONG: case NODE_TYPE_SONG_TOP100: case NODE_TYPE_YEAR_SONG: case NODE_TYPE_SINGLES: m_type = "songs"; break; default: break; } switch (childType) { case NODE_TYPE_ARTIST: m_type = "artists"; break; case NODE_TYPE_ALBUM: case NODE_TYPE_ALBUM_RECENTLY_ADDED: case NODE_TYPE_ALBUM_RECENTLY_PLAYED: case NODE_TYPE_ALBUM_TOP100: case NODE_TYPE_YEAR_ALBUM: m_type = "albums"; break; case NODE_TYPE_SONG: case NODE_TYPE_ALBUM_RECENTLY_ADDED_SONGS: case NODE_TYPE_ALBUM_RECENTLY_PLAYED_SONGS: case NODE_TYPE_ALBUM_TOP100_SONGS: case NODE_TYPE_ALBUM_COMPILATIONS_SONGS: case NODE_TYPE_SONG_TOP100: case NODE_TYPE_YEAR_SONG: case NODE_TYPE_SINGLES: m_type = "songs"; break; case NODE_TYPE_GENRE: m_type = "genres"; break; case NODE_TYPE_YEAR: m_type = "years"; break; case NODE_TYPE_ALBUM_COMPILATIONS: m_type = "albums"; break; case NODE_TYPE_TOP100: m_type = "top100"; break; case NODE_TYPE_ROOT: case NODE_TYPE_OVERVIEW: default: return false; } if (m_type.empty()) return false; // parse query params CQueryParams queryParams; CDirectoryNode::GetDatabaseInfo(path, queryParams); // retrieve and parse all options AddOptions(m_url.GetOptions()); // add options based on the node type if (dirType == NODE_TYPE_SINGLES || childType == NODE_TYPE_SINGLES) AddOption("singles", true); // add options based on the QueryParams if (queryParams.GetArtistId() != -1) AddOption("artistid", (int)queryParams.GetArtistId()); if (queryParams.GetAlbumId() != -1) AddOption("albumid", (int)queryParams.GetAlbumId()); if (queryParams.GetGenreId() != -1) AddOption("genreid", (int)queryParams.GetGenreId()); if (queryParams.GetSongId() != -1) AddOption("songid", (int)queryParams.GetSongId()); if (queryParams.GetYear() != -1) AddOption("year", (int)queryParams.GetYear()); return true; }
bool CMusicDatabaseDirectory::GetLabel(const CStdString& strDirectory, CStdString& strLabel) { strLabel = ""; CStdString path = CLegacyPathTranslation::TranslateMusicDbPath(strDirectory); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get()) return false; // first see if there's any filter criteria CQueryParams params; CDirectoryNode::GetDatabaseInfo(path, params); CMusicDatabase musicdatabase; if (!musicdatabase.Open()) return false; // get genre if (params.GetGenreId() >= 0) strLabel += musicdatabase.GetGenreById(params.GetGenreId()); // get artist if (params.GetArtistId() >= 0) { if (!strLabel.empty()) strLabel += " / "; strLabel += musicdatabase.GetArtistById(params.GetArtistId()); } // get album if (params.GetAlbumId() >= 0) { if (!strLabel.empty()) strLabel += " / "; strLabel += musicdatabase.GetAlbumById(params.GetAlbumId()); } if (strLabel.empty()) { switch (pNode->GetChildType()) { case NODE_TYPE_TOP100: strLabel = g_localizeStrings.Get(271); // Top 100 break; case NODE_TYPE_GENRE: strLabel = g_localizeStrings.Get(135); // Genres break; case NODE_TYPE_ARTIST: strLabel = g_localizeStrings.Get(133); // Artists break; case NODE_TYPE_ALBUM: strLabel = g_localizeStrings.Get(132); // Albums break; case NODE_TYPE_ALBUM_RECENTLY_ADDED: case NODE_TYPE_ALBUM_RECENTLY_ADDED_SONGS: strLabel = g_localizeStrings.Get(359); // Recently Added Albums break; case NODE_TYPE_ALBUM_RECENTLY_PLAYED: case NODE_TYPE_ALBUM_RECENTLY_PLAYED_SONGS: strLabel = g_localizeStrings.Get(517); // Recently Played Albums break; case NODE_TYPE_ALBUM_TOP100: case NODE_TYPE_ALBUM_TOP100_SONGS: strLabel = g_localizeStrings.Get(10505); // Top 100 Albums break; case NODE_TYPE_SINGLES: strLabel = g_localizeStrings.Get(1050); // Singles break; case NODE_TYPE_SONG: strLabel = g_localizeStrings.Get(134); // Songs break; case NODE_TYPE_SONG_TOP100: strLabel = g_localizeStrings.Get(10504); // Top 100 Songs break; case NODE_TYPE_YEAR: case NODE_TYPE_YEAR_ALBUM: case NODE_TYPE_YEAR_SONG: strLabel = g_localizeStrings.Get(652); // Years break; case NODE_TYPE_ALBUM_COMPILATIONS: case NODE_TYPE_ALBUM_COMPILATIONS_SONGS: strLabel = g_localizeStrings.Get(521); break; case NODE_TYPE_OVERVIEW: strLabel = ""; break; default: CLog::Log(LOGWARNING, "%s - Unknown nodetype requested %d", __FUNCTION__, pNode->GetChildType()); return false; } } return true; }
bool CVideoDatabaseDirectory::GetLabel(const std::string& strDirectory, std::string& strLabel) { strLabel = ""; std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strDirectory); auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path)); if (!pNode.get() || path.empty()) return false; // first see if there's any filter criteria CQueryParams params; CDirectoryNode::GetDatabaseInfo(path, params); CVideoDatabase videodatabase; if (!videodatabase.Open()) return false; // get genre if (params.GetGenreId() != -1) strLabel += videodatabase.GetGenreById(params.GetGenreId()); // get country if (params.GetCountryId() != -1) strLabel += videodatabase.GetCountryById(params.GetCountryId()); // get set if (params.GetSetId() != -1) strLabel += videodatabase.GetSetById(params.GetSetId()); // get tag if (params.GetTagId() != -1) strLabel += videodatabase.GetTagById(params.GetTagId()); // get year if (params.GetYear() != -1) { std::string strTemp = StringUtils::Format("%i",params.GetYear()); if (!strLabel.empty()) strLabel += " / "; strLabel += strTemp; } if (strLabel.empty()) { switch (pNode->GetChildType()) { case NODE_TYPE_TITLE_MOVIES: case NODE_TYPE_TITLE_TVSHOWS: case NODE_TYPE_TITLE_MUSICVIDEOS: strLabel = g_localizeStrings.Get(369); break; case NODE_TYPE_ACTOR: // Actor strLabel = g_localizeStrings.Get(344); break; case NODE_TYPE_GENRE: // Genres strLabel = g_localizeStrings.Get(135); break; case NODE_TYPE_COUNTRY: // Countries strLabel = g_localizeStrings.Get(20451); break; case NODE_TYPE_YEAR: // Year strLabel = g_localizeStrings.Get(562); break; case NODE_TYPE_DIRECTOR: // Director strLabel = g_localizeStrings.Get(20348); break; case NODE_TYPE_SETS: // Sets strLabel = g_localizeStrings.Get(20434); break; case NODE_TYPE_TAGS: // Tags strLabel = g_localizeStrings.Get(20459); break; case NODE_TYPE_MOVIES_OVERVIEW: // Movies strLabel = g_localizeStrings.Get(342); break; case NODE_TYPE_TVSHOWS_OVERVIEW: // TV Shows strLabel = g_localizeStrings.Get(20343); break; case NODE_TYPE_RECENTLY_ADDED_MOVIES: // Recently Added Movies strLabel = g_localizeStrings.Get(20386); break; case NODE_TYPE_RECENTLY_ADDED_EPISODES: // Recently Added Episodes strLabel = g_localizeStrings.Get(20387); break; case NODE_TYPE_STUDIO: // Studios strLabel = g_localizeStrings.Get(20388); break; case NODE_TYPE_MUSICVIDEOS_OVERVIEW: // Music Videos strLabel = g_localizeStrings.Get(20389); break; case NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS: // Recently Added Music Videos strLabel = g_localizeStrings.Get(20390); break; case NODE_TYPE_SEASONS: // Seasons strLabel = g_localizeStrings.Get(33054); break; case NODE_TYPE_EPISODES: // Episodes strLabel = g_localizeStrings.Get(20360); break; default: return false; } } return true; }
bool CDirectoryNodeArtist::GetContent(CFileItemList& items) const { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); bool bSuccess = musicdatabase.GetArtistsNav(BuildPath(), items, !CSettings::Get().GetBool(CSettings::SETTING_MUSICLIBRARY_SHOWCOMPILATIONARTISTS), params.GetGenreId()); musicdatabase.Close(); return bSuccess; }
bool CDirectoryNodeArtist::GetContent(CFileItemList& items) const { CMusicDatabase musicdatabase; if (!musicdatabase.Open()) return false; CQueryParams params; CollectQueryParams(params); bool bSuccess = musicdatabase.GetArtistsNav(BuildPath(), items, !CSettings::Get().GetBool("musiclibrary.showcompilationartists"), params.GetGenreId()); musicdatabase.Close(); return bSuccess; }
bool CVideoDatabaseDirectory::GetLabel(const CStdString& strDirectory, CStdString& strLabel) { strLabel = ""; auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(strDirectory)); if (!pNode.get() || strDirectory.IsEmpty()) return false; // first see if there's any filter criteria CQueryParams params; CDirectoryNode::GetDatabaseInfo(strDirectory, params); CVideoDatabase videodatabase; if (!videodatabase.Open()) return false; // get genre CStdString strTemp; if (params.GetGenreId() != -1) { videodatabase.GetGenreById(params.GetGenreId(), strTemp); strLabel += strTemp; } // get year if (params.GetYear() != -1) { strTemp.Format("%i",params.GetYear()); if (!strLabel.IsEmpty()) strLabel += " / "; strLabel += strTemp; } if (strLabel.IsEmpty()) { switch (pNode->GetChildType()) { case NODE_TYPE_TITLE_MOVIES: case NODE_TYPE_TITLE_TVSHOWS: case NODE_TYPE_TITLE_MUSICVIDEOS: strLabel = g_localizeStrings.Get(369); break; case NODE_TYPE_ACTOR: // Actor strLabel = g_localizeStrings.Get(344); break; case NODE_TYPE_GENRE: // Genres strLabel = g_localizeStrings.Get(135); break; case NODE_TYPE_YEAR: // Year strLabel = g_localizeStrings.Get(562); break; case NODE_TYPE_DIRECTOR: // Director strLabel = g_localizeStrings.Get(20348); break; case NODE_TYPE_MOVIES_OVERVIEW: // Movies strLabel = g_localizeStrings.Get(342); break; case NODE_TYPE_TVSHOWS_OVERVIEW: // TV Shows strLabel = g_localizeStrings.Get(20343); break; case NODE_TYPE_RECENTLY_ADDED_MOVIES: // Recently Added Movies strLabel = g_localizeStrings.Get(20386); break; case NODE_TYPE_RECENTLY_ADDED_EPISODES: // Recently Added Episodes strLabel = g_localizeStrings.Get(20387); break; case NODE_TYPE_STUDIO: // Studios strLabel = g_localizeStrings.Get(20388); break; case NODE_TYPE_MUSICVIDEOS_OVERVIEW: // Music Videos strLabel = g_localizeStrings.Get(20389); break; case NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS: // Recently Added Music Videos strLabel = g_localizeStrings.Get(20390); break; default: CLog::Log(LOGWARNING, "%s - Unknown nodetype requested %d", __FUNCTION__, pNode->GetChildType()); return false; } } return true; }