本文整理汇总了C++中CFileItemPtr::IsAudio方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::IsAudio方法的具体用法?C++ CFileItemPtr::IsAudio怎么用?C++ CFileItemPtr::IsAudio使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::IsAudio方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BindItems
void CLocalFilesSource::BindItems(CFileItemList& items)
{
// Perform post processing here
// Need to default video content to help with the UPnP case where we don't really know the content type
bool bDefaultVideo = false;
if( items.m_strPath.Equals("boxeedb://unresolvedVideoFiles") )
bDefaultVideo = true;
for (int i = 0 ; i < items.Size() ; i++)
{
CFileItemPtr pItem = items[i];
if (pItem->IsVideo() || bDefaultVideo)
{
pItem->SetProperty("IsVideo", true);
}
else if (pItem->IsAudio())
{
pItem->SetProperty("IsMusic", true);
}
else if (pItem->IsPicture())
{
pItem->SetProperty("IsPhotos", true);
}
else if (!pItem->m_bIsFolder)
{
items.Remove(i);
i--;
}
}
CBrowseWindowSource::BindItems(items);
}
示例2: CountFiles
int CMusicInfoScanner::CountFiles(const CFileItemList &items, bool recursive)
{
int count = 0;
for (int i=0; i<items.Size(); ++i)
{
const CFileItemPtr pItem=items[i];
if (recursive && pItem->m_bIsFolder)
count+=CountFilesRecursively(pItem->GetPath());
else if (pItem->IsAudio() && !pItem->IsPlayList() && !pItem->IsNFO())
count++;
}
return count;
}
示例3: GetPathHash
int CMusicInfoScanner::GetPathHash(const CFileItemList &items, CStdString &hash)
{
// Create a hash based on the filenames, filesize and filedate. Also count the number of files
if (0 == items.Size()) return 0;
XBMC::XBMC_MD5 md5state;
int count = 0;
for (int i = 0; i < items.Size(); ++i)
{
const CFileItemPtr pItem = items[i];
md5state.append(pItem->GetPath());
md5state.append((unsigned char *)&pItem->m_dwSize, sizeof(pItem->m_dwSize));
FILETIME time = pItem->m_dateTime;
md5state.append((unsigned char *)&time, sizeof(FILETIME));
if (pItem->IsAudio() && !pItem->IsPlayList() && !pItem->IsNFO())
count++;
}
md5state.getDigest(hash);
return count;
}
示例4: Play
bool CPlayListPlayer::Play(const CFileItemPtr &pItem, std::string player)
{
int playlist;
if (pItem->IsAudio())
playlist = PLAYLIST_MUSIC;
else if (pItem->IsVideo())
playlist = PLAYLIST_VIDEO;
else
{
CLog::Log(LOGWARNING,"Playlist Player: ListItem type must be audio or video, use ListItem::setInfo to specify!");
return false;
}
ClearPlaylist(playlist);
Reset();
SetCurrentPlaylist(playlist);
Add(playlist, pItem);
return Play(0, player);
}
示例5: GetContextButtons
void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
CGUIDialogMusicScan *musicScan = (CGUIDialogMusicScan *)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
if (item && (item->GetExtraInfo().Find("lastfm") < 0))
{
// are we in the playlists location?
bool inPlaylists = m_vecItems->GetPath().Equals(CUtil::MusicPlaylistsLocation()) ||
m_vecItems->GetPath().Equals("special://musicplaylists/");
CMusicDatabaseDirectory dir;
// enable music info button on an album or on a song.
if (item->IsAudio() && !item->IsPlayList() && !item->IsSmartPlayList() &&
!item->IsLastFM() && !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 (item->GetPath().Left(14).Equals("videodb://3/4/") &&
item->GetPath().size() > 14 && 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->IsLastFM() && !item->IsPlugin() && !item->IsScript() &&
!item->GetPath().Left(14).Equals("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->IsLastFM() &&
!item->IsPlugin() && !item->GetPath().Left(14).Equals("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->GetPath().Equals(g_settings.m_defaultMusicLibSource))
buttons.Add(CONTEXT_BUTTON_SET_DEFAULT, 13335); // set default
if (strcmp(g_settings.m_defaultMusicLibSource, ""))
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(item->GetMusicInfoTag()->GetArtist()) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ARTIST, 20400);
}
if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetArtist().size() > 0 &&
item->GetMusicInfoTag()->GetAlbum().size() > 0 &&
//.........这里部分代码省略.........
示例6: RunDisc
//.........这里部分代码省略.........
}
// check video first
if (!nAddedToPlaylist && !bPlaying && (bypassSettings || CSettings::Get().GetBool("dvds.autorun")))
{
// stack video files
CFileItemList tempItems;
tempItems.Append(vecItems);
if (CSettings::Get().GetBool("myvideos.stackvideos"))
tempItems.Stack();
CFileItemList itemlist;
for (int i = 0; i < tempItems.Size(); i++)
{
CFileItemPtr pItem = tempItems[i];
if (!pItem->m_bIsFolder && pItem->IsVideo())
{
bPlaying = true;
if (pItem->IsStack())
{
// TODO: remove this once the app/player is capable of handling stacks immediately
CStackDirectory dir;
CFileItemList items;
dir.GetDirectory(pItem->GetPath(), items);
itemlist.Append(items);
}
else
itemlist.Add(pItem);
}
}
if (itemlist.Size())
{
if (!bAllowVideo)
{
if (!bypassSettings)
return false;
if (g_windowManager.GetActiveWindow() != WINDOW_VIDEO_FILES)
if (!g_passwordManager.IsMasterLockUnlocked(true))
return false;
}
g_playlistPlayer.ClearPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Add(PLAYLIST_VIDEO, itemlist);
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Play(0);
}
}
// then music
if (!bPlaying && (bypassSettings || CSettings::Get().GetInt("audiocds.autoaction") == AUTOCD_PLAY) && bAllowMusic)
{
for (int i = 0; i < vecItems.Size(); i++)
{
CFileItemPtr pItem = vecItems[i];
if (!pItem->m_bIsFolder && pItem->IsAudio())
{
nAddedToPlaylist++;
g_playlistPlayer.Add(PLAYLIST_MUSIC, pItem);
}
}
}
/* Probably want this if/when we add some automedia action dialog...
// and finally pictures
if (!nAddedToPlaylist && !bPlaying && bypassSettings && bAllowPictures)
{
for (int i = 0; i < vecItems.Size(); i++)
{
CFileItemPtr pItem = vecItems[i];
if (!pItem->m_bIsFolder && pItem->IsPicture())
{
bPlaying = true;
CStdString strExec = StringUtils::Format("XBMC.RecursiveSlideShow(%s)", strDrive.c_str());
CBuiltins::Execute(strExec);
break;
}
}
}
*/
// check subdirs if we are not playing yet
if (!bPlaying)
{
for (int i = 0; i < vecItems.Size(); i++)
{
CFileItemPtr pItem = vecItems[i];
if (pItem->m_bIsFolder)
{
if (pItem->GetPath() != "." && pItem->GetPath() != ".." )
{
if (RunDisc(pDir, pItem->GetPath(), nAddedToPlaylist, false, bypassSettings, startFromBeginning))
{
bPlaying = true;
break;
}
}
} // if (non system) folder
} // for all items in directory
} // if root folder
return bPlaying;
}
示例7: 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;
//.........这里部分代码省略.........
示例8: if
//.........这里部分代码省略.........
}
// restore to previous window if needed
if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW ||
g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO ||
g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION)
g_windowManager.PreviousWindow();
g_application.ResetScreenSaver();
g_application.WakeUpScreenSaverAndDPMS();
//g_application.StopPlaying();
// play file
if (pMsg->lpVoid)
{
CFileItemList *list = (CFileItemList *)pMsg->lpVoid;
if (list->Size() > 0)
{
int playlist = PLAYLIST_MUSIC;
for (int i = 0; i < list->Size(); i++)
{
if ((*list)[i]->IsVideo())
{
playlist = PLAYLIST_VIDEO;
break;
}
}
ClearPlaylist(playlist);
SetCurrentPlaylist(playlist);
if (list->Size() == 1 && !(*list)[0]->IsPlayList())
{
CFileItemPtr item = (*list)[0];
if (item->IsAudio() || item->IsVideo())
Play(item, pMsg->strParam);
else
g_application.PlayMedia(*item, pMsg->strParam, playlist);
}
else
{
// Handle "shuffled" option if present
if (list->HasProperty("shuffled") && list->GetProperty("shuffled").isBoolean())
SetShuffle(playlist, list->GetProperty("shuffled").asBoolean(), false);
// Handle "repeat" option if present
if (list->HasProperty("repeat") && list->GetProperty("repeat").isInteger())
SetRepeat(playlist, (PLAYLIST::REPEAT_STATE)list->GetProperty("repeat").asInteger(), false);
Add(playlist, (*list));
Play(pMsg->param1, pMsg->strParam);
}
}
delete list;
}
else if (pMsg->param1 == PLAYLIST_MUSIC || pMsg->param1 == PLAYLIST_VIDEO)
{
if (GetCurrentPlaylist() != pMsg->param1)
SetCurrentPlaylist(pMsg->param1);
CApplicationMessenger::GetInstance().SendMsg(TMSG_PLAYLISTPLAYER_PLAY, pMsg->param2);
}
}
break;
case TMSG_MEDIA_RESTART:
g_application.Restart(true);
示例9: ReadMusicFolder
int CMetadataResolverMusic::ReadMusicFolder(const CStdString& strPath, CResolvingFolder& folder, BXMetadataScannerJob* pJob)
{
CLog::Log(LOGDEBUG,"CMetadataResolverMusic::ReadMusicFolder reading music folder %s (musicresolver)", strPath.c_str());
// Update folder path
folder.strFolderPath = strPath;
// We wont try to resolve RAR or ZIP folder - in this case the files will stay unresolved
if (CUtil::IsRAR(strPath) || CUtil::IsZIP(strPath))
{
CLog::Log(LOGDEBUG,"CMetadataResolverMusic::ReadMusicFolder file %s is compressed file - keep it unresolved (musicresolver)", strPath.c_str());
return RESOLVER_SUCCESS;
}
CFileItemList items;
if (!DIRECTORY::CDirectory::GetDirectory(strPath, items))
{
CLog::Log(LOGDEBUG,"CMetadataResolverMusic::ReadMusicFolder unable to read directory %s (musicresolver)", strPath.c_str());
return RESOLVER_FAILED;
}
for (int i=0; i < items.Size() && pJob->IsActive(); i++)
{
CFileItemPtr pItem = items[i];
if (pItem->IsAudio() && !pItem->IsHidden() && !pItem->IsRAR() && !pItem->IsZIP() && !pItem->IsPlayList(false))
{
CResolvingTrack track(pItem->m_strPath);
track.strFolderPath = strPath;
folder.vecTracks.push_back(track);
}
else if (pItem->IsPlayList(false))
{
// TODO: Handle playlists
}
else if (pItem->IsPicture())
{
CStdString extension = CUtil::GetExtension(pItem->m_strPath);
CStdString supportedExtensions = ".png|.jpg|.jpeg|.bmp|.gif";
CStdStringArray thumbs;
StringUtils::SplitString(supportedExtensions, "|", thumbs);
for (unsigned int j = 0; j < thumbs.size(); ++j)
{
if (extension.CompareNoCase(thumbs[j]) == 0)
{
folder.vecThumbs.push_back(pItem->m_strPath);
break;
}
}
}
}
if (!pJob->IsActive())
{
CLog::Log(LOGDEBUG,"CMetadataResolverMusic::ReadMusicFolder aborted, resolver was paused when reading folder %s (pause) (musicresolver) ", strPath.c_str());
return RESOLVER_ABORTED;
}
folder.strFolderPath = strPath;
folder.strEffectiveFolderName = BOXEE::BXUtils::GetEffectiveFolderName(strPath);
CLog::Log(LOGDEBUG,"CMetadataResolverMusic::ReadMusicFolder successfully finished reading folder %s (musicresolver) ", strPath.c_str());
return RESOLVER_SUCCESS;
}
示例10: 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->GetPath().Equals(CUtil::MusicPlaylistsLocation()) ||
m_vecItems->GetPath().Equals("special://musicplaylists/");
if (m_vecItems->IsVirtualDirectoryRoot() || m_vecItems->GetPath() == "sources://music/")
{
// get the usual music shares, and anything for all media windows
CGUIDialogContextMenu::GetContextButtons("music", item, buttons);
#ifdef HAS_DVD_DRIVE
// enable Rip CD an audio disc
if (g_mediaManager.IsDiscInDrive() && item->IsCDDA())
{
// those cds can also include Audio Tracks: CDExtra and MixedMode!
CCdInfo *pCdInfo = g_mediaManager.GetCdInfo();
if (pCdInfo->IsAudio(1) || pCdInfo->IsCDExtra(1) || pCdInfo->IsMixedMode(1))
{
if (CJobManager::GetInstance().IsProcessing("cdrip"))
buttons.Add(CONTEXT_BUTTON_CANCEL_RIP_CD, 14100);
else
buttons.Add(CONTEXT_BUTTON_RIP_CD, 600);
}
}
#endif
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
}
else
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
if (item->GetProperty("pluginreplacecontextitems").asBoolean())
return;
if (!item->IsPlayList() && !item->IsPlugin() && !item->IsScript())
{
if (item->IsAudio())
buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658); // Song Info
else if (!item->IsParentFolder() &&
!StringUtils::StartsWithNoCase(item->GetPath(), "new") && item->m_bIsFolder)
{
#if 0
if (m_musicdatabase.GetAlbumIdByPath(item->GetPath()) > -1)
#endif
buttons.Add(CONTEXT_BUTTON_INFO, 13351); // Album Info
}
}
#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!
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::Get().GetCurrentProfile().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 || CSettings::Get().GetBool("filelists.allowfiledeletion"))
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
}
}
}
// Add the scan button(s)
if (g_application.IsMusicScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
else if (!inPlaylists && !m_vecItems->IsInternetStream() &&
!item->GetPath().Equals("add") && !item->IsParentFolder() &&
!item->IsPlugin() &&
!StringUtils::StartsWithNoCase(item->GetPath(), "addons://") &&
(CProfilesManager::Get().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_SCAN, 13352);
}
if (item->IsPlugin() || item->IsScript() || m_vecItems->IsPlugin())
buttons.Add(CONTEXT_BUTTON_PLUGIN_SETTINGS, 1045);
}
if (!m_vecItems->IsVirtualDirectoryRoot() && !m_vecItems->IsPlugin())
buttons.Add(CONTEXT_BUTTON_SWITCH_MEDIA, 523);
CGUIWindowMusicBase::GetNonContextButtons(buttons);
}
示例11: RunDisc
//.........这里部分代码省略.........
// check video first
if (!nAddedToPlaylist && !bPlaying && (bypassSettings || g_guiSettings.GetBool("dvds.autorun")))
{
// stack video files
CFileItemList tempItems;
tempItems.Append(vecItems);
if (g_settings.m_videoStacking)
tempItems.Stack();
CFileItemList itemlist;
for (int i = 0; i < tempItems.Size(); i++)
{
CFileItemPtr pItem = tempItems[i];
if (!pItem->m_bIsFolder && pItem->IsVideo())
{
bPlaying = true;
if (pItem->IsStack())
{
// TODO: remove this once the app/player is capable of handling stacks immediately
CStackDirectory dir;
CFileItemList items;
dir.GetDirectory(pItem->GetPath(), items);
itemlist.Append(items);
}
else
itemlist.Add(pItem);
}
}
if (itemlist.Size())
{
if (!bAllowVideo)
{
if (!bypassSettings)
return false;
if (g_windowManager.GetActiveWindow() != WINDOW_VIDEO_FILES)
if (!g_passwordManager.IsMasterLockUnlocked(true))
return false;
}
g_playlistPlayer.ClearPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Add(PLAYLIST_VIDEO, itemlist);
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Play(0);
}
}
// then music
if (!bPlaying && (bypassSettings || g_guiSettings.GetInt("audiocds.autoaction") == AUTOCD_PLAY) && bAllowMusic)
{
for (int i = 0; i < vecItems.Size(); i++)
{
CFileItemPtr pItem = vecItems[i];
if (!pItem->m_bIsFolder && pItem->IsAudio())
{
nAddedToPlaylist++;
g_playlistPlayer.Add(PLAYLIST_MUSIC, pItem);
}
}
}
/* Probably want this if/when we add some automedia action dialog...
// and finally pictures
if (!nAddedToPlaylist && !bPlaying && bypassSettings && bAllowPictures)
{
for (int i = 0; i < vecItems.Size(); i++)
{
CFileItemPtr pItem = vecItems[i];
if (!pItem->m_bIsFolder && pItem->IsPicture())
{
bPlaying = true;
CStdString strExec;
strExec.Format("XBMC.RecursiveSlideShow(%s)", strDrive.c_str());
CBuiltins::Execute(strExec);
break;
}
}
}
*/
// check subdirs if we are not playing yet
if (!bPlaying)
{
for (int i = 0; i < vecItems.Size(); i++)
{
CFileItemPtr pItem = vecItems[i];
if (pItem->m_bIsFolder)
{
if (pItem->GetPath() != "." && pItem->GetPath() != ".." )
{
if (RunDisc(pDir, pItem->GetPath(), nAddedToPlaylist, false, bypassSettings, startFromBeginning))
{
bPlaying = true;
break;
}
}
} // if (non system) folder
} // for all items in directory
} // if root folder
return bPlaying;
}
示例12: 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);
}
示例13: 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);
}
//.........这里部分代码省略.........
示例14: OnClick
//.........这里部分代码省略.........
}
}
if (pItem->m_bIsFolder)
{
if ( pItem->m_bIsShareOrDrive )
{
const CStdString& strLockType=m_guiState->GetLockType();
if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
if (!strLockType.IsEmpty() && !g_passwordManager.IsItemUnlocked(pItem.get(), strLockType))
return true;
if (!HaveDiscOrConnection(pItem->GetPath(), pItem->m_iDriveType))
return true;
}
// check for the partymode playlist items - they may not exist yet
if ((pItem->GetPath() == g_settings.GetUserDataItem("PartyMode.xsp")) ||
(pItem->GetPath() == g_settings.GetUserDataItem("PartyMode-Video.xsp")))
{
// party mode playlist item - if it doesn't exist, prompt for user to define it
if (!XFILE::CFile::Exists(pItem->GetPath()))
{
m_vecItems->RemoveDiscCache(GetID());
if (CGUIDialogSmartPlaylistEditor::EditPlaylist(pItem->GetPath()))
Update(m_vecItems->GetPath());
return true;
}
}
// remove the directory cache if the folder is not normally cached
CFileItemList items(pItem->GetPath());
if (!items.AlwaysCache())
items.RemoveDiscCache(GetID());
CFileItem directory(*pItem);
if (!Update(directory.GetPath()))
ShowShareErrorMessage(&directory);
return true;
}
else if (pItem->IsPlugin() && !pItem->GetProperty("isplayable").asBoolean())
{
return XFILE::CPluginDirectory::RunScriptWithParams(pItem->GetPath());
}
else
{
m_iSelectedItem = m_viewControl.GetSelectedItem();
if (pItem->GetPath() == "newplaylist://")
{
m_vecItems->RemoveDiscCache(GetID());
g_windowManager.ActivateWindow(WINDOW_MUSIC_PLAYLIST_EDITOR,"newplaylist://");
return true;
}
else if (pItem->GetPath().Left(19).Equals("newsmartplaylist://"))
{
m_vecItems->RemoveDiscCache(GetID());
if (CGUIDialogSmartPlaylistEditor::NewPlaylist(pItem->GetPath().Mid(19)))
Update(m_vecItems->GetPath());
return true;
}
else if (pItem->GetPath().Left(14).Equals("addons://more/"))
{
CBuiltins::Execute("ActivateWindow(AddonBrowser,addons://all/xbmc.addon." + pItem->GetPath().Mid(14) + ",return)");
return true;
}
// If karaoke song is being played AND popup autoselector is enabled, the playlist should not be added
bool do_not_add_karaoke = g_guiSettings.GetBool("karaoke.enabled") &&
g_guiSettings.GetBool("karaoke.autopopupselector") && pItem->IsKaraoke();
bool autoplay = m_guiState.get() && m_guiState->AutoPlayNextItem();
if (pItem->IsPlugin())
{
CURL url(pItem->GetPath());
AddonPtr addon;
if (CAddonMgr::Get().GetAddon(url.GetHostName(),addon))
{
PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addon);
if (plugin && plugin->Provides(CPluginSource::AUDIO) && pItem->IsAudio())
{
autoplay = g_guiSettings.GetBool("musicplayer.autoplaynextitem");
}
}
}
if (autoplay && !g_partyModeManager.IsEnabled() &&
!pItem->IsPlayList() && !do_not_add_karaoke)
{
return OnPlayAndQueueMedia(pItem);
}
else
{
return OnPlayMedia(iItem);
}
}
return false;
}
示例15: RunDisc
//.........这里部分代码省略.........
}
}
// check video first
if (!nAddedToPlaylist && !bPlaying && (bypassSettings || g_guiSettings.GetBool("autorun.video")))
{
// stack video files
CFileItemList tempItems;
tempItems.Append(vecItems);
if (g_stSettings.m_iMyVideoStack != STACK_NONE)
tempItems.Stack();
CFileItemList itemlist;
for (int i = 0; i < tempItems.Size(); i++)
{
CFileItemPtr pItem = tempItems[i];
if (!pItem->m_bIsFolder && pItem->IsVideo())
{
bPlaying = true;
if (pItem->IsStack())
{
// TODO: remove this once the app/player is capable of handling stacks immediately
CStackDirectory dir;
CFileItemList items;
dir.GetDirectory(pItem->m_strPath, items);
itemlist.Append(items);
}
else
itemlist.Add(pItem);
}
}
if (itemlist.Size())
{
if (!bAllowVideo)
{
if (!bypassSettings)
return false;
if (g_windowManager.GetActiveWindow() != WINDOW_VIDEO_FILES)
if (!g_passwordManager.IsMasterLockUnlocked(true))
return false;
}
g_playlistPlayer.ClearPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Add(PLAYLIST_VIDEO, itemlist);
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Play(0);
}
}
// then music
if (!bPlaying && (bypassSettings || g_guiSettings.GetBool("autorun.music")) && bAllowMusic)
{
for (int i = 0; i < vecItems.Size(); i++)
{
CFileItemPtr pItem = vecItems[i];
if (!pItem->m_bIsFolder && pItem->IsAudio())
{
nAddedToPlaylist++;
g_playlistPlayer.Add(PLAYLIST_MUSIC, pItem);
}
}
}
// and finally pictures
if (!nAddedToPlaylist && !bPlaying && (bypassSettings || g_guiSettings.GetBool("autorun.pictures")) && bAllowPictures)
{
for (int i = 0; i < vecItems.Size(); i++)
{
CFileItemPtr pItem = vecItems[i];
if (!pItem->m_bIsFolder && pItem->IsPicture())
{
bPlaying = true;
CStdString strExec;
strExec.Format("XBMC.RecursiveSlideShow(%s)", strDrive.c_str());
CBuiltins::Execute(strExec);
break;
}
}
}
// check subdirs if we are not playing yet
if (!bPlaying)
{
for (int i = 0; i < vecItems.Size(); i++)
{
CFileItemPtr pItem = vecItems[i];
if (pItem->m_bIsFolder)
{
if (pItem->m_strPath != "." && pItem->m_strPath != ".." )
{
if (RunDisc(pDir, pItem->m_strPath, nAddedToPlaylist, false, bypassSettings))
{
bPlaying = true;
break;
}
}
}
}
}
return bPlaying;
}