예제 #1
0
bool CGUIWindowMusicBase::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
  items.SetArt("thumb", "");
  bool bResult = CGUIMediaWindow::GetDirectory(strDirectory, items);
  if (bResult)
    CMusicThumbLoader::FillThumb(items);

  // add in the "New Playlist" item if we're in the playlists folder
  if ((items.GetPath() == "special://musicplaylists/") && !items.Contains("newplaylist://"))
  {
    CFileItemPtr newPlaylist(new CFileItem(CProfilesManager::Get().GetUserDataItem("PartyMode.xsp"),false));
    newPlaylist->SetLabel(g_localizeStrings.Get(16035));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->m_bIsFolder = true;
    items.Add(newPlaylist);

    newPlaylist.reset(new CFileItem("newplaylist://", false));
    newPlaylist->SetLabel(g_localizeStrings.Get(525));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->SetSpecialSort(SortSpecialOnBottom);
    newPlaylist->SetCanQueue(false);
    items.Add(newPlaylist);

    newPlaylist.reset(new CFileItem("newsmartplaylist://music", false));
    newPlaylist->SetLabel(g_localizeStrings.Get(21437));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->SetSpecialSort(SortSpecialOnBottom);
    newPlaylist->SetCanQueue(false);
    items.Add(newPlaylist);
  }

  return bResult;
}
예제 #2
0
bool CGUIWindowMusicBase::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
  CStdString directory = strDirectory;

  // check if the path contains a filter and if so load it and
  // remove it from the path to get proper GUI view states etc
  CSmartPlaylist filterXsp;
  CMusicDbUrl musicUrl;
  if (musicUrl.FromString(strDirectory))
  {
    CVariant filter;
    if (musicUrl.GetOption("filter", filter))
    {
      // load the filter and if it's type does not match the
      // path's item type reset it
      if (filterXsp.LoadFromJson(filter.asString()) && !filterXsp.GetType().Equals(musicUrl.GetType().c_str()))
        filterXsp.Reset();

      // remove the "filter" option from the path
      musicUrl.AddOption("filter", "");
    }
    directory = musicUrl.ToString();
  }

  items.SetArt("thumb", "");
  bool bResult = CGUIMediaWindow::GetDirectory(directory, items);
  if (bResult)
    CMusicThumbLoader::FillThumb(items);

  // (re-)apply the previously retrieved filter
  // because it was reset in CGUIMediaWindow::GetDirectory()
  if (!filterXsp.IsEmpty())
    m_filter = filterXsp;

  // add in the "New Playlist" item if we're in the playlists folder
  if ((items.GetPath() == "special://musicplaylists/") && !items.Contains("newplaylist://"))
  {
    CFileItemPtr newPlaylist(new CFileItem(g_settings.GetUserDataItem("PartyMode.xsp"),false));
    newPlaylist->SetLabel(g_localizeStrings.Get(16035));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->m_bIsFolder = true;
    items.Add(newPlaylist);

    newPlaylist.reset(new CFileItem("newplaylist://", false));
    newPlaylist->SetLabel(g_localizeStrings.Get(525));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->SetSpecialSort(SortSpecialOnBottom);
    newPlaylist->SetCanQueue(false);
    items.Add(newPlaylist);

    newPlaylist.reset(new CFileItem("newsmartplaylist://music", false));
    newPlaylist->SetLabel(g_localizeStrings.Get(21437));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->SetSpecialSort(SortSpecialOnBottom);
    newPlaylist->SetCanQueue(false);
    items.Add(newPlaylist);
  }

  return bResult;
}
예제 #3
0
bool CGUIWindowMusicBase::GetDirectory(const std::string &strDirectory, CFileItemList &items)
{
  items.SetArt("thumb", "");
  bool bResult = CGUIMediaWindow::GetDirectory(strDirectory, items);
  if (bResult)
  {
    CMusicThumbLoader loader;
    loader.FillThumb(items);
  }

  CQueryParams params;
  map<string, string> art;
  CDirectoryNode::GetDatabaseInfo(items.GetPath(), params);

  if (params.GetAlbumId() && m_musicdatabase.GetArtistArtForItem(params.GetAlbumId(), MediaTypeAlbum, art))
    items.AppendArt(art, MediaTypeAlbum);

  if (params.GetArtistId() && m_musicdatabase.GetArtForItem(params.GetArtistId(), MediaTypeArtist, art))
    items.AppendArt(art, MediaTypeArtist);

  // add in the "New Playlist" item if we're in the playlists folder
  if ((items.GetPath() == "special://musicplaylists/") && !items.Contains("newplaylist://"))
  {
    CFileItemPtr newPlaylist(new CFileItem(CProfilesManager::Get().GetUserDataItem("PartyMode.xsp"),false));
    newPlaylist->SetLabel(g_localizeStrings.Get(16035));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->m_bIsFolder = true;
    items.Add(newPlaylist);

    newPlaylist.reset(new CFileItem("newplaylist://", false));
    newPlaylist->SetLabel(g_localizeStrings.Get(525));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->SetSpecialSort(SortSpecialOnBottom);
    newPlaylist->SetCanQueue(false);
    items.Add(newPlaylist);

    newPlaylist.reset(new CFileItem("newsmartplaylist://music", false));
    newPlaylist->SetLabel(g_localizeStrings.Get(21437));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->SetSpecialSort(SortSpecialOnBottom);
    newPlaylist->SetCanQueue(false);
    items.Add(newPlaylist);
  }

  return bResult;
}
예제 #4
0
bool CGUIWindowMusicBase::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
  items.SetArt("thumb", "");
  bool bResult = CGUIMediaWindow::GetDirectory(strDirectory, items);
  if (bResult)
    CMusicThumbLoader::FillThumb(items);

  // add in the "New Playlist" item if we're in the playlists folder
  if ((items.GetPath() == "special://musicplaylists/") && !items.Contains("newplaylist://"))
  {
    //spotify, this is probably not the right place to do this but cant find a better one.
    //load up the spotify playlists
    //TODO scan all plugins for playlists
    g_spotify->GetPlaylists(items);

    CFileItemPtr newPlaylist(new CFileItem(g_settings.GetUserDataItem("PartyMode.xsp"),false));
    newPlaylist->SetLabel(g_localizeStrings.Get(16035));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->m_bIsFolder = true;
    items.Add(newPlaylist);

    newPlaylist.reset(new CFileItem("newplaylist://", false));
    newPlaylist->SetLabel(g_localizeStrings.Get(525));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->SetSpecialSort(SortSpecialOnBottom);
    newPlaylist->SetCanQueue(false);
    items.Add(newPlaylist);

    newPlaylist.reset(new CFileItem("newsmartplaylist://music", false));
    newPlaylist->SetLabel(g_localizeStrings.Get(21437));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->SetSpecialSort(SortSpecialOnBottom);
    newPlaylist->SetCanQueue(false);
    items.Add(newPlaylist);
  }

  return bResult;
}
예제 #5
0
bool CGUIWindowVideoNav::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
    if (m_thumbLoader.IsLoading())
        m_thumbLoader.StopThread();

    items.ClearProperties();

    bool bResult = CGUIWindowVideoBase::GetDirectory(strDirectory, items);
    if (bResult)
    {
        if (items.IsVideoDb())
        {
            XFILE::CVideoDatabaseDirectory dir;
            CQueryParams params;
            dir.GetQueryParams(items.GetPath(),params);
            VIDEODATABASEDIRECTORY::NODE_TYPE node = dir.GetDirectoryChildType(items.GetPath());

            // perform the flattening logic for tvshows with a single (unwatched) season (+ optional special season)
            if (node == NODE_TYPE_SEASONS)
            {
                int itemsSize = items.GetObjectCount();
                int firstIndex = items.Size() - itemsSize;
                // check if the last item is the "All seasons" item which should be ignored for flattening
                if (items[items.Size() - 1]->GetVideoInfoTag()->m_iSeason < 0)
                    itemsSize -= 1;

                int iFlatten = CSettings::Get().GetInt("videolibrary.flattentvshows");
                bool bFlatten = (itemsSize == 1 && iFlatten == 1) || iFlatten == 2 ||                              // flatten if one one season or if always flatten is enabled
                                (itemsSize == 2 && iFlatten == 1 &&                                                // flatten if one season + specials
                                 (items[firstIndex]->GetVideoInfoTag()->m_iSeason == 0 || items[firstIndex + 1]->GetVideoInfoTag()->m_iSeason == 0));

                if (iFlatten > 0 && !bFlatten && (WatchedMode)CMediaSettings::Get().GetWatchedMode("tvshows") == WatchedModeUnwatched)
                {
                    int count = 0;
                    for(int i = 0; i < items.Size(); i++)
                    {
                        const CFileItemPtr item = items.Get(i);
                        if (item->GetProperty("unwatchedepisodes").asInteger() != 0 && item->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(items.GetPath()))
                        return false;

                    videoUrl.AppendPath("-2/");
                    return GetDirectory(videoUrl.ToString(), items);
                }
            }

            items.SetArt("thumb", "");
            if (node == VIDEODATABASEDIRECTORY::NODE_TYPE_EPISODES ||
                    node == NODE_TYPE_SEASONS                          ||
                    node == NODE_TYPE_RECENTLY_ADDED_EPISODES)
            {
                CLog::Log(LOGDEBUG, "WindowVideoNav::GetDirectory");
                // grab the show thumb
                CVideoInfoTag details;
                m_database.GetTvShowInfo("", details, params.GetTvShowId());
                map<string, string> art;
                if (m_database.GetArtForItem(details.m_iDbId, details.m_type, art))
                {
                    items.AppendArt(art, "tvshow");
                    items.SetArtFallback("fanart", "tvshow.fanart");
                    if (node == NODE_TYPE_SEASONS)
                    {   // set an art fallback for "thumb"
                        if (items.HasArt("tvshow.poster"))
                            items.SetArtFallback("thumb", "tvshow.poster");
                        else if (items.HasArt("tvshow.banner"))
                            items.SetArtFallback("thumb", "tvshow.banner");
                    }
                }

                // Grab fanart data
                items.SetProperty("fanart_color1", details.m_fanart.GetColor(0));
                items.SetProperty("fanart_color2", details.m_fanart.GetColor(1));
                items.SetProperty("fanart_color3", details.m_fanart.GetColor(2));

                // save the show description (showplot)
                items.SetProperty("showplot", details.m_strPlot);

                // the container folder thumb is the parent (i.e. season or show)
                if (node == NODE_TYPE_EPISODES || node == NODE_TYPE_RECENTLY_ADDED_EPISODES)
                {
                    items.SetContent("episodes");
                    // grab the season thumb as the folder thumb
                    int seasonID = m_database.GetSeasonId(details.m_iDbId, params.GetSeason());
                    CGUIListItem::ArtMap seasonArt;
                    if (m_database.GetArtForItem(seasonID, "season", seasonArt))
                    {
                        items.AppendArt(art, "season");
                        // set an art fallback for "thumb"
                        if (items.HasArt("season.poster"))
                            items.SetArtFallback("thumb", "season.poster");
                        else if (items.HasArt("season.banner"))
                            items.SetArtFallback("thumb", "season.banner");
                    }
                }
                else
                    items.SetContent("seasons");
            }
            else if (node == NODE_TYPE_TITLE_MOVIES ||
                     node == NODE_TYPE_RECENTLY_ADDED_MOVIES)
                items.SetContent("movies");
            else if (node == NODE_TYPE_TITLE_TVSHOWS)
                items.SetContent("tvshows");
            else if (node == NODE_TYPE_TITLE_MUSICVIDEOS ||
                     node == NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS)
                items.SetContent("musicvideos");
            else if (node == NODE_TYPE_GENRE)
                items.SetContent("genres");
            else if (node == NODE_TYPE_COUNTRY)
                items.SetContent("countries");
            else if (node == NODE_TYPE_ACTOR)
            {
                if (params.GetContentType() == VIDEODB_CONTENT_MUSICVIDEOS)
                    items.SetContent("artists");
                else
                    items.SetContent("actors");
            }
            else if (node == NODE_TYPE_DIRECTOR)
                items.SetContent("directors");
            else if (node == NODE_TYPE_STUDIO)
                items.SetContent("studios");
            else if (node == NODE_TYPE_YEAR)
                items.SetContent("years");
            else if (node == NODE_TYPE_MUSICVIDEOS_ALBUM)
                items.SetContent("albums");
            else if (node == NODE_TYPE_SETS)
                items.SetContent("sets");
            else if (node == NODE_TYPE_TAGS)
                items.SetContent("tags");
            else
                items.SetContent("");
        }
        else if (!items.IsVirtualDirectoryRoot())
        {   // load info from the database
            CStdString label;
            if (items.GetLabel().empty() && m_rootDir.IsSource(items.GetPath(), CMediaSourceSettings::Get().GetSources("video"), &label))
                items.SetLabel(label);
            if (!items.IsSourcesPath())
                LoadVideoInfo(items);
        }

        CVideoDbUrl videoUrl;
        if (videoUrl.FromString(items.GetPath()) && items.GetContent() == "tags" &&
                !items.Contains("newtag://" + videoUrl.GetType()))
        {
            CFileItemPtr newTag(new CFileItem("newtag://" + videoUrl.GetType(), false));
            newTag->SetLabel(g_localizeStrings.Get(20462));
            newTag->SetLabelPreformated(true);
            newTag->SetSpecialSort(SortSpecialOnTop);
            items.Add(newTag);
        }
    }
    return bResult;
}