本文整理汇总了C++中CFileItemPtr::IsPlayList方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::IsPlayList方法的具体用法?C++ CFileItemPtr::IsPlayList怎么用?C++ CFileItemPtr::IsPlayList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::IsPlayList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateFileList
// \brief Synchonize the fileitems with the playlistplayer
// It recreated the playlist of the playlistplayer based
// on the fileitems of the window
void CGUIMediaWindow::UpdateFileList()
{
int nItem = m_viewControl.GetSelectedItem();
CStdString strSelected;
if (nItem >= 0)
strSelected = m_vecItems->Get(nItem)->m_strPath;
FormatAndSort(*m_vecItems);
UpdateButtons();
m_viewControl.SetItems(*m_vecItems);
m_viewControl.SetSelectedItem(strSelected);
// set the currently playing item as selected, if its in this directory
if (m_guiState.get() && m_guiState->IsCurrentPlaylistDirectory(m_vecItems->m_strPath))
{
int iPlaylist=m_guiState->GetPlaylist();
int nSong = g_playlistPlayer.GetCurrentSong();
CFileItem playlistItem;
if (nSong > -1 && iPlaylist > -1)
playlistItem=*g_playlistPlayer.GetPlaylist(iPlaylist)[nSong];
g_playlistPlayer.ClearPlaylist(iPlaylist);
g_playlistPlayer.Reset();
for (int i = 0; i < m_vecItems->Size(); i++)
{
CFileItemPtr pItem = m_vecItems->Get(i);
if (pItem->m_bIsFolder)
continue;
if (!pItem->IsPlayList() && !pItem->IsZIP() && !pItem->IsRAR())
g_playlistPlayer.Add(iPlaylist, pItem);
if (pItem->m_strPath == playlistItem.m_strPath &&
pItem->m_lStartOffset == playlistItem.m_lStartOffset)
g_playlistPlayer.SetCurrentSong(g_playlistPlayer.GetPlaylist(iPlaylist).size() - 1);
}
}
}
示例2: ScanTags
INFO_RET CMusicInfoScanner::ScanTags(const CFileItemList& items, CFileItemList& scannedItems)
{
vector<string> regexps = g_advancedSettings.m_audioExcludeFromScanRegExps;
for (int i = 0; i < items.Size(); ++i)
{
if (m_bStop)
return INFO_CANCELLED;
CFileItemPtr pItem = items[i];
if (CUtil::ExcludeFileOrFolder(pItem->GetPath(), regexps))
continue;
if (pItem->m_bIsFolder || pItem->IsPlayList() || pItem->IsPicture() || pItem->IsLyrics())
continue;
m_currentItem++;
CMusicInfoTag& tag = *pItem->GetMusicInfoTag();
if (!tag.Loaded())
{
auto_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(pItem->GetPath()));
if (NULL != pLoader.get())
pLoader->Load(pItem->GetPath(), tag);
}
if (m_handle && m_itemCount>0)
m_handle->SetPercentage(m_currentItem/(float)m_itemCount*100);
if (!tag.Loaded())
{
CLog::Log(LOGDEBUG, "%s - No tag found for: %s", __FUNCTION__, pItem->GetPath().c_str());
continue;
}
scannedItems.Add(pItem);
}
return INFO_ADDED;
}
示例3: OnPlayMedia
bool CGUIWindowMusicBase::OnPlayMedia(int iItem)
{
CFileItemPtr pItem = m_vecItems->Get(iItem);
if (pItem->m_strPath == "add" && pItem->GetLabel() == g_localizeStrings.Get(1026)) // 'add source button' in empty root
{
if (CGUIDialogMediaSource::ShowAndAddMediaSource("music"))
{
Update("");
return true;
}
return false;
}
// party mode
#ifndef _BOXEE_
if (g_partyModeManager.IsEnabled() && !pItem->IsLastFM())
{
CPlayList playlistTemp;
playlistTemp.Add(pItem);
g_partyModeManager.AddUserSongs(playlistTemp, true);
return true;
}
else
#endif
if (!pItem->IsPlayList() && !pItem->IsInternetStream())
{ // single music file - if we get here then we have autoplaynextitem turned off, but we
// still want to use the playlist player in order to handle more queued items following etc.
g_playlistPlayer.Reset();
g_playlistPlayer.ClearPlaylist(PLAYLIST_MUSIC);
g_playlistPlayer.Add(PLAYLIST_MUSIC, pItem);
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_MUSIC);
g_playlistPlayer.Play();
return true;
}
return CGUIMediaWindow::OnPlayMedia(iItem);
}
示例4: ScanMediaFolder
void CFileScanner::ScanMediaFolder(CStdString& strPath, const CStdString& strShareType, const CStdString& strSharePath)
{
bool isMediaFolderBeingResolved = m_MDE->IsMediaFolderBeingResolved(strPath);
if (isMediaFolderBeingResolved)
{
CLog::Log(LOGDEBUG,"CFileScanner::ScanMediaFolder - NOT scanning since [isMediaFolderBeingResolved=%d]. [path=%s][shareType=%s][sharePath=%s][m_bPaused=%d][m_bStop=%d] (fs)",isMediaFolderBeingResolved,strPath.c_str(),strShareType.c_str(),strSharePath.c_str(),m_bPaused,m_bStop);
return;
}
UpdateScanLabel(strPath);
bool isScannable = IsScannable(strPath);
if (m_bStop || !isScannable)
{
CLog::Log(LOGDEBUG,"CFileScanner::ScanMediaFolder - NOT scanning since [m_bStop=%d][isScannable=%d]. [path=%s][shareType=%s][sharePath=%s][m_bPaused=%d][m_bStop=%d] (fs)",m_bStop,isScannable,strPath.c_str(),strShareType.c_str(),strSharePath.c_str(),m_bPaused,m_bStop);
return;
}
CheckPause();
// first translate the media folder
strPath = _P(strPath);
if (m_bExtendedLog)
{
CLog::Log(LOGDEBUG,"CFileScanner::ScanMediaFolder, scan folder %s (filescanner)", strPath.c_str());
}
CleanChildFolders(strSharePath, strPath);
CFileItemPtr pItem;
// Retrieve the list of all items from the path
CFileItemList items, dirItems, audioItems, videoItems ;
if (!CDirectory::GetDirectory(strPath, items, "", false))
{
return;
}
std::vector<CStdString> playableFolders;
// Go over all items in the folder - split it into
// directories, audio files and movie files
for (int i=0; !m_bStop && m_currentShareValid && i<items.Size(); i++)
{
pItem = items[i];
if(strShareType == "video" && pItem->m_bIsFolder && !pItem->IsRAR() && !pItem->IsZIP() && (CUtil::IsBlurayFolder(pItem->m_strPath) || CUtil::IsDVDFolder(pItem->m_strPath)))
{
//if its a playable folder, we need it to be in videoItems since we pass it later to sync with the db
CLog::Log(LOGDEBUG,"CFileScanner::ScanMediaFolder - PLAYABLE - [path=%s]. [m_bPaused=%d][m_bStop=%d] (fs)",pItem->m_strPath.c_str(),m_bPaused,m_bStop);
videoItems.Add(pItem);
//we treat playable folders as video files, but we add them to the media_folders table in the db (hack)
//we do that because the resolver reads the items it should resolve from the media_folders
int iFolderId = m_MDE->GetMediaFolderId(pItem->m_strPath.c_str(), "videoFolder");
if (iFolderId == 0)
{
// need to add it when we synchronize
playableFolders.push_back(pItem->m_strPath);
}
}
else if ((pItem->m_bIsFolder || pItem->IsRAR() || pItem->IsZIP()) && (!pItem->IsPlayList()))
{
CLog::Log(LOGDEBUG,"CFileScanner::ScanMediaFolder - DIR - [path=%s]. [m_bPaused=%d][m_bStop=%d] (fs)",pItem->m_strPath.c_str(),m_bPaused,m_bStop);
dirItems.Add(pItem);
}
else if ((strShareType == "music") &&
(pItem->IsAudio() && !pItem->IsRAR() && !pItem->IsZIP() && !pItem->IsPlayList() ))
{
CLog::Log(LOGDEBUG,"CFileScanner::ScanMediaFolder - MUSIC - [path=%s]. [m_bPaused=%d][m_bStop=%d] (fs)",pItem->m_strPath.c_str(),m_bPaused,m_bStop);
audioItems.Add(pItem);
}
else if ((strShareType == "video") &&
(pItem->IsVideo() && !pItem->IsRAR() && !pItem->IsZIP() && !pItem->IsPlayList() ))
{
CLog::Log(LOGDEBUG,"CFileScanner::ScanMediaFolder - VIDEO - [path=%s]. [m_bPaused=%d][m_bStop=%d] (fs)",pItem->m_strPath.c_str(),m_bPaused,m_bStop);
videoItems.Add(pItem);
}
else
{
CLog::Log(LOGDEBUG,"CFileScanner::ScanMediaFolder, file %s is not directory, audio or video - skip (filescanner)",pItem->m_strPath.c_str());
}
}
// recursive call to all sub directories
for (int i=0; !m_bStop && m_currentShareValid && i<dirItems.Size(); i++)
{
CLog::Log(LOGDEBUG,"CFileScanner::ScanMediaFolder, dive into subdirectry %s (filescanner)", dirItems[i]->m_strPath.c_str());
ScanMediaFolder(dirItems[i]->m_strPath, strShareType, strSharePath);
}
// if it is a music share, and the folder contains audio files sync it with the database
if ((strShareType == "music"))
{
CLog::Log(LOGDEBUG,"CFileScanner::ScanMediaFolder, synchronized music folder %s (filescanner)", strPath.c_str());
SynchronizeFolderAndDatabase(strPath, "music", strSharePath, audioItems);
}
//.........这里部分代码省略.........
示例5: OnContextButton
//.........这里部分代码省略.........
g_settings.Save();
return true;
case CONTEXT_BUTTON_GO_TO_ARTIST:
{
CStdString strPath;
CVideoDatabase database;
database.Open();
strPath.Format("videodb://3/4/%ld/",database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtist()));
g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath);
return true;
}
case CONTEXT_BUTTON_PLAY_OTHER:
{
CVideoDatabase database;
database.Open();
CVideoInfoTag details;
database.GetMusicVideoInfo("",details,database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtist(),item->GetMusicInfoTag()->GetAlbum(),item->GetMusicInfoTag()->GetTitle()));
g_application.getApplicationMessenger().PlayFile(CFileItem(details));
return true;
}
case CONTEXT_BUTTON_MARK_WATCHED:
CGUIWindowVideoBase::MarkWatched(item,true);
CUtil::DeleteVideoDatabaseDirectoryCache();
Update(m_vecItems->GetPath());
return true;
case CONTEXT_BUTTON_MARK_UNWATCHED:
CGUIWindowVideoBase::MarkWatched(item,false);
CUtil::DeleteVideoDatabaseDirectoryCache();
Update(m_vecItems->GetPath());
return true;
case CONTEXT_BUTTON_RENAME:
CGUIWindowVideoBase::UpdateVideoTitle(item.get());
CUtil::DeleteVideoDatabaseDirectoryCache();
Update(m_vecItems->GetPath());
return true;
case CONTEXT_BUTTON_DELETE:
if (item->IsPlayList() || item->IsSmartPlayList())
{
item->m_bIsFolder = false;
CFileUtils::DeleteItem(item);
}
else
{
CGUIWindowVideoNav::DeleteItem(item.get());
CUtil::DeleteVideoDatabaseDirectoryCache();
}
Update(m_vecItems->GetPath());
return true;
case CONTEXT_BUTTON_SET_CONTENT:
{
bool bScan=false;
ADDON::ScraperPtr scraper;
CStdString path(item->GetPath());
CQueryParams params;
CDirectoryNode::GetDatabaseInfo(item->GetPath(), params);
CONTENT_TYPE content = CONTENT_ALBUMS;
if (params.GetAlbumId() != -1)
path.Format("musicdb://3/%i/",params.GetAlbumId());
else if (params.GetArtistId() != -1)
{
path.Format("musicdb://2/%i/",params.GetArtistId());
content = CONTENT_ARTISTS;
}
if (m_vecItems->GetPath().Equals("musicdb://1/") || item->GetPath().Equals("musicdb://2/"))
{
content = CONTENT_ARTISTS;
}
if (!m_musicdatabase.GetScraperForPath(path, scraper, ADDON::ScraperTypeFromContent(content)))
{
ADDON::AddonPtr defaultScraper;
if (ADDON::CAddonMgr::Get().GetDefault(ADDON::ScraperTypeFromContent(content), defaultScraper))
{
scraper = boost::dynamic_pointer_cast<ADDON::CScraper>(defaultScraper->Clone(defaultScraper));
}
}
if (CGUIDialogContentSettings::Show(scraper, bScan, content))
{
m_musicdatabase.SetScraperForPath(path,scraper);
if (bScan)
OnInfoAll(itemNumber,true);
}
return true;
}
default:
break;
}
return CGUIWindowMusicBase::OnContextButton(itemNumber, button);
}
示例6: RetrieveMusicInfo
int CMusicInfoScanner::RetrieveMusicInfo(CFileItemList& items, const CStdString& strDirectory)
{
CSongMap songsMap;
// get all information for all files in current directory from database, and remove them
if (m_musicDatabase.RemoveSongsFromPath(strDirectory, songsMap))
m_needsCleanup = true;
VECSONGS songsToAdd;
CStdStringArray regexps = g_advancedSettings.m_audioExcludeFromScanRegExps;
// for every file found, but skip folder
for (int i = 0; i < items.Size(); ++i)
{
CFileItemPtr pItem = items[i];
CStdString strExtension;
URIUtils::GetExtension(pItem->GetPath(), strExtension);
if (m_bStop)
return 0;
// Discard all excluded files defined by m_musicExcludeRegExps
if (CUtil::ExcludeFileOrFolder(pItem->GetPath(), regexps))
continue;
// dont try reading id3tags for folders, playlists or shoutcast streams
if (!pItem->m_bIsFolder && !pItem->IsPlayList() && !pItem->IsPicture() && !pItem->IsLyrics() )
{
m_currentItem++;
// CLog::Log(LOGDEBUG, "%s - Reading tag for: %s", __FUNCTION__, pItem->GetPath().c_str());
// grab info from the song
CSong *dbSong = songsMap.Find(pItem->GetPath());
CMusicInfoTag& tag = *pItem->GetMusicInfoTag();
if (!tag.Loaded() )
{ // read the tag from a file
auto_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(pItem->GetPath()));
if (NULL != pLoader.get())
pLoader->Load(pItem->GetPath(), tag);
}
// if we have the itemcount, update our
// dialog with the progress we made
if (m_handle && m_itemCount>0)
m_handle->SetPercentage(m_currentItem/(float)m_itemCount*100);
if (tag.Loaded())
{
CSong song(tag);
// ensure our song has a valid filename or else it will assert in AddSong()
if (song.strFileName.IsEmpty())
{
// copy filename from path in case UPnP or other tag loaders didn't specify one (FIXME?)
song.strFileName = pItem->GetPath();
// if we still don't have a valid filename, skip the song
if (song.strFileName.IsEmpty())
{
// this shouldn't ideally happen!
CLog::Log(LOGERROR, "Skipping song since it doesn't seem to have a filename");
continue;
}
}
song.iStartOffset = pItem->m_lStartOffset;
song.iEndOffset = pItem->m_lEndOffset;
song.strThumb = pItem->GetUserMusicThumb(true);
if (dbSong)
{ // keep the db-only fields intact on rescan...
song.iTimesPlayed = dbSong->iTimesPlayed;
song.lastPlayed = dbSong->lastPlayed;
song.iKaraokeNumber = dbSong->iKaraokeNumber;
if (song.rating == '0') song.rating = dbSong->rating;
if (song.strThumb.empty())
song.strThumb = dbSong->strThumb;
}
songsToAdd.push_back(song);
// CLog::Log(LOGDEBUG, "%s - Tag loaded for: %s", __FUNCTION__, pItem->GetPath().c_str());
}
else
CLog::Log(LOGDEBUG, "%s - No tag found for: %s", __FUNCTION__, pItem->GetPath().c_str());
}
}
VECALBUMS albums;
CategoriseAlbums(songsToAdd, albums);
FindArtForAlbums(albums, items.GetPath());
// finally, add these to the database
m_musicDatabase.BeginTransaction();
int numAdded = 0;
set<int> albumsToScan;
set<int> artistsToScan;
for (VECALBUMS::iterator i = albums.begin(); i != albums.end(); ++i)
{
vector<int> songIDs;
//.........这里部分代码省略.........
示例7: RetrieveMusicInfo
int CMusicInfoScanner::RetrieveMusicInfo(CFileItemList& items, const CStdString& strDirectory)
{
CSongMap songsMap;
// get all information for all files in current directory from database, and remove them
if (m_musicDatabase.RemoveSongsFromPath(strDirectory, songsMap))
m_needsCleanup = true;
VECSONGS songsToAdd;
CStdStringArray regexps = g_advancedSettings.m_audioExcludeFromScanRegExps;
// for every file found, but skip folder
for (int i = 0; i < items.Size(); ++i)
{
CFileItemPtr pItem = items[i];
CStdString strExtension;
URIUtils::GetExtension(pItem->GetPath(), strExtension);
if (m_bStop)
return 0;
// Discard all excluded files defined by m_musicExcludeRegExps
if (CUtil::ExcludeFileOrFolder(pItem->GetPath(), regexps))
continue;
// dont try reading id3tags for folders, playlists or shoutcast streams
if (!pItem->m_bIsFolder && !pItem->IsPlayList() && !pItem->IsPicture() && !pItem->IsLyrics() )
{
m_currentItem++;
// CLog::Log(LOGDEBUG, "%s - Reading tag for: %s", __FUNCTION__, pItem->GetPath().c_str());
// grab info from the song
CSong *dbSong = songsMap.Find(pItem->GetPath());
CMusicInfoTag& tag = *pItem->GetMusicInfoTag();
if (!tag.Loaded() )
{ // read the tag from a file
auto_ptr<IMusicInfoTagLoader> pLoader (CMusicInfoTagLoaderFactory::CreateLoader(pItem->GetPath()));
if (NULL != pLoader.get())
pLoader->Load(pItem->GetPath(), tag);
}
// if we have the itemcount, notify our
// observer with the progress we made
if (m_pObserver && m_itemCount>0)
m_pObserver->OnSetProgress(m_currentItem, m_itemCount);
if (tag.Loaded())
{
CSong song(tag);
// ensure our song has a valid filename or else it will assert in AddSong()
if (song.strFileName.IsEmpty())
{
// copy filename from path in case UPnP or other tag loaders didn't specify one (FIXME?)
song.strFileName = pItem->GetPath();
// if we still don't have a valid filename, skip the song
if (song.strFileName.IsEmpty())
{
// this shouldn't ideally happen!
CLog::Log(LOGERROR, "Skipping song since it doesn't seem to have a filename");
continue;
}
}
song.iStartOffset = pItem->m_lStartOffset;
song.iEndOffset = pItem->m_lEndOffset;
if (dbSong)
{ // keep the db-only fields intact on rescan...
song.iTimesPlayed = dbSong->iTimesPlayed;
song.lastPlayed = dbSong->lastPlayed;
song.iKaraokeNumber = dbSong->iKaraokeNumber;
if (song.rating == '0') song.rating = dbSong->rating;
}
pItem->SetMusicThumb();
song.strThumb = pItem->GetThumbnailImage();
songsToAdd.push_back(song);
// CLog::Log(LOGDEBUG, "%s - Tag loaded for: %s", __FUNCTION__, pItem->GetPath().c_str());
}
else
CLog::Log(LOGDEBUG, "%s - No tag found for: %s", __FUNCTION__, pItem->GetPath().c_str());
}
}
CheckForVariousArtists(songsToAdd);
if (!items.HasThumbnail())
UpdateFolderThumb(songsToAdd, items.GetPath());
// finally, add these to the database
set<CStdString> artistsToScan;
set< pair<CStdString, CStdString> > albumsToScan;
m_musicDatabase.BeginTransaction();
for (unsigned int i = 0; i < songsToAdd.size(); ++i)
{
if (m_bStop)
{
m_musicDatabase.RollbackTransaction();
//.........这里部分代码省略.........
示例8: OnContextButton
//.........这里部分代码省略.........
case CONTEXT_BUTTON_GO_TO_ARTIST:
{
CStdString strPath;
CVideoDatabase database;
database.Open();
strPath = StringUtils::Format("videodb://musicvideos/artists/%ld/",
database.GetMatchingMusicVideo(StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator)));
g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath);
return true;
}
case CONTEXT_BUTTON_PLAY_OTHER:
{
CVideoDatabase database;
database.Open();
CVideoInfoTag details;
database.GetMusicVideoInfo("",details,database.GetMatchingMusicVideo(StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator),item->GetMusicInfoTag()->GetAlbum(),item->GetMusicInfoTag()->GetTitle()));
CApplicationMessenger::Get().PlayFile(CFileItem(details));
return true;
}
case CONTEXT_BUTTON_MARK_WATCHED:
CGUIDialogVideoInfo::MarkWatched(item, true);
CUtil::DeleteVideoDatabaseDirectoryCache();
Refresh();
return true;
case CONTEXT_BUTTON_MARK_UNWATCHED:
CGUIDialogVideoInfo::MarkWatched(item, false);
CUtil::DeleteVideoDatabaseDirectoryCache();
Refresh();
return true;
case CONTEXT_BUTTON_RENAME:
CGUIDialogVideoInfo::UpdateVideoItemTitle(item);
CUtil::DeleteVideoDatabaseDirectoryCache();
Refresh();
return true;
case CONTEXT_BUTTON_DELETE:
if (item->IsPlayList() || item->IsSmartPlayList())
{
item->m_bIsFolder = false;
CFileUtils::DeleteItem(item);
}
else
{
CGUIDialogVideoInfo::DeleteVideoItemFromDatabase(item);
CUtil::DeleteVideoDatabaseDirectoryCache();
}
Refresh();
return true;
case CONTEXT_BUTTON_SET_CONTENT:
{
ADDON::ScraperPtr scraper;
CStdString path(item->GetPath());
CQueryParams params;
CDirectoryNode::GetDatabaseInfo(item->GetPath(), params);
CONTENT_TYPE content = CONTENT_ALBUMS;
if (params.GetAlbumId() != -1)
path = StringUtils::Format("musicdb://albums/%i/",params.GetAlbumId());
else if (params.GetArtistId() != -1)
{
path = StringUtils::Format("musicdb://artists/%i/",params.GetArtistId());
content = CONTENT_ARTISTS;
}
if (m_vecItems->GetPath().Equals("musicdb://genres/") || item->GetPath().Equals("musicdb://artists/"))
{
content = CONTENT_ARTISTS;
}
if (!m_musicdatabase.GetScraperForPath(path, scraper, ADDON::ScraperTypeFromContent(content)))
{
ADDON::AddonPtr defaultScraper;
if (ADDON::CAddonMgr::Get().GetDefault(ADDON::ScraperTypeFromContent(content), defaultScraper))
{
scraper = boost::dynamic_pointer_cast<ADDON::CScraper>(defaultScraper->Clone());
}
}
if (CGUIDialogContentSettings::Show(scraper, content))
{
m_musicdatabase.SetScraperForPath(path,scraper);
if (CGUIDialogYesNo::ShowAndGetInput(20442,20443,20444,20022))
{
OnInfoAll(itemNumber,true,true);
}
}
return true;
}
default:
break;
}
return CGUIWindowMusicBase::OnContextButton(itemNumber, button);
}
示例9: GetContextButtons
//.........这里部分代码省略.........
if (database.GetSongByArtistAndAlbumAndTitle(StringUtils::Join(item->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator),
item->GetVideoInfoTag()->m_strAlbum,
item->GetVideoInfoTag()->m_strTitle) > -1)
{
buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 20398);
}
}
if (!item->IsParentFolder())
{
ADDON::ScraperPtr info;
VIDEO::SScanSettings settings;
GetScraperForItem(item.get(), info, settings);
if (info && info->Content() == CONTENT_TVSHOWS)
buttons.Add(CONTEXT_BUTTON_INFO, item->m_bIsFolder ? 20351 : 20352);
else if (info && info->Content() == CONTENT_MUSICVIDEOS)
buttons.Add(CONTEXT_BUTTON_INFO,20393);
else if (info && info->Content() == CONTENT_MOVIES)
buttons.Add(CONTEXT_BUTTON_INFO, 13346);
// can we update the database?
if (CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser)
{
if (!item->IsPlugin() && !item->IsScript() && !item->IsLiveTV() && !item->IsAddonsPath() &&
item->GetPath() != "sources://video/" &&
item->GetPath() != "special://videoplaylists/" &&
!StringUtils::StartsWith(item->GetPath(), "newsmartplaylist://") &&
!StringUtils::StartsWith(item->GetPath(), "newplaylist://") &&
!StringUtils::StartsWith(item->GetPath(), "newtag://"))
{
if (item->m_bIsFolder)
{
// Have both options for folders since we don't know whether all childs are watched/unwatched
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); //Mark as UnWatched
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); //Mark as Watched
}
else
{
if (item->GetOverlayImage() == "OverlayWatched.png")
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); //Mark as UnWatched
else
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); //Mark as Watched
}
}
if (!g_application.IsVideoScanning() && item->IsVideoDb() && item->HasVideoInfoTag() &&
(item->GetVideoInfoTag()->m_type == MediaTypeMovie || // movies
item->GetVideoInfoTag()->m_type == MediaTypeTvShow || // tvshows
item->GetVideoInfoTag()->m_type == MediaTypeSeason || // seasons
item->GetVideoInfoTag()->m_type == MediaTypeEpisode || // episodes
item->GetVideoInfoTag()->m_type == MediaTypeMusicVideo || // musicvideos
item->GetVideoInfoTag()->m_type == "tag" || // tags
item->GetVideoInfoTag()->m_type == MediaTypeVideoCollection)) // sets
{
buttons.Add(CONTEXT_BUTTON_EDIT, 16106);
}
if (node == NODE_TYPE_TITLE_TVSHOWS)
{
if (g_application.IsVideoScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353);
buttons.Add(CONTEXT_BUTTON_SCAN, 13349);
}
if (node == NODE_TYPE_ACTOR && !dir.IsAllItem(item->GetPath()) && item->m_bIsFolder)
{
if (StringUtils::StartsWithNoCase(m_vecItems->GetPath(), "videodb://musicvideos")) // mvids
buttons.Add(CONTEXT_BUTTON_SET_ARTIST_THUMB, 13359);
else
buttons.Add(CONTEXT_BUTTON_SET_ACTOR_THUMB, 20403);
}
}
if (!m_vecItems->IsVideoDb() && !m_vecItems->IsVirtualDirectoryRoot())
{ // non-video db items, file operations are allowed
if ((CSettings::GetInstance().GetBool(CSettings::SETTING_FILELISTS_ALLOWFILEDELETION) &&
CUtil::SupportsWriteFileOperations(item->GetPath())) ||
(inPlaylists && URIUtils::GetFileName(item->GetPath()) != "PartyMode-Video.xsp"
&& (item->IsPlayList() || item->IsSmartPlayList())))
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
}
// add "Set/Change content" to folders
if (item->m_bIsFolder && !item->IsVideoDb() && !item->IsPlayList() && !item->IsSmartPlayList() && !item->IsLibraryFolder() && !item->IsLiveTV() && !item->IsPlugin() && !item->IsAddonsPath() && !URIUtils::IsUPnP(item->GetPath()))
{
if (info && info->Content() != CONTENT_NONE)
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20442);
else
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20333);
if (info && info->Content() != CONTENT_NONE)
buttons.Add(CONTEXT_BUTTON_SCAN, 13349);
}
}
if (item->IsPlugin() || item->IsScript() || m_vecItems->IsPlugin())
buttons.Add(CONTEXT_BUTTON_PLUGIN_SETTINGS, 1045);
}
CContextMenuManager::GetInstance().AddVisibleItems(item, buttons);
}
}
示例10: OnContextButton
//.........这里部分代码省略.........
return true;
case CONTEXT_BUTTON_CLEAR_DEFAULT:
CSettings::GetInstance().SetString(CSettings::SETTING_MYMUSIC_DEFAULTLIBVIEW, "");
CSettings::GetInstance().Save();
return true;
case CONTEXT_BUTTON_GO_TO_ARTIST:
{
std::string strPath;
CVideoDatabase database;
database.Open();
strPath = StringUtils::Format("videodb://musicvideos/artists/%i/",
database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtistString()));
g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath);
return true;
}
case CONTEXT_BUTTON_PLAY_OTHER:
{
CVideoDatabase database;
database.Open();
CVideoInfoTag details;
database.GetMusicVideoInfo("", details, database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtistString(), item->GetMusicInfoTag()->GetAlbum(), item->GetMusicInfoTag()->GetTitle()));
CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(details)));
return true;
}
case CONTEXT_BUTTON_RENAME:
if (!item->IsVideoDb() && !item->IsReadOnly())
OnRenameItem(itemNumber);
CGUIDialogVideoInfo::UpdateVideoItemTitle(item);
CUtil::DeleteVideoDatabaseDirectoryCache();
Refresh();
return true;
case CONTEXT_BUTTON_DELETE:
if (item->IsPlayList() || item->IsSmartPlayList())
{
item->m_bIsFolder = false;
CFileUtils::DeleteItem(item);
}
else if (!item->IsVideoDb())
OnDeleteItem(itemNumber);
else
{
CGUIDialogVideoInfo::DeleteVideoItemFromDatabase(item);
CUtil::DeleteVideoDatabaseDirectoryCache();
}
Refresh();
return true;
case CONTEXT_BUTTON_SET_CONTENT:
{
ADDON::ScraperPtr scraper;
std::string path(item->GetPath());
CQueryParams params;
CDirectoryNode::GetDatabaseInfo(item->GetPath(), params);
CONTENT_TYPE content = CONTENT_ALBUMS;
if (params.GetAlbumId() != -1)
path = StringUtils::Format("musicdb://albums/%li/",params.GetAlbumId());
else if (params.GetArtistId() != -1)
{
path = StringUtils::Format("musicdb://artists/%li/",params.GetArtistId());
content = CONTENT_ARTISTS;
}
if (m_vecItems->IsPath("musicdb://genres/") || item->IsPath("musicdb://artists/"))
{
content = CONTENT_ARTISTS;
}
if (!m_musicdatabase.GetScraperForPath(path, scraper, ADDON::ScraperTypeFromContent(content)))
{
ADDON::AddonPtr defaultScraper;
if (ADDON::CAddonMgr::GetInstance().GetDefault(ADDON::ScraperTypeFromContent(content), defaultScraper))
{
scraper = std::dynamic_pointer_cast<ADDON::CScraper>(defaultScraper);
}
}
if (CGUIDialogContentSettings::Show(scraper, content))
{
m_musicdatabase.SetScraperForPath(path,scraper);
if (CGUIDialogYesNo::ShowAndGetInput(CVariant{20442}, CVariant{20443}))
{
OnItemInfoAll(itemNumber,true,true);
}
}
return true;
}
default:
break;
}
return CGUIWindowMusicBase::OnContextButton(itemNumber, button);
}
示例11: GetContextButtons
void CGUIWindowMusicSongs::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (item)
{
// are we in the playlists location?
bool inPlaylists = m_vecItems->m_strPath.Equals(CUtil::MusicPlaylistsLocation()) ||
m_vecItems->m_strPath.Equals("special://musicplaylists/");
if (m_vecItems->IsVirtualDirectoryRoot())
{
// get the usual music shares, and anything for all media windows
CGUIDialogContextMenu::GetContextButtons("music", item, buttons);
// enable Rip CD an audio disc
if (CDetectDVDMedia::IsDiscInDrive() && item->IsCDDA())
{
// those cds can also include Audio Tracks: CDExtra and MixedMode!
CCdInfo *pCdInfo = CDetectDVDMedia::GetCdInfo();
if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
buttons.Add(CONTEXT_BUTTON_RIP_CD, 600);
}
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
}
else
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
if (item->GetPropertyBOOL("pluginreplacecontextitems"))
return;
if (!item->IsPlayList())
{
if (item->IsAudio() && !item->IsLastFM() && !item->IsShoutCast())
buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658); // Song Info
else if (!item->IsParentFolder() && !item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Left(3).Equals("new") && item->m_bIsFolder)
{
#if 0
if (m_musicdatabase.GetAlbumIdByPath(item->m_strPath) > -1)
#endif
buttons.Add(CONTEXT_BUTTON_INFO, 13351); // Album Info
}
}
// enable Rip CD Audio or Track button if we have an audio disc
if (CDetectDVDMedia::IsDiscInDrive() && m_vecItems->IsCDDA())
{
// those cds can also include Audio Tracks: CDExtra and MixedMode!
CCdInfo *pCdInfo = CDetectDVDMedia::GetCdInfo();
if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
buttons.Add(CONTEXT_BUTTON_RIP_TRACK, 610);
}
// enable CDDB lookup if the current dir is CDDA
if (CDetectDVDMedia::IsDiscInDrive() && m_vecItems->IsCDDA() &&
(g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_CDDB, 16002);
}
if (!item->IsParentFolder() && !item->IsReadOnly())
{
// either we're at the playlist location or its been explicitly allowed
if (inPlaylists || g_guiSettings.GetBool("filelists.allowfiledeletion"))
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
}
}
}
// Add the scan button(s)
CGUIDialogMusicScan *pScanDlg = (CGUIDialogMusicScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
if (g_guiSettings.GetBool("musiclibrary.enabled") && pScanDlg)
{
if (pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
else if (!inPlaylists && !m_vecItems->IsInternetStream() &&
!item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Equals("add") && !item->IsParentFolder() &&
(g_settings.m_vecProfiles[g_settings.m_iLastLoadedProfileIndex].canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_SCAN, 13352);
}
}
}
if (!m_vecItems->IsVirtualDirectoryRoot())
buttons.Add(CONTEXT_BUTTON_SWITCH_MEDIA, 523);
CGUIWindowMusicBase::GetNonContextButtons(buttons);
}
示例12: GetContextButtons
//.........这里部分代码省略.........
if (!item->IsPlugin() && !item->IsLiveTV() && !item->IsAddonsPath() &&
item->m_strPath != "sources://video/" && item->m_strPath != "special://videoplaylists/")
{
if (item->m_bIsFolder)
{
// Have both options for folders since we don't know whether all childs are watched/unwatched
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); //Mark as UnWatched
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); //Mark as Watched
}
else
{
if (item->GetOverlayImage().Equals("OverlayWatched.png"))
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); //Mark as UnWatched
else
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); //Mark as Watched
}
}
if ((node == NODE_TYPE_TITLE_TVSHOWS) ||
(item->IsVideoDb() && item->HasVideoInfoTag() && !item->m_bIsFolder))
{
buttons.Add(CONTEXT_BUTTON_EDIT, 16105); //Edit Title
}
if (m_database.HasContent(VIDEODB_CONTENT_TVSHOWS) && item->HasVideoInfoTag() &&
!item->m_bIsFolder && item->GetVideoInfoTag()->m_iEpisode == -1 &&
item->GetVideoInfoTag()->m_strArtist.IsEmpty() && item->GetVideoInfoTag()->m_iDbId >= 0) // movie entry
{
if (m_database.IsLinkedToTvshow(item->GetVideoInfoTag()->m_iDbId))
buttons.Add(CONTEXT_BUTTON_UNLINK_MOVIE,20385);
buttons.Add(CONTEXT_BUTTON_LINK_MOVIE,20384);
}
if (node == NODE_TYPE_SEASONS && item->m_bIsFolder)
buttons.Add(CONTEXT_BUTTON_SET_SEASON_THUMB, 20371);
if (item->m_strPath.Left(14).Equals("videodb://1/7/") && item->m_strPath.size() > 14 && item->m_bIsFolder) // sets
{
buttons.Add(CONTEXT_BUTTON_EDIT, 16105);
buttons.Add(CONTEXT_BUTTON_SET_MOVIESET_THUMB, 20435);
buttons.Add(CONTEXT_BUTTON_DELETE, 646);
}
if (node == NODE_TYPE_ACTOR && !dir.IsAllItem(item->m_strPath) && item->m_bIsFolder)
{
if (m_vecItems->m_strPath.Left(11).Equals("videodb://3")) // mvids
buttons.Add(CONTEXT_BUTTON_SET_ARTIST_THUMB, 13359);
else
buttons.Add(CONTEXT_BUTTON_SET_ACTOR_THUMB, 20403);
}
if (item->IsVideoDb() && item->HasVideoInfoTag() &&
(!item->m_bIsFolder || node == NODE_TYPE_TITLE_TVSHOWS))
{
if (info && info->Content() == CONTENT_TVSHOWS)
{
if(item->GetVideoInfoTag()->m_iBookmarkId != -1 &&
item->GetVideoInfoTag()->m_iBookmarkId != 0)
{
buttons.Add(CONTEXT_BUTTON_UNLINK_BOOKMARK, 20405);
}
}
buttons.Add(CONTEXT_BUTTON_DELETE, 646);
}
// this should ideally be non-contextual (though we need some context for non-tv show node I guess)
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (pScanDlg && pScanDlg->IsScanning())
{
if (node != NODE_TYPE_TITLE_TVSHOWS)
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353);
}
else
buttons.Add(CONTEXT_BUTTON_UPDATE_LIBRARY, 653);
}
if (!m_vecItems->IsVideoDb() && !m_vecItems->IsVirtualDirectoryRoot())
{ // non-video db items, file operations are allowed
if (g_guiSettings.GetBool("filelists.allowfiledeletion") &&
CUtil::SupportsFileOperations(item->m_strPath))
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
}
// add "Set/Change content" to folders
if (item->m_bIsFolder && !item->IsPlayList() && !item->IsLiveTV() && !item->IsPlugin() && !item->IsAddonsPath())
{
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (!pScanDlg || (pScanDlg && !pScanDlg->IsScanning()))
{
if (info && info->Content() != CONTENT_NONE)
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20442);
else
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20333);
}
}
}
if (item->IsPlugin() || item->m_strPath.Left(9).Equals("script://") || m_vecItems->IsPlugin())
buttons.Add(CONTEXT_BUTTON_PLUGIN_SETTINGS, 1045);
}
}
CGUIWindowVideoBase::GetNonContextButtons(itemNumber, buttons);
}
示例13: OnContextButton
bool CGUIWindowMusicBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (CGUIDialogContextMenu::OnContextButton("music", item, button))
{
if (button == CONTEXT_BUTTON_REMOVE_SOURCE)
OnRemoveSource(itemNumber);
Update(m_vecItems->GetPath());
return true;
}
switch (button)
{
case CONTEXT_BUTTON_QUEUE_ITEM:
OnQueueItem(itemNumber);
return true;
case CONTEXT_BUTTON_INFO:
OnInfo(itemNumber);
return true;
case CONTEXT_BUTTON_SONG_INFO:
{
ShowSongInfo(item.get());
return true;
}
case CONTEXT_BUTTON_EDIT:
{
std::string playlist = item->IsPlayList() ? item->GetPath() : m_vecItems->GetPath(); // save path as activatewindow will destroy our items
g_windowManager.ActivateWindow(WINDOW_MUSIC_PLAYLIST_EDITOR, playlist);
// need to update
m_vecItems->RemoveDiscCache(GetID());
return true;
}
case CONTEXT_BUTTON_EDIT_SMART_PLAYLIST:
{
std::string playlist = item->IsSmartPlayList() ? item->GetPath() : m_vecItems->GetPath(); // save path as activatewindow will destroy our items
if (CGUIDialogSmartPlaylistEditor::EditPlaylist(playlist, "music"))
Refresh(true); // need to update
return true;
}
case CONTEXT_BUTTON_PLAY_ITEM:
PlayItem(itemNumber);
return true;
case CONTEXT_BUTTON_PLAY_WITH:
{
VECPLAYERCORES vecCores; // base class?
CPlayerCoreFactory::GetInstance().GetPlayers(*item, vecCores);
g_application.m_eForcedNextPlayer = CPlayerCoreFactory::GetInstance().SelectPlayerDialog(vecCores);
if( g_application.m_eForcedNextPlayer != EPC_NONE )
OnClick(itemNumber);
return true;
}
case CONTEXT_BUTTON_PLAY_PARTYMODE:
g_partyModeManager.Enable(PARTYMODECONTEXT_MUSIC, item->GetPath());
return true;
case CONTEXT_BUTTON_STOP_SCANNING:
{
g_application.StopMusicScan();
return true;
}
case CONTEXT_BUTTON_GOTO_ROOT:
Update("");
return true;
case CONTEXT_BUTTON_ACTIVE_ADSP_SETTINGS:
g_windowManager.ActivateWindow(WINDOW_DIALOG_AUDIO_DSP_OSD_SETTINGS);
return true;
case CONTEXT_BUTTON_RIP_CD:
OnRipCD();
return true;
#ifdef HAS_CDDA_RIPPER
case CONTEXT_BUTTON_CANCEL_RIP_CD:
CCDDARipper::GetInstance().CancelJobs();
return true;
#endif
case CONTEXT_BUTTON_RIP_TRACK:
OnRipTrack(itemNumber);
return true;
case CONTEXT_BUTTON_SCAN:
OnScan(itemNumber);
return true;
case CONTEXT_BUTTON_CDDB:
if (m_musicdatabase.LookupCDDBInfo(true))
//.........这里部分代码省略.........
示例14: GetContextButtons
void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (item && !StringUtils::StartsWithNoCase(item->GetPath(), "addons://more/"))
{
// are we in the playlists location?
bool inPlaylists = m_vecItems->IsPath(CUtil::MusicPlaylistsLocation()) ||
m_vecItems->IsPath("special://musicplaylists/");
CMusicDatabaseDirectory dir;
// enable music info button on an album or on a song.
if (item->IsAudio() && !item->IsPlayList() && !item->IsSmartPlayList() &&
!item->m_bIsFolder)
{
buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658);
}
else if (item->IsVideoDb())
{
if (!item->m_bIsFolder) // music video
buttons.Add(CONTEXT_BUTTON_INFO, 20393);
if (StringUtils::StartsWithNoCase(item->GetPath(), "videodb://musicvideos/artists/") && item->m_bIsFolder)
{
long idArtist = m_musicdatabase.GetArtistByName(m_vecItems->Get(itemNumber)->GetLabel());
if (idArtist > - 1)
buttons.Add(CONTEXT_BUTTON_INFO,21891);
}
}
else if (!inPlaylists && (dir.HasAlbumInfo(item->GetPath())||
dir.IsArtistDir(item->GetPath()) ) &&
!dir.IsAllItem(item->GetPath()) && !item->IsParentFolder() &&
!item->IsPlugin() && !item->IsScript() &&
!StringUtils::StartsWithNoCase(item->GetPath(), "musicsearch://"))
{
if (dir.IsArtistDir(item->GetPath()))
buttons.Add(CONTEXT_BUTTON_INFO, 21891);
else
buttons.Add(CONTEXT_BUTTON_INFO, 13351);
}
// enable query all albums button only in album view
if (dir.HasAlbumInfo(item->GetPath()) && !dir.IsAllItem(item->GetPath()) &&
item->m_bIsFolder && !item->IsVideoDb() && !item->IsParentFolder() &&
!item->IsPlugin() && !StringUtils::StartsWithNoCase(item->GetPath(), "musicsearch://"))
{
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 20059);
}
// enable query all artist button only in album view
if (dir.IsArtistDir(item->GetPath()) && !dir.IsAllItem(item->GetPath()) &&
item->m_bIsFolder && !item->IsVideoDb())
{
ADDON::ScraperPtr info;
m_musicdatabase.GetScraperForPath(item->GetPath(), info, ADDON::ADDON_SCRAPER_ARTISTS);
if (info && info->Supports(CONTENT_ARTISTS))
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 21884);
}
//Set default or clear default
NODE_TYPE nodetype = dir.GetDirectoryType(item->GetPath());
if (!item->IsParentFolder() && !inPlaylists &&
(nodetype == NODE_TYPE_ROOT ||
nodetype == NODE_TYPE_OVERVIEW ||
nodetype == NODE_TYPE_TOP100))
{
if (!item->IsPath(CSettings::Get().GetString("mymusic.defaultlibview")))
buttons.Add(CONTEXT_BUTTON_SET_DEFAULT, 13335); // set default
if (!CSettings::Get().GetString("mymusic.defaultlibview").empty())
buttons.Add(CONTEXT_BUTTON_CLEAR_DEFAULT, 13403); // clear default
}
NODE_TYPE childtype = dir.GetDirectoryChildType(item->GetPath());
if (childtype == NODE_TYPE_ALBUM ||
childtype == NODE_TYPE_ARTIST ||
nodetype == NODE_TYPE_GENRE ||
nodetype == NODE_TYPE_ALBUM ||
nodetype == NODE_TYPE_ALBUM_RECENTLY_ADDED ||
nodetype == NODE_TYPE_ALBUM_COMPILATIONS)
{
// we allow the user to set content for
// 1. general artist and album nodes
// 2. specific per genre
// 3. specific per artist
// 4. specific per album
buttons.Add(CONTEXT_BUTTON_SET_CONTENT,20195);
}
if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetArtist().size() > 0)
{
CVideoDatabase database;
database.Open();
if (database.GetMatchingMusicVideo(StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator)) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ARTIST, 20400);
}
if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetArtist().size() > 0 &&
item->GetMusicInfoTag()->GetAlbum().size() > 0 &&
item->GetMusicInfoTag()->GetTitle().size() > 0)
{
CVideoDatabase database;
//.........这里部分代码省略.........
示例15: GetContextButtons
//.........这里部分代码省略.........
!item->IsPlugin() &&
!StringUtils::StartsWithNoCase(item->GetPath(), "addons://") &&
(CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_SCAN, 13352);
}
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
}
else
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
CMusicDatabaseDirectory dir;
// enable query all albums button only in album view
if (item->IsAlbum() && !dir.IsAllItem(item->GetPath()) &&
item->m_bIsFolder && !item->IsVideoDb() && !item->IsParentFolder() &&
!item->IsPlugin() && !StringUtils::StartsWithNoCase(item->GetPath(), "musicsearch://"))
{
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 20059);
}
// enable query all artist button only in artist view
if (dir.IsArtistDir(item->GetPath()) && !dir.IsAllItem(item->GetPath()) &&
item->m_bIsFolder && !item->IsVideoDb())
{
ADDON::ScraperPtr info;
if(m_musicdatabase.GetScraperForPath(item->GetPath(), info, ADDON::ADDON_SCRAPER_ARTISTS))
{
if (info && info->Supports(CONTENT_ARTISTS))
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 21884);
}
}
//Set default or clear default
NODE_TYPE nodetype = dir.GetDirectoryType(item->GetPath());
if (!item->IsParentFolder() && !inPlaylists &&
(nodetype == NODE_TYPE_ROOT ||
nodetype == NODE_TYPE_OVERVIEW ||
nodetype == NODE_TYPE_TOP100))
{
if (!item->IsPath(CSettings::GetInstance().GetString(CSettings::SETTING_MYMUSIC_DEFAULTLIBVIEW)))
buttons.Add(CONTEXT_BUTTON_SET_DEFAULT, 13335); // set default
if (!CSettings::GetInstance().GetString(CSettings::SETTING_MYMUSIC_DEFAULTLIBVIEW).empty())
buttons.Add(CONTEXT_BUTTON_CLEAR_DEFAULT, 13403); // clear default
}
NODE_TYPE childtype = dir.GetDirectoryChildType(item->GetPath());
if (childtype == NODE_TYPE_ALBUM ||
childtype == NODE_TYPE_ARTIST ||
nodetype == NODE_TYPE_GENRE ||
nodetype == NODE_TYPE_ALBUM ||
nodetype == NODE_TYPE_ALBUM_RECENTLY_ADDED ||
nodetype == NODE_TYPE_ALBUM_COMPILATIONS)
{
// we allow the user to set content for
// 1. general artist and album nodes
// 2. specific per genre
// 3. specific per artist
// 4. specific per album
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20195);
}
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetArtistString().empty())
{
CVideoDatabase database;
database.Open();
if (database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtistString()) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ARTIST, 20400);
}
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetArtistString().empty() &&
!item->GetMusicInfoTag()->GetAlbum().empty() &&
!item->GetMusicInfoTag()->GetTitle().empty())
{
CVideoDatabase database;
database.Open();
if (database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtistString(), item->GetMusicInfoTag()->GetAlbum(), item->GetMusicInfoTag()->GetTitle()) > -1)
buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 20401);
}
if (item->HasVideoInfoTag() && !item->m_bIsFolder)
{
if ((CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser) && !item->IsPlugin())
{
buttons.Add(CONTEXT_BUTTON_RENAME, 16105);
buttons.Add(CONTEXT_BUTTON_DELETE, 646);
}
}
if (inPlaylists && URIUtils::GetFileName(item->GetPath()) != "PartyMode.xsp"
&& (item->IsPlayList() || item->IsSmartPlayList()))
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
if (!item->IsReadOnly() && CSettings::GetInstance().GetBool("filelists.allowfiledeletion"))
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
}
}
}
// noncontextual buttons
CGUIWindowMusicBase::GetNonContextButtons(buttons);
}