本文整理汇总了C++中CFileItemPtr::IsMusicDb方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::IsMusicDb方法的具体用法?C++ CFileItemPtr::IsMusicDb怎么用?C++ CFileItemPtr::IsMusicDb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::IsMusicDb方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SavePlayList
void CGUIWindowMusicPlayList::SavePlayList()
{
CStdString strNewFileName;
if (CGUIKeyboardFactory::ShowAndGetInput(strNewFileName, g_localizeStrings.Get(16012), false))
{
// need 2 rename it
CStdString strFolder, strPath;
URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "music", strFolder);
strNewFileName= CUtil::MakeLegalFileName( strNewFileName );
strNewFileName += ".m3u";
URIUtils::AddFileToFolder(strFolder, strNewFileName, strPath);
// get selected item
int iItem = m_viewControl.GetSelectedItem();
CStdString strSelectedItem = "";
if (iItem >= 0 && iItem < m_vecItems->Size())
{
CFileItemPtr pItem = m_vecItems->Get(iItem);
if (!pItem->IsParentFolder())
{
GetDirectoryHistoryString(pItem.get(), strSelectedItem);
}
}
CStdString strOldDirectory = m_vecItems->GetPath();
m_history.SetSelectedItem(strSelectedItem, strOldDirectory);
CPlayListM3U playlist;
for (int i = 0; i < (int)m_vecItems->Size(); ++i)
{
CFileItemPtr pItem = m_vecItems->Get(i);
// Musicdatabase items should contain the real path instead of a musicdb url
// otherwise the user can't save and reuse the playlist when the musicdb gets deleted
if (pItem->IsMusicDb())
pItem->SetPath(pItem->GetMusicInfoTag()->GetURL());
playlist.Add(pItem);
}
CLog::Log(LOGDEBUG, "Saving music playlist: [%s]", strPath.c_str());
playlist.Save(strPath);
Refresh(); // need to update
}
}
示例2: OnClick
bool CGUIWindowMusicNav::OnClick(int iItem)
{
if (iItem < 0 || iItem >= m_vecItems->Size()) return false;
CFileItemPtr item = m_vecItems->Get(iItem);
if (item->GetPath().Left(14) == "musicsearch://")
{
if (m_searchWithEdit)
OnSearchUpdate();
else
{
CStdString search(GetProperty("search"));
CGUIDialogKeyboard::ShowAndGetFilter(search, true);
SetProperty("search", search);
}
return true;
}
if (item->IsMusicDb() && !item->m_bIsFolder)
m_musicdatabase.SetPropertiesForFileItem(*item);
return CGUIWindowMusicBase::OnClick(iItem);
}
示例3: OnClick
bool CGUIWindowMusicNav::OnClick(int iItem)
{
if (iItem < 0 || iItem >= m_vecItems->Size()) return false;
CFileItemPtr item = m_vecItems->Get(iItem);
if (StringUtils::StartsWith(item->GetPath(), "musicsearch://"))
{
if (m_searchWithEdit)
OnSearchUpdate();
else
{
std::string search(GetProperty("search").asString());
CGUIKeyboardFactory::ShowAndGetFilter(search, true);
SetProperty("search", search);
}
return true;
}
if (item->IsMusicDb() && !item->m_bIsFolder)
m_musicdatabase.SetPropertiesForFileItem(*item);
return CGUIWindowMusicBase::OnClick(iItem);
}
示例4: GetItem
JSONRPC_STATUS CPlayerOperations::GetItem(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
PlayerType player = GetPlayer(parameterObject["playerid"]);
CFileItemPtr fileItem;
switch (player)
{
case Video:
case Audio:
{
fileItem = CFileItemPtr(new CFileItem(g_application.CurrentFileItem()));
if (fileItem->GetLabel().empty())
{
if (IsPVRChannel())
{
CPVRChannelPtr currentChannel;
if (g_PVRManager.GetCurrentChannel(currentChannel) && currentChannel.get() != NULL)
fileItem = CFileItemPtr(new CFileItem(*currentChannel.get()));
}
else if (player == Video)
{
if (!CVideoLibrary::FillFileItem(g_application.CurrentFile(), fileItem, parameterObject))
{
const CVideoInfoTag *currentVideoTag = g_infoManager.GetCurrentMovieTag();
if (currentVideoTag != NULL)
fileItem = CFileItemPtr(new CFileItem(*currentVideoTag));
fileItem->SetPath(g_application.CurrentFileItem().GetPath());
}
}
else
{
if (!CAudioLibrary::FillFileItem(g_application.CurrentFile(), fileItem, parameterObject))
{
const MUSIC_INFO::CMusicInfoTag *currentMusicTag = g_infoManager.GetCurrentSongTag();
if (currentMusicTag != NULL)
fileItem = CFileItemPtr(new CFileItem(*currentMusicTag));
fileItem->SetPath(g_application.CurrentFileItem().GetPath());
}
}
}
if (IsPVRChannel())
break;
if (player == Video)
{
bool additionalInfo = false;
bool streamdetails = false;
for (CVariant::const_iterator_array itr = parameterObject["properties"].begin_array(); itr != parameterObject["properties"].end_array(); itr++)
{
CStdString fieldValue = itr->asString();
if (fieldValue == "cast" || fieldValue == "set" || fieldValue == "setid" || fieldValue == "showlink" || fieldValue == "resume" ||
(fieldValue == "streamdetails" && !fileItem->GetVideoInfoTag()->m_streamDetails.HasItems()))
additionalInfo = true;
}
CVideoDatabase videodatabase;
if ((additionalInfo) &&
videodatabase.Open())
{
if (additionalInfo)
{
switch (fileItem->GetVideoContentType())
{
case VIDEODB_CONTENT_MOVIES:
videodatabase.GetMovieInfo("", *(fileItem->GetVideoInfoTag()), fileItem->GetVideoInfoTag()->m_iDbId);
break;
case VIDEODB_CONTENT_MUSICVIDEOS:
videodatabase.GetMusicVideoInfo("", *(fileItem->GetVideoInfoTag()), fileItem->GetVideoInfoTag()->m_iDbId);
break;
case VIDEODB_CONTENT_EPISODES:
videodatabase.GetEpisodeInfo("", *(fileItem->GetVideoInfoTag()), fileItem->GetVideoInfoTag()->m_iDbId);
break;
case VIDEODB_CONTENT_TVSHOWS:
case VIDEODB_CONTENT_MOVIE_SETS:
default:
break;
}
}
videodatabase.Close();
}
}
else if (player == Audio)
{
if (fileItem->IsMusicDb())
{
CMusicDatabase musicdb;
CFileItemList items;
items.Add(fileItem);
CAudioLibrary::GetAdditionalSongDetails(parameterObject, items, musicdb);
}
}
break;
}
case Picture:
//.........这里部分代码省略.........
示例5: GetContextButtons
void CGUIWindowMusicBase::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (item && !item->GetProperty("pluginreplacecontextitems").asBoolean())
{
if (item && !item->IsParentFolder())
{
if (!m_vecItems->IsPlugin() && (item->IsPlugin() || item->IsScript()))
buttons.Add(CONTEXT_BUTTON_INFO,24003); // Add-on info
if (item->CanQueue() && !item->IsAddonsPath() && !item->IsScript())
{
buttons.Add(CONTEXT_BUTTON_QUEUE_ITEM, 13347); //queue
// allow a folder to be ad-hoc queued and played by the default player
if (item->m_bIsFolder || (item->IsPlayList() &&
!g_advancedSettings.m_playlistAsFolders))
{
buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 208); // Play
}
else
{ // check what players we have, if we have multiple display play with option
VECPLAYERCORES vecCores;
CPlayerCoreFactory::GetInstance().GetPlayers(*item, vecCores);
if (vecCores.size() >= 1)
buttons.Add(CONTEXT_BUTTON_PLAY_WITH, 15213); // Play With...
}
if (item->IsSmartPlayList())
{
buttons.Add(CONTEXT_BUTTON_PLAY_PARTYMODE, 15216); // Play in Partymode
}
if (item->IsSmartPlayList() || m_vecItems->IsSmartPlayList())
buttons.Add(CONTEXT_BUTTON_EDIT_SMART_PLAYLIST, 586);
else if (item->IsPlayList() || m_vecItems->IsPlayList())
buttons.Add(CONTEXT_BUTTON_EDIT, 586);
}
// Add the scan button(s)
if (g_application.IsMusicScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
else if (!m_vecItems->IsMusicDb() && !m_vecItems->IsInternetStream() &&
!item->IsPath("add") && !item->IsParentFolder() &&
!item->IsPlugin() && !item->IsMusicDb() &&
!item->IsLibraryFolder() &&
!StringUtils::StartsWithNoCase(item->GetPath(), "addons://") &&
(CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_SCAN, 13352);
}
#ifdef HAS_DVD_DRIVE
// enable Rip CD Audio or Track button if we have an audio disc
if (g_mediaManager.IsDiscInDrive() && m_vecItems->IsCDDA())
{
// those cds can also include Audio Tracks: CDExtra and MixedMode!
MEDIA_DETECT::CCdInfo *pCdInfo = g_mediaManager.GetCdInfo();
if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
buttons.Add(CONTEXT_BUTTON_RIP_TRACK, 610);
}
#endif
}
// enable CDDB lookup if the current dir is CDDA
if (g_mediaManager.IsDiscInDrive() && m_vecItems->IsCDDA() &&
(CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_CDDB, 16002);
}
}
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
}
示例6: SetThumb
void CGUIWindowMusicNav::SetThumb(int iItem, CONTEXT_BUTTON button)
{
CFileItemPtr pItem = m_vecItems->Get(iItem);
CFileItemList items;
CStdString picturePath;
CStdString strPath=pItem->m_strPath;
CStdString strThumb;
CStdString cachedThumb;
if (button == CONTEXT_BUTTON_SET_ARTIST_THUMB)
{
long idArtist = -1;
if (pItem->IsMusicDb())
{
CUtil::RemoveSlashAtEnd(strPath);
int nPos=strPath.ReverseFind("/");
if (nPos>-1)
{
// try to guess where the user should start
// browsing for the artist thumb
idArtist=atol(strPath.Mid(nPos+1));
}
}
else if (pItem->IsVideoDb())
idArtist = m_musicdatabase.GetArtistByName(pItem->GetLabel());
m_musicdatabase.GetArtistPath(idArtist, picturePath);
cachedThumb = pItem->GetCachedArtistThumb();
CArtist artist;
m_musicdatabase.GetArtistInfo(idArtist,artist);
int i=1;
for (std::vector<CScraperUrl::SUrlEntry>::iterator iter=artist.thumbURL.m_url.begin();iter != artist.thumbURL.m_url.end();++iter)
{
CStdString thumbFromWeb;
CStdString strLabel;
strLabel.Format("allmusicthumb%i.jpg",i);
CUtil::AddFileToFolder("z:\\", strLabel, thumbFromWeb);
if (CScraperUrl::DownloadThumbnail(thumbFromWeb,*iter))
{
CStdString strItemPath;
strItemPath.Format("thumb://Remote%i",i++);
CFileItemPtr item(new CFileItem(strItemPath, false));
item->SetThumbnailImage(thumbFromWeb);
CStdString strLabel;
item->SetLabel(g_localizeStrings.Get(20015));
items.Add(item);
}
}
}
else
{
strPath = m_vecItems->Get(iItem)->m_strPath;
strPath.Replace("plugin://music/","Q:\\plugins\\music\\");
strPath.Replace("/","\\");
picturePath = strPath;
CFileItem item(strPath,true);
cachedThumb = item.GetCachedProgramThumb();
}
if (XFILE::CFile::Exists(cachedThumb))
{
CFileItemPtr item(new CFileItem("thumb://Current", false));
item->SetThumbnailImage(cachedThumb);
item->SetLabel(g_localizeStrings.Get(20016));
items.Add(item);
}
if (button == CONTEXT_BUTTON_SET_PLUGIN_THUMB)
{
if (items.Size() == 0)
{
CFileItem item2(strPath,false);
CUtil::AddFileToFolder(strPath,"default.py",item2.m_strPath);
if (XFILE::CFile::Exists(item2.GetCachedProgramThumb()))
{
CFileItemPtr item(new CFileItem("thumb://Current", false));
item->SetThumbnailImage(item2.GetCachedProgramThumb());
item->SetLabel(g_localizeStrings.Get(20016));
items.Add(item);
}
}
CUtil::AddFileToFolder(strPath,"default.tbn",strThumb);
if (XFILE::CFile::Exists(strThumb))
{
CFileItemPtr item(new CFileItem(strThumb,false));
item->SetThumbnailImage(strThumb);
item->SetLabel(g_localizeStrings.Get(20017));
items.Add(item);
}
}
CUtil::AddFileToFolder(picturePath,"folder.jpg",strThumb);
if (XFILE::CFile::Exists(strThumb))
{
CFileItemPtr pItem(new CFileItem(strThumb,false));
pItem->SetLabel(g_localizeStrings.Get(20017));
pItem->SetThumbnailImage(strThumb);
//.........这里部分代码省略.........