当前位置: 首页>>代码示例>>C++>>正文


C++ CFileItem::SetLabel方法代码示例

本文整理汇总了C++中CFileItem::SetLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItem::SetLabel方法的具体用法?C++ CFileItem::SetLabel怎么用?C++ CFileItem::SetLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileItem的用法示例。


在下文中一共展示了CFileItem::SetLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetDirectory

bool CGUIWindowMusicBase::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
  items.SetThumbnailImage("");
  bool bResult = CGUIMediaWindow::GetDirectory(strDirectory,items);
  if (bResult)
    items.SetMusicThumb();

  // add in the "New Playlist" item if we're in the playlists folder
  if (items.m_strPath == "special://musicplaylists/" && !items.Contains("newplaylist://"))
  {
    CFileItem* 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 = new CFileItem("newplaylist://", false);
    newPlaylist->SetLabel(g_localizeStrings.Get(525));
    newPlaylist->SetLabelPreformated(true);
    newPlaylist->SetCanQueue(false);
    items.Add(newPlaylist);

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

  return bResult;
}
开发者ID:jeppster,项目名称:xbmc-fork,代码行数:31,代码来源:GUIWindowMusicBase.cpp

示例2: FillFileItem

bool CFileOperations::FillFileItem(const CFileItemPtr &originalItem, CFileItem &item, CStdString media /* = "" */)
{
  if (originalItem.get() == NULL)
    return false;

  // copy all the available details
  item = *originalItem;

  bool status = false;
  CStdString strFilename = originalItem->GetPath();
  if (!strFilename.empty() && (CDirectory::Exists(strFilename) || CFile::Exists(strFilename)))
  {
    if (media.Equals("video"))
      status = CVideoLibrary::FillFileItem(strFilename, item);
    else if (media.Equals("music"))
      status = CAudioLibrary::FillFileItem(strFilename, item);

    if (status && item.GetLabel().empty())
    {
      CStdString label = originalItem->GetLabel();
      if (label.empty())
      {
        bool isDir = CDirectory::Exists(strFilename);
        label = CUtil::GetTitleFromPath(strFilename, isDir);
        if (label.empty())
          label = URIUtils::GetFileName(strFilename);
      }

      item.SetLabel(label);
    }
    else if (!status)
    {
      if (originalItem->GetLabel().empty())
      {
        bool isDir = CDirectory::Exists(strFilename);
        CStdString label = CUtil::GetTitleFromPath(strFilename, isDir);
        if (label.empty())
          return false;

        item.SetLabel(label);
        item.SetPath(strFilename);
        item.m_bIsFolder = isDir;
      }
      else
        item = *originalItem.get();

      status = true;
    }
  }

  return status;
}
开发者ID:madhatterpa,项目名称:xbmc,代码行数:52,代码来源:FileOperations.cpp

示例3: GetDirectory

bool CCMythDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
{
  CURL url(strPath);
  CStdString base(strPath);
  CUtil::RemoveSlashAtEnd(base);

  m_session = CCMythSession::AquireSession(strPath);
  if(!m_session)
    return false;

  m_dll = m_session->GetLibrary();
  if(!m_dll)
    return false;

  if(url.GetFileName().IsEmpty())
  {
    CFileItem *item;

    item = new CFileItem(base + "/channels/", true);
    item->SetLabel("Live Channels");
    item->SetLabelPreformated(true);
    items.Add(item);

    item = new CFileItem(base + "/recordings/", true);
    item->SetLabel("Recordings");
    item->SetLabelPreformated(true);
    items.Add(item);

    item = new CFileItem(base + "/guide/", true);
    item->SetLabel("Guide");
    item->SetLabelPreformated(true);
    items.Add(item);

    return true;
  }
  else if(url.GetFileName() == "channels/")
    return GetChannels(base, items);

  else if(url.GetFileName() == "channelsdb/")
    return GetChannelsDb(base, items);

  else if(url.GetFileName() == "recordings/")
    return GetRecordings(base, items);

  else if(url.GetFileName().Left(5) == "guide")
    return GetGuide(base, items);

  return false;
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:49,代码来源:CMythDirectory.cpp

示例4:

bool
CUPnPAvDirectory::GetResource(const CURI& path, CFileItem &item)
{
  CStdString strFileName = path.GetFileName();
  CStdString strHostName = path.GetHostName();
  CStdString strHddPath;

  CUtil::UrlDecode(strHostName);

  strHddPath.Format("%s/%s/%s", UPNP_MNT, strHostName, strFileName);

  if(!CFile::Exists(strHddPath))
  {
    CLog::Log(LOGERROR, "CUPnPAvDirectory::%s - upnp node [%s] for [%s] doesnt exists", __func__, strHddPath.c_str(), path.Get().c_str());
    return false;
  }

  item.m_strPath = strHddPath;
  item.SetLabel(path.Get());

  struct stat st;
  if (stat(strHddPath.c_str(),&st) == 0)
  {
    item.m_bIsFolder = S_ISDIR(st.st_mode);
  }

  return true;
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:28,代码来源:UPnPAvDirectory.cpp

示例5: FillFileItem

bool CFileOperations::FillFileItem(const CFileItemPtr &originalItem, CFileItem &item, CStdString media /* = "" */)
{
  if (originalItem.get() == NULL)
    return false;

  bool status = false;
  CStdString strFilename = originalItem->GetPath();
  if (!strFilename.empty() && (CDirectory::Exists(strFilename) || CFile::Exists(strFilename)))
  {
    if (media.Equals("video"))
      status = CVideoLibrary::FillFileItem(strFilename, item);
    else if (media.Equals("music"))
      status = CAudioLibrary::FillFileItem(strFilename, item);

    if (!status && originalItem->GetLabel().empty())
    {
      bool isDir = CDirectory::Exists(strFilename);
      CStdString label = CUtil::GetTitleFromPath(strFilename, isDir);
      if (!label.empty())
      {
        item = CFileItem(strFilename, isDir);
        item.SetLabel(label);

        status = true;
      }
    }
  }

  return status;
}
开发者ID:Alxandr,项目名称:spotyxbmc2,代码行数:30,代码来源:FileOperations.cpp

示例6: AddFavourite

JSONRPC_STATUS CFavouritesOperations::AddFavourite(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
  std::string type = parameterObject["type"].asString();

  if (type.compare("unknown") == 0)
    return InvalidParams;

  if ((type.compare("media") == 0 || type.compare("script") == 0) && !ParameterNotNull(parameterObject, "path"))
  {
    result["method"] = "Favourites.AddFavourite";
    result["stack"]["message"] = "Missing parameter";
    result["stack"]["name"] = "path";
    result["stack"]["type"] = "string";
    return InvalidParams;
  }

  if (type.compare("window") == 0 && !ParameterNotNull(parameterObject, "window"))
  {
    result["method"] = "Favourites.AddFavourite";
    result["stack"]["message"] = "Missing parameter";
    result["stack"]["name"] = "window";
    result["stack"]["type"] = "string";
    return InvalidParams;
  }

  std::string title = parameterObject["title"].asString();
  std::string path = parameterObject["path"].asString();

  CFileItem item;
  int contextWindow = 0;
  if (type.compare("window") == 0)
  {
    item = CFileItem(parameterObject["windowparameter"].asString(), true);
    contextWindow = CWindowTranslator::TranslateWindow(parameterObject["window"].asString());
    if (contextWindow == WINDOW_INVALID)
      return InvalidParams;
  } 
  else if (type.compare("script") == 0) 
  {
    if (!URIUtils::IsScript(path))
      path = "script://" + path;
    item = CFileItem(path, false);
  }
  else if (type.compare("media") == 0) 
  {
    item = CFileItem(path, false);
  }
  else
    return InvalidParams;

  item.SetLabel(title);
  if (ParameterNotNull(parameterObject,"thumbnail"))
    item.SetArt("thumb", parameterObject["thumbnail"].asString());

  if (CServiceBroker::GetFavouritesService().AddOrRemove(item, contextWindow))
    return ACK;
  else
    return FailedToExecute;
}
开发者ID:FLyrfors,项目名称:xbmc,代码行数:59,代码来源:FavouritesOperations.cpp

示例7: GetResource

bool CNfsDirectory::GetResource(const CURI& path, CFileItem &item)
{
  if(path.GetProtocol() != "nfs")
  {
     CLog::Log(LOGERROR, "CNfsDirectory::%s - invalid protocol [%s]", __func__, path.GetProtocol().c_str());
     return false;
  }

  CStdString strHostName = path.GetHostName();
  CStdString strFullPath = path.GetFileName();
  CStdString strFileName, strExportDir;

  int iPos = strFullPath.Find(":", 0);
  if (iPos != -1)
  {
    strExportDir = strFullPath.substr(0, iPos);
    strFileName  = strFullPath.substr(iPos + 1, strFullPath.length());
  }
  else
  {
    strExportDir = strFullPath;
  }

  CStdString strMountPoint = GetMountPoint("nfs",  strHostName, strExportDir);

  // path is not mounted - need to mount it
  if(!CUtil::IsMountpoint(strMountPoint) && CUtil::GetFsMagic(strMountPoint+strFileName) != NFS_SUPER_MAGIC)
  {
    CStdString nfsPath = strHostName + ":" + "/" + strExportDir;

    CLog::Log(LOGDEBUG, "CNfsDirectory::%s - mounting NFS share [%s] ==> [%s]", __func__, nfsPath.c_str(), strMountPoint.c_str());

    if(MountShare(nfsPath, strMountPoint) == false)
    {
      CLog::Log(LOGERROR, "CNfsDirectory::%s - failed to mount NFS share [%s]", __func__, nfsPath.c_str());
      return false;
    }
  }

  CStdString strHddPath = strMountPoint + strFileName;

  item.m_strPath = strHddPath;
  item.SetLabel(path.Get());

  item.SetProperty("filename", strFileName);
  item.SetProperty("mountpoint", strMountPoint);

  struct stat st;
  if (stat(strHddPath.c_str(),&st) == 0)
  {
    item.m_bIsFolder = S_ISDIR(st.st_mode);
  }

  return true;
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:55,代码来源:NfsDirectory.cpp

示例8: LaunchHtmlApp

void CAppManager::LaunchHtmlApp(const CAppDescriptor& desc)
{
  CLog::Log(LOGDEBUG, "CAppManager::LaunchHtmlApp, id = %s (applaunch)", desc.GetId().c_str());
  CStdString url = desc.GetURL();
  CUtil::URLEncode(url);
  CStdString path = "flash://"+desc.GetId()+"/?src="+url;
  CStdString controller = desc.GetController();
  if (!controller.IsEmpty())
  {
    CUtil::URLEncode(controller);
    path += "&bx-jsactions=" + controller;
  }
  
  CFileItem item;
  item.m_strPath = path;
  item.SetLabel(desc.GetName());
  item.GetVideoInfoTag()->m_strPlot = desc.GetDescription();
  item.SetProperty("appid", desc.GetId());
  g_application.PlayFile(item);
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:20,代码来源:AppManager.cpp

示例9: LaunchUrlApp

void CAppManager::LaunchUrlApp(const CAppDescriptor& desc)
{
  CLog::Log(LOGDEBUG, "CAppManager::LaunchUrlApp, id = %s (applaunch)", desc.GetId().c_str());
  if (g_windowManager.GetActiveWindow() != WINDOW_BOXEE_BROWSE_SIMPLE_APP)
  {
    CGUIWindowBoxeeBrowseSimpleApp::Show(desc.GetURL(), desc.GetName(), desc.GetBackgroundImageURL(), true, desc.GetId());
  }
  else
  {
    CFileItem* pItem = new CFileItem();
    pItem->m_strPath = desc.GetURL();
    pItem->SetLabel(desc.GetName());
    pItem->SetProperty("isrss", true);
    pItem->SetProperty("appid", desc.GetId());
    pItem->SetProperty("BrowseBackgroundImage", desc.GetBackgroundImageURL().c_str());
    CGUIMessage message(GUI_MSG_SET_CONTAINER_PATH, WINDOW_BOXEE_BROWSE_SIMPLE_APP, 0);
    message.SetPointer(pItem);
    g_windowManager.SendMessage(message);    
  }
}
开发者ID:Kr0nZ,项目名称:boxee,代码行数:20,代码来源:AppManager.cpp

示例10: FillFileItem

bool CFileOperations::FillFileItem(const CStdString &strFilename, CFileItem &item, CStdString media /* = "" */)
{
  bool status = false;
  if (!strFilename.empty() && !CDirectory::Exists(strFilename) && CFile::Exists(strFilename))
  {
    if (media.Equals("video"))
      status |= CVideoLibrary::FillFileItem(strFilename, item);
    else if (media.Equals("music"))
      status |= CAudioLibrary::FillFileItem(strFilename, item);

    if (!status)
    {
      item = CFileItem(strFilename, false);
      if (item.GetLabel().IsEmpty())
        item.SetLabel(CUtil::GetTitleFromPath(strFilename, false));
    }

    status = true;
  }

  return status;
}
开发者ID:AWilco,项目名称:xbmc,代码行数:22,代码来源:FileOperations.cpp

示例11: ParseGenres

bool CShoutcastDirectory::ParseGenres(TiXmlElement *root, CFileItemList &items, CURL &url)
{
  TiXmlElement *element = root->FirstChildElement("genre");
  
  if(element == NULL)
  {
    CLog::Log(LOGWARNING, "%s - No genres found", __FUNCTION__);
    return false;
  }
    
  items.m_idepth = 1; /* genre list */

  CStdString genre, path;
  while(element != NULL)
  {
    genre = element->Attribute("name");
    path = genre;

    /* genre must be urlencoded */
    CUtil::URLEncode(path);

    url.SetOptions("?genre=" + path);
    url.GetURL(path);


    CFileItem* pItem = new CFileItem;
    pItem->m_bIsFolder = true;
    pItem->SetLabel(genre);
    pItem->GetMusicInfoTag()->SetGenre(genre);
    pItem->m_strPath = path;  
    
    items.Add(pItem);

    element = element->NextSiblingElement("genre");
  }

  return true;
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:38,代码来源:ShoutcastDirectory.cpp

示例12: OnGetThumb

// TODO: Currently no support for "embedded thumb" as there is no easy way to grab it
//       without sending a file that has this as it's album to this class
void CGUIDialogSongInfo::OnGetThumb()
{
  CFileItemList items;

  
  // Grab the thumbnail from the web
  CStdString thumbFromWeb;
  /*
  CUtil::AddFileToFolder(g_advancedSettings.m_cachePath, "allmusicThumb.jpg", thumbFromWeb);
  if (DownloadThumbnail(thumbFromWeb))
  {
    CFileItem *item = new CFileItem("thumb://allmusic.com", false);
    item->SetThumbnailImage(thumbFromWeb);
    item->SetLabel(g_localizeStrings.Get(20055));
    items.Add(item);
  }*/

  // Current thumb
  if (CFile::Exists(m_song->GetThumbnailImage()))
  {
    CFileItem *item = new CFileItem("thumb://Current", false);
    item->SetThumbnailImage(m_song->GetThumbnailImage());
    item->SetLabel(g_localizeStrings.Get(20016));
    items.Add(item);
  }

  // local thumb
  CStdString cachedLocalThumb;
  CStdString localThumb(m_song->GetUserMusicThumb(true));
  if (m_song->IsMusicDb())
  {
    CFileItem item(m_song->GetMusicInfoTag()->GetURL(), false);
    localThumb = item.GetUserMusicThumb(true);
  }
  if (CFile::Exists(localThumb))
  {
    CUtil::AddFileToFolder(g_advancedSettings.m_cachePath, "localthumb.jpg", cachedLocalThumb);
    CPicture pic;
    if (pic.DoCreateThumbnail(localThumb, cachedLocalThumb))
    {
      CFileItem *item = new CFileItem("thumb://Local", false);
      item->SetThumbnailImage(cachedLocalThumb);
      item->SetLabel(g_localizeStrings.Get(20017));
      items.Add(item);
    }
  }
  else
  { // no local thumb exists, so we are just using the allmusic.com thumb or cached thumb
    // which is probably the allmusic.com thumb.  These could be wrong, so allow the user
    // to delete the incorrect thumb
    CFileItem *item = new CFileItem("thumb://None", false);
    item->SetThumbnailImage("defaultAlbumCover.png");
    item->SetLabel(g_localizeStrings.Get(20018));
    items.Add(item);
  }

  CStdString result;
  if (!CGUIDialogFileBrowser::ShowAndGetImage(items, g_settings.m_musicSources, g_localizeStrings.Get(1030), result))
    return;   // user cancelled

  if (result == "thumb://Current")
    return;   // user chose the one they have

  // delete the thumbnail if that's what the user wants, else overwrite with the
  // new thumbnail

  CStdString cachedThumb(CUtil::GetCachedAlbumThumb(m_song->GetMusicInfoTag()->GetAlbum(), m_song->GetMusicInfoTag()->GetArtist()));

  if (result == "thumb://None")
  { // cache the default thumb
    CPicture pic;
    pic.CacheSkinImage("defaultAlbumCover.png", cachedThumb);
  }
  else if (result == "thumb://allmusic.com")
    CFile::Cache(thumbFromWeb, cachedThumb);
  else if (result == "thumb://Local")
    CFile::Cache(cachedLocalThumb, cachedThumb);
  else if (CFile::Exists(result))
  {
    CPicture pic;
    pic.DoCreateThumbnail(result, cachedThumb);
  }

  m_song->SetThumbnailImage(cachedThumb);

  // tell our GUI to completely reload all controls (as some of them
  // are likely to have had this image in use so will need refreshing)
  CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_REFRESH_THUMBS);
  g_graphicsContext.SendMessage(msg);

//  m_hasUpdatedThumb = true;
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:94,代码来源:GUIDialogSongInfo.cpp

示例13: Update

// \brief Set window to a specific directory
// \param strDirectory The directory to be displayed in list/thumb control
// This function calls OnPrepareFileItems() and OnFinalizeFileItems()
bool CGUIMediaWindow::Update(const CStdString &strDirectory)
{
  // get selected item
  int iItem = m_viewControl.GetSelectedItem();
  CStdString strSelectedItem = "";
  if (iItem >= 0 && iItem < m_vecItems->Size())
  {
    CFileItem* pItem = m_vecItems->Get(iItem);
    if (!pItem->IsParentFolder())
    {
      GetDirectoryHistoryString(pItem, strSelectedItem);
    }
  }

  CStdString strOldDirectory = m_vecItems->m_strPath;

  m_history.SetSelectedItem(strSelectedItem, strOldDirectory);

  ClearFileItems();
  m_vecItems->ClearProperties();
  m_vecItems->SetThumbnailImage("");

  if (!GetDirectory(strDirectory, *m_vecItems))
  {
    CLog::Log(LOGERROR,"CGUIMediaWindow::GetDirectory(%s) failed", strDirectory.c_str());
    // if the directory is the same as the old directory, then we'll return
    // false.  Else, we assume we can get the previous directory
    if (strDirectory.Equals(strOldDirectory))
      return false;

    // We assume, we can get the parent
    // directory again, but we have to
    // return false to be able to eg. show
    // an error message.
    CStdString strParentPath = m_history.GetParentPath();
    m_history.RemoveParentPath();
    Update(strParentPath);
    return false;
  }

  // if we're getting the root source listing
  // make sure the path history is clean
  if (strDirectory.IsEmpty())
    m_history.ClearPathHistory();

  int iWindow = GetID();
  bool bOkay = (iWindow == WINDOW_MUSIC_FILES || iWindow == WINDOW_VIDEO_FILES || iWindow == WINDOW_FILES || iWindow == WINDOW_PICTURES || iWindow == WINDOW_PROGRAMS);
  if (strDirectory.IsEmpty() && bOkay && (m_vecItems->Size() == 0 || !m_guiState->DisableAddSourceButtons())) // add 'add source button'
  {
    CStdString strLabel = g_localizeStrings.Get(1026);
    CFileItem *pItem = new CFileItem(strLabel);
    pItem->m_strPath = "add";
    pItem->SetThumbnailImage("DefaultAddSource.png");
    pItem->SetLabel(strLabel);
    pItem->SetLabelPreformated(true);
    m_vecItems->Add(pItem);
  }
  m_iLastControl = GetFocusedControlID();

  //  Ask the derived class if it wants to load additional info
  //  for the fileitems like media info or additional
  //  filtering on the items, setting thumbs.
  OnPrepareFileItems(*m_vecItems);

  m_vecItems->FillInDefaultIcons();

  m_guiState.reset(CGUIViewState::GetViewState(GetID(), *m_vecItems));

  FormatAndSort(*m_vecItems);

  // Ask the devived class if it wants to do custom list operations,
  // eg. changing the label
  OnFinalizeFileItems(*m_vecItems);
  UpdateButtons();

  m_viewControl.SetItems(*m_vecItems);

  strSelectedItem = m_history.GetSelectedItem(m_vecItems->m_strPath);

  bool bSelectedFound = false;
  //int iSongInDirectory = -1;
  for (int i = 0; i < m_vecItems->Size(); ++i)
  {
    CFileItem* pItem = m_vecItems->Get(i);

    // Update selected item
    if (!bSelectedFound)
    {
      CStdString strHistory;
      GetDirectoryHistoryString(pItem, strHistory);
      if (strHistory == strSelectedItem)
      {
        m_viewControl.SetSelectedItem(i);
        bSelectedFound = true;
      }
    }
  }
//.........这里部分代码省略.........
开发者ID:jimmyswimmy,项目名称:plex,代码行数:101,代码来源:GUIMediaWindow.cpp

示例14: GetGuideForChannel

bool CCMythDirectory::GetGuideForChannel(const CStdString& base, int ChanNum, CFileItemList &items)
{
  cmyth_database_t db = m_session->GetDatabase();
  if(!db)
  {
    CLog::Log(LOGERROR, "%s - Could not get database", __FUNCTION__);
    return false;
  }

  time_t now;
  time(&now);
  // this sets how many seconds of EPG from now we should grabb
  time_t end = now + (1 * 24 * 60 * 60);

  cmyth_program_t *prog = NULL;

  int count = m_dll->mysql_get_guide(db, &prog, now, end);
  CLog::Log(LOGDEBUG, "%s - %i entries of guide data", __FUNCTION__, count);
  if (count <= 0)
    return false;

  for (int i = 0; i < count; i++)
  {
    if (prog[i].channum == ChanNum)
    {
      CStdString path;
      path.Format("%s%s", base.c_str(), prog[i].title);

      CDateTime starttime(prog[i].starttime);
      CDateTime endtime(prog[i].endtime);

      CStdString title;
      title.Format("%s - \"%s\"", starttime.GetAsLocalizedDateTime(), prog[i].title);

      CFileItem *item = new CFileItem(title, false);
      item->SetLabel(title);
      item->m_dateTime = starttime;
      item->SetLabelPreformated(true);

      CVideoInfoTag* tag = item->GetVideoInfoTag();

      tag->m_strAlbum       = GetValue(prog[i].callsign);
      tag->m_strShowTitle   = GetValue(prog[i].title);
      tag->m_strPlotOutline = GetValue(prog[i].subtitle);
      tag->m_strPlot        = GetValue(prog[i].description);
      tag->m_strGenre       = GetValue(prog[i].category);

      if(tag->m_strPlot.Left(tag->m_strPlotOutline.length()) != tag->m_strPlotOutline && !tag->m_strPlotOutline.IsEmpty())
          tag->m_strPlot = tag->m_strPlotOutline + '\n' + tag->m_strPlot;
      tag->m_strOriginalTitle = tag->m_strShowTitle;

      tag->m_strTitle = tag->m_strAlbum;
      if(tag->m_strShowTitle.length() > 0)
        tag->m_strTitle += " : " + tag->m_strShowTitle;

      CDateTimeSpan span(endtime.GetDay() - starttime.GetDay(),
                         endtime.GetHour() - starttime.GetHour(),
                         endtime.GetMinute() - starttime.GetMinute(),
                         endtime.GetSecond() - starttime.GetSecond());

      StringUtils::SecondsToTimeString( span.GetSeconds()
                                      + span.GetMinutes() * 60 
                                      + span.GetHours() * 3600, tag->m_strRuntime, TIME_FORMAT_GUESS);

      tag->m_iSeason  = 0; /* set this so xbmc knows it's a tv show */
      tag->m_iEpisode = 0;
      tag->m_strStatus = prog[i].rec_status;
      items.Add(item);
    }
  }
  m_dll->ref_release(prog);
  return true;
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:73,代码来源:CMythDirectory.cpp

示例15: ParseStations

bool CShoutcastDirectory::ParseStations(TiXmlElement *root, CFileItemList &items, CURL &url)
{
  TiXmlElement *element = NULL;
  CStdString path;

  items.m_idepth = 2; /* station list */

  element = root->FirstChildElement("tunein");
  if(element == NULL) 
  {
    CLog::Log(LOGWARNING, "%s - No tunein base found", __FUNCTION__);
    return false;
  }
  
  path = element->Attribute("base");
  path.TrimLeft("/");

  url.SetFileName(path);

  element = root->FirstChildElement("station");

  if(element == NULL)
  {
    CLog::Log(LOGWARNING, "%s - No stations found", __FUNCTION__);
    return false;
  }
  int stations = 0;
  while(element != NULL && stations < 1000)
  {
    CStdString name = element->Attribute("name");
    CStdString id = element->Attribute("id");
    CStdString bitrate = element->Attribute("br");
    CStdString genre = element->Attribute("genre");
    CStdString listeners = element->Attribute("lc");
    CStdString content = element->Attribute("mt");

    CStdString label = name;

    url.SetOptions("?id=" + id);
    url.GetURL(path);
    //printf("%s: %s\n", name.c_str(), path.c_str());

    CFileItem* pItem = new CFileItem;
    pItem->m_bIsFolder = false;
    
    /* we highjack the music tag for this stuff, they will be used by */
    /* viewstates to sort and display proper information */
    pItem->GetMusicInfoTag()->SetArtist(listeners);
    pItem->GetMusicInfoTag()->SetAlbum(bitrate);
    pItem->GetMusicInfoTag()->SetGenre(genre);

    /* this is what will be sorted upon */
    pItem->GetVideoInfoTag()->m_fRating = (float)atoi(listeners.c_str());
    pItem->m_dwSize = atoi(bitrate.c_str());


    pItem->SetLabel(label);

    /* content type is known before hand, should save later lookup */
    /* wonder if we could combine the contentype of the playlist and of the real stream */
    pItem->SetContentType("audio/x-scpls");

    pItem->m_strPath = path;
    
    items.Add(pItem);

    stations++;
    element = element->NextSiblingElement("station");
  }

  return true;
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:72,代码来源:ShoutcastDirectory.cpp


注:本文中的CFileItem::SetLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。