本文整理汇总了C++中CFileItem::IsVideoDb方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItem::IsVideoDb方法的具体用法?C++ CFileItem::IsVideoDb怎么用?C++ CFileItem::IsVideoDb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItem
的用法示例。
在下文中一共展示了CFileItem::IsVideoDb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QueueNextFile
bool CUPnPPlayer::QueueNextFile(const CFileItem& file)
{
CFileItem item(file);
NPT_Reference<CThumbLoader> thumb_loader;
NPT_Reference<PLT_MediaObject> obj;
NPT_String path(file.GetPath().c_str());
NPT_String tmp;
if (file.IsVideoDb())
thumb_loader = NPT_Reference<CThumbLoader>(new CVideoThumbLoader());
else if (item.IsMusicDb())
thumb_loader = NPT_Reference<CThumbLoader>(new CMusicThumbLoader());
obj = BuildObject(item, path, 0, thumb_loader, NULL, CUPnP::GetServer(), UPnPPlayer);
if(!obj.IsNull())
{
NPT_CHECK_LABEL_SEVERE(PLT_Didl::ToDidl(*obj, "", tmp), failed);
tmp.Insert(didl_header, 0);
tmp.Append(didl_footer);
}
NPT_CHECK_LABEL_WARNING(m_control->SetNextAVTransportURI(m_delegate->m_device
, m_delegate->m_instance
, file.GetPath().c_str()
, (const char*)tmp
, m_delegate), failed);
if(!m_delegate->m_resevent.WaitMSec(10000)) goto failed;
NPT_CHECK_LABEL_WARNING(m_delegate->m_resstatus, failed);
return true;
failed:
CLog::Log(LOGERROR, "UPNP: CUPnPPlayer::QueueNextFile - unable to queue file %s", file.GetPath().c_str());
return false;
}
示例2: GetExecutePath
std::string CFavouritesDirectory::GetExecutePath(const CFileItem &item, const std::string &contextWindow)
{
std::string execute;
if (item.m_bIsFolder && (g_advancedSettings.m_playlistAsFolders ||
!(item.IsSmartPlayList() || item.IsPlayList())))
{
if (!contextWindow.empty())
execute = StringUtils::Format("ActivateWindow(%s,%s,return)", contextWindow.c_str(), StringUtils::Paramify(item.GetPath()).c_str());
}
/* TODO:STRING_CLEANUP */
else if (item.IsAndroidApp() && item.GetPath().size() > 26) // androidapp://sources/apps/<foo>
execute = StringUtils::Format("StartAndroidActivity(%s)", StringUtils::Paramify(item.GetPath().substr(26)).c_str());
else // assume a media file
{
if (item.IsVideoDb() && item.HasVideoInfoTag())
execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetVideoInfoTag()->m_strFileNameAndPath).c_str());
else if (item.IsMusicDb() && item.HasMusicInfoTag())
execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetMusicInfoTag()->GetURL()).c_str());
else if (item.IsPicture())
execute = StringUtils::Format("ShowPicture(%s)", StringUtils::Paramify(item.GetPath()).c_str());
else
execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetPath()).c_str());
}
return execute;
}
示例3: DetectAndAddMissingItemData
void CVideoThumbLoader::DetectAndAddMissingItemData(CFileItem &item)
{
if (item.m_bIsFolder) return;
std::string stereoMode;
// detect stereomode for videos
if (item.HasVideoInfoTag())
stereoMode = item.GetVideoInfoTag()->m_streamDetails.GetStereoMode();
if (stereoMode.empty())
{
std::string path = item.GetPath();
if (item.IsVideoDb() && item.HasVideoInfoTag())
path = item.GetVideoInfoTag()->GetPath();
// check for custom stereomode setting in video settings
CVideoSettings itemVideoSettings;
m_videoDatabase->Open();
if (m_videoDatabase->GetVideoSettings(path, itemVideoSettings) && itemVideoSettings.m_StereoMode != RENDER_STEREO_MODE_OFF)
stereoMode = CStereoscopicsManager::Get().ConvertGuiStereoModeToString( (RENDER_STEREO_MODE) itemVideoSettings.m_StereoMode );
m_videoDatabase->Close();
// still empty, try grabbing from filename
// TODO: in case of too many false positives due to using the full path, extract the filename only using string utils
if (stereoMode.empty())
stereoMode = CStereoscopicsManager::Get().DetectStereoModeByString( path );
}
if (!stereoMode.empty())
item.SetProperty("stereomode", CStereoscopicsManager::Get().NormalizeStereoMode(stereoMode));
}
示例4: GetFanart
CStdString CThumbnailCache::GetFanart(const CFileItem &item)
{
// get the locally cached thumb
if (item.IsVideoDb())
{
if (!item.HasVideoInfoTag())
return "";
if (!item.GetVideoInfoTag()->m_strArtist.IsEmpty())
return GetThumb(item.GetVideoInfoTag()->m_strArtist,g_settings.GetMusicFanartFolder());
if (!item.m_bIsFolder && !item.GetVideoInfoTag()->m_strShowTitle.IsEmpty())
{
CVideoDatabase database;
database.Open();
int iShowId = database.GetTvShowId(item.GetVideoInfoTag()->m_strPath);
CStdString showPath;
database.GetFilePathById(iShowId,showPath,VIDEODB_CONTENT_TVSHOWS);
return GetThumb(showPath,g_settings.GetVideoFanartFolder());
}
return GetThumb(item.m_bIsFolder ? item.GetVideoInfoTag()->m_strPath : item.GetVideoInfoTag()->m_strFileNameAndPath,g_settings.GetVideoFanartFolder());
}
if (item.HasMusicInfoTag())
return GetThumb(item.GetMusicInfoTag()->GetArtist(),g_settings.GetMusicFanartFolder());
return GetThumb(item.m_strPath,g_settings.GetVideoFanartFolder());
}
示例5: DetectAndAddMissingItemData
void CVideoThumbLoader::DetectAndAddMissingItemData(CFileItem &item)
{
if (item.m_bIsFolder) return;
if (item.HasVideoInfoTag())
{
CStreamDetails& details = item.GetVideoInfoTag()->m_streamDetails;
// add audio language properties
for (int i = 1; i <= details.GetAudioStreamCount(); i++)
{
std::string index = StringUtils::Format("%i", i);
item.SetProperty("AudioChannels." + index, details.GetAudioChannels(i));
item.SetProperty("AudioCodec." + index, details.GetAudioCodec(i).c_str());
item.SetProperty("AudioLanguage." + index, details.GetAudioLanguage(i).c_str());
}
// add subtitle language properties
for (int i = 1; i <= details.GetSubtitleStreamCount(); i++)
{
std::string index = StringUtils::Format("%i", i);
item.SetProperty("SubtitleLanguage." + index, details.GetSubtitleLanguage(i).c_str());
}
}
const CStereoscopicsManager &stereoscopicsManager = CServiceBroker::GetGUI()->GetStereoscopicsManager();
std::string stereoMode;
// detect stereomode for videos
if (item.HasVideoInfoTag())
stereoMode = item.GetVideoInfoTag()->m_streamDetails.GetStereoMode();
if (stereoMode.empty())
{
std::string path = item.GetPath();
if (item.IsVideoDb() && item.HasVideoInfoTag())
path = item.GetVideoInfoTag()->GetPath();
// check for custom stereomode setting in video settings
CVideoSettings itemVideoSettings;
m_videoDatabase->Open();
if (m_videoDatabase->GetVideoSettings(item, itemVideoSettings) && itemVideoSettings.m_StereoMode != RENDER_STEREO_MODE_OFF)
{
stereoMode = CStereoscopicsManager::ConvertGuiStereoModeToString(static_cast<RENDER_STEREO_MODE>(itemVideoSettings.m_StereoMode));
}
m_videoDatabase->Close();
// still empty, try grabbing from filename
//! @todo in case of too many false positives due to using the full path, extract the filename only using string utils
if (stereoMode.empty())
stereoMode = stereoscopicsManager.DetectStereoModeByString(path);
}
if (!stereoMode.empty())
item.SetProperty("stereomode", CStereoscopicsManager::NormalizeStereoMode(stereoMode));
}
示例6: IsVisible
bool CMarkUnWatched::IsVisible(const CFileItem& item) const
{
if (!item.HasVideoInfoTag())
return false;
if (item.IsPVR())
return false; // pvr has its own implementation for this
if (item.m_bIsFolder) //Only allow db content to be updated recursively
return item.IsVideoDb();
return item.GetVideoInfoTag()->m_playCount > 0;
}
示例7: onNewIntent
void CXBMCApp::onNewIntent(CJNIIntent intent)
{
std::string action = intent.getAction();
CLog::Log(LOGDEBUG, "CXBMCApp::onNewIntent - Got intent. Action: %s", action.c_str());
std::string targetFile = GetFilenameFromIntent(intent);
if (!targetFile.empty() && (action == "android.intent.action.VIEW" || action == "android.intent.action.GET_CONTENT"))
{
CLog::Log(LOGDEBUG, "-- targetFile: %s", targetFile.c_str());
CURL targeturl(targetFile);
std::string value;
if (action == "android.intent.action.GET_CONTENT" || (targeturl.GetOption("showinfo", value) && value == "true"))
{
if (targeturl.IsProtocol("videodb")
|| (targeturl.IsProtocol("special") && targetFile.find("playlists/video") != std::string::npos)
|| (targeturl.IsProtocol("special") && targetFile.find("playlists/mixed") != std::string::npos)
)
{
std::vector<std::string> params;
params.push_back(targeturl.Get());
params.push_back("return");
CApplicationMessenger::GetInstance().PostMsg(TMSG_GUI_ACTIVATE_WINDOW, WINDOW_VIDEO_NAV, 0, nullptr, "", params);
}
else if (targeturl.IsProtocol("musicdb")
|| (targeturl.IsProtocol("special") && targetFile.find("playlists/music") != std::string::npos))
{
std::vector<std::string> params;
params.push_back(targeturl.Get());
params.push_back("return");
CApplicationMessenger::GetInstance().PostMsg(TMSG_GUI_ACTIVATE_WINDOW, WINDOW_MUSIC_NAV, 0, nullptr, "", params);
}
}
else
{
CFileItem* item = new CFileItem(targetFile, false);
if (item->IsVideoDb())
{
*(item->GetVideoInfoTag()) = XFILE::CVideoDatabaseFile::GetVideoTag(CURL(item->GetPath()));
item->SetPath(item->GetVideoInfoTag()->m_strFileNameAndPath);
}
CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(item));
}
}
else if (action == ACTION_XBMC_RESUME)
{
if (m_playback_state != PLAYBACK_STATE_STOPPED)
{
if (m_playback_state & PLAYBACK_STATE_VIDEO)
RequestVisibleBehind(true);
if (!(m_playback_state & PLAYBACK_STATE_PLAYING))
CApplicationMessenger::GetInstance().SendMsg(TMSG_GUI_ACTION, WINDOW_INVALID, -1, static_cast<void*>(new CAction(ACTION_PAUSE)));
}
}
}
示例8: ShowPlaySelection
bool CGUIDialogSimpleMenu::ShowPlaySelection(CFileItem& item)
{
/* if asked to resume somewhere, we should not show anything */
if (item.m_lStartOffset || (item.HasVideoInfoTag() && item.GetVideoInfoTag()->m_iBookmarkId > 0))
return true;
if (CSettings::GetInstance().GetInt(CSettings::SETTING_DISC_PLAYBACK) != BD_PLAYBACK_SIMPLE_MENU)
return true;
std::string path;
if (item.IsVideoDb())
path = item.GetVideoInfoTag()->m_strFileNameAndPath;
else
path = item.GetPath();
if (item.IsBDFile())
{
std::string root = URIUtils::GetParentPath(path);
URIUtils::RemoveSlashAtEnd(root);
if (URIUtils::GetFileName(root) == "BDMV")
{
CURL url("bluray://");
url.SetHostName(URIUtils::GetParentPath(root));
url.SetFileName("root");
return ShowPlaySelection(item, url.Get());
}
}
if (item.IsDiscImage())
{
CURL url2("udf://");
url2.SetHostName(item.GetPath());
url2.SetFileName("BDMV/index.bdmv");
if (XFILE::CFile::Exists(url2.Get()))
{
url2.SetFileName("");
CURL url("bluray://");
url.SetHostName(url2.Get());
url.SetFileName("root");
return ShowPlaySelection(item, url.Get());
}
}
return true;
}
示例9:
CThumbExtractor::CThumbExtractor(const CFileItem& item,
const std::string& listpath,
bool thumb,
const std::string& target,
int64_t pos,
bool fillStreamDetails)
{
m_listpath = listpath;
m_target = target;
m_thumb = thumb;
m_item = item;
m_pos = pos;
m_fillStreamDetails = fillStreamDetails;
if (item.IsVideoDb() && item.HasVideoInfoTag())
m_item.SetPath(item.GetVideoInfoTag()->m_strFileNameAndPath);
if (m_item.IsStack())
m_item.SetPath(CStackDirectory::GetFirstStackedFile(m_item.GetPath()));
}
示例10: GetExecutePath
CStdString CFavouritesDirectory::GetExecutePath(const CFileItem &item, const std::string &contextWindow)
{
CStdString execute;
if (item.m_bIsFolder && (g_advancedSettings.m_playlistAsFolders ||
!(item.IsSmartPlayList() || item.IsPlayList())))
{
if (!contextWindow.empty())
execute = StringUtils::Format("ActivateWindow(%s,%s,return)", contextWindow.c_str(), StringUtils::Paramify(item.GetPath()).c_str());
}
else if (item.IsScript())
execute = StringUtils::Format("RunScript(%s)", StringUtils::Paramify(item.GetPath().substr(9)).c_str());
else if (item.IsAndroidApp())
execute = StringUtils::Format("StartAndroidActivity(%s)", StringUtils::Paramify(item.GetPath().substr(26)).c_str());
else // assume a media file
{
if (item.IsVideoDb() && item.HasVideoInfoTag())
execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetVideoInfoTag()->m_strFileNameAndPath).c_str());
else
execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetPath()).c_str());
}
return execute;
}
示例11: GetExecutePath
std::string CFavouritesService::GetExecutePath(const CFileItem &item, const std::string &contextWindow) const
{
std::string execute;
if (URIUtils::IsProtocol(item.GetPath(), "favourites"))
{
const CURL url(item.GetPath());
execute = CURL::Decode(url.GetHostName());
}
else if (item.m_bIsFolder && (g_advancedSettings.m_playlistAsFolders ||
!(item.IsSmartPlayList() || item.IsPlayList())))
{
if (!contextWindow.empty())
execute = StringUtils::Format("ActivateWindow(%s,%s,return)", contextWindow.c_str(), StringUtils::Paramify(item.GetPath()).c_str());
}
//! @todo STRING_CLEANUP
else if (item.IsScript() && item.GetPath().size() > 9) // script://<foo>
execute = StringUtils::Format("RunScript(%s)", StringUtils::Paramify(item.GetPath().substr(9)).c_str());
else if (item.IsAddonsPath() && item.GetPath().size() > 9) // addons://<foo>
{
CURL url(item.GetPath());
execute = StringUtils::Format("RunAddon(%s)", url.GetFileName().c_str());
}
else if (item.IsAndroidApp() && item.GetPath().size() > 26) // androidapp://sources/apps/<foo>
execute = StringUtils::Format("StartAndroidActivity(%s)", StringUtils::Paramify(item.GetPath().substr(26)).c_str());
else // assume a media file
{
if (item.IsVideoDb() && item.HasVideoInfoTag())
execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetVideoInfoTag()->m_strFileNameAndPath).c_str());
else if (item.IsMusicDb() && item.HasMusicInfoTag())
execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetMusicInfoTag()->GetURL()).c_str());
else if (item.IsPicture())
execute = StringUtils::Format("ShowPicture(%s)", StringUtils::Paramify(item.GetPath()).c_str());
else
execute = StringUtils::Format("PlayMedia(%s)", StringUtils::Paramify(item.GetPath()).c_str());
}
return execute;
}
示例12: OpenFile
bool CUPnPPlayer::OpenFile(const CFileItem& file, const CPlayerOptions& options)
{
CFileItem item(file);
NPT_Reference<CThumbLoader> thumb_loader;
NPT_Reference<PLT_MediaObject> obj;
NPT_String path(file.GetPath().c_str());
NPT_String tmp, resource;
XbmcThreads::EndTime timeout;
CGUIDialogBusy* dialog = NULL;
NPT_CHECK_POINTER_LABEL_SEVERE(m_delegate, failed);
timeout.Set(10000);
/* if no path we want to attach to a already playing player */
if(path != "") {
if (file.IsVideoDb())
thumb_loader = NPT_Reference<CThumbLoader>(new CVideoThumbLoader());
else if (item.IsMusicDb())
thumb_loader = NPT_Reference<CThumbLoader>(new CMusicThumbLoader());
obj = BuildObject(item, path, false, thumb_loader, NULL, CUPnP::GetServer());
if(obj.IsNull()) goto failed;
NPT_CHECK_LABEL_SEVERE(PLT_Didl::ToDidl(*obj, "", tmp), failed);
tmp.Insert(didl_header, 0);
tmp.Append(didl_footer);
/* The resource uri's are stored in the Didl. We must choose the best resource
* for the playback device */
NPT_Cardinal res_index;
NPT_CHECK_LABEL_SEVERE(m_control->FindBestResource(m_delegate->m_device, *obj, res_index), failed);
/* dlna specifies that a return code of 705 should be returned
* if TRANSPORT_STATE is not STOPPED or NO_MEDIA_PRESENT */
NPT_CHECK_LABEL_SEVERE(m_control->Stop(m_delegate->m_device
, m_delegate->m_instance
, m_delegate), failed);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_resevent, timeout, dialog), failed);
NPT_CHECK_LABEL_SEVERE(m_delegate->m_resstatus, failed);
NPT_CHECK_LABEL_SEVERE(m_control->SetAVTransportURI(m_delegate->m_device
, m_delegate->m_instance
, obj->m_Resources[res_index].m_Uri
, (const char*)tmp
, m_delegate), failed);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_resevent, timeout, dialog), failed);
NPT_CHECK_LABEL_SEVERE(m_delegate->m_resstatus, failed);
NPT_CHECK_LABEL_SEVERE(m_control->Play(m_delegate->m_device
, m_delegate->m_instance
, "1"
, m_delegate), failed);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_resevent, timeout, dialog), failed);
NPT_CHECK_LABEL_SEVERE(m_delegate->m_resstatus, failed);
}
/* wait for PLAYING state */
do {
NPT_CHECK_LABEL_SEVERE(m_control->GetTransportInfo(m_delegate->m_device
, m_delegate->m_instance
, m_delegate), failed);
{ CSingleLock lock(m_delegate->m_section);
if(m_delegate->m_trainfo.cur_transport_state == "PLAYING"
|| m_delegate->m_trainfo.cur_transport_state == "PAUSED_PLAYBACK")
break;
if(m_delegate->m_trainfo.cur_transport_state == "STOPPED"
&& m_delegate->m_trainfo.cur_transport_status != "OK")
{
CLog::Log(LOGERROR, "UPNP: CUPnPPlayer::OpenFile - remote player signalled error %s", file.GetPath().c_str());
goto failed;
}
}
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_traevnt, timeout, dialog), failed);
} while(!timeout.IsTimePast());
if(options.starttime > 0)
{
/* many upnp units won't load file properly until after play (including xbmc) */
NPT_CHECK_LABEL(m_control->Seek(m_delegate->m_device
, m_delegate->m_instance
, "REL_TIME"
, PLT_Didl::FormatTimeStamp((NPT_UInt32)options.starttime)
, m_delegate), failed);
}
m_started = true;
m_callback.OnPlayBackStarted();
NPT_CHECK_LABEL_SEVERE(m_control->GetPositionInfo(m_delegate->m_device
, m_delegate->m_instance
, m_delegate), failed);
NPT_CHECK_LABEL_SEVERE(m_control->GetMediaInfo(m_delegate->m_device
//.........这里部分代码省略.........
示例13: GetContextButtons
void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
CGUIDialogMusicScan *musicScan = (CGUIDialogMusicScan *)m_gWindowManager.GetWindow(WINDOW_DIALOG_MUSIC_SCAN);
CFileItem *item = (itemNumber >= 0 && itemNumber < m_vecItems->Size()) ? m_vecItems->Get(itemNumber) : NULL;
if (item && (item->GetExtraInfo().Find("lastfm") < 0))
{
// are we in the playlists location?
bool inPlaylists = m_vecItems->m_strPath.Equals(CUtil::MusicPlaylistsLocation()) ||
m_vecItems->m_strPath.Equals("special://musicplaylists/");
CMusicDatabaseDirectory dir;
SScraperInfo info;
m_musicdatabase.GetScraperForPath(item->m_strPath,info);
// enable music info button on an album or on a song.
if (item->IsAudio() && !item->IsPlayList() && !item->IsSmartPlayList() &&
!item->IsLastFM() && !item->IsShoutCast())
{
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->m_strPath.Left(14).Equals("videodb://3/4/") &&
item->m_strPath.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->m_strPath)||
dir.IsArtistDir(item->m_strPath) ) &&
!dir.IsAllItem(item->m_strPath) && !item->IsParentFolder() &&
!item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Left(14).Equals("musicsearch://"))
{
if (dir.IsArtistDir(item->m_strPath))
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->m_strPath) && !dir.IsAllItem(item->m_strPath) &&
item->m_bIsFolder && !item->IsVideoDb() && !item->IsParentFolder() &&
!item->IsLastFM() && !item->IsShoutCast() &&
!item->m_strPath.Left(14).Equals("musicsearch://"))
{
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 20059);
}
// enable query all artist button only in album view
if (dir.IsArtistDir(item->m_strPath) && !dir.IsAllItem(item->m_strPath) &&
item->m_bIsFolder && !item->IsVideoDb() && !info.strContent.IsEmpty())
{
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 21884);
}
// turn off set artist image if not at artist listing.
if (dir.IsArtistDir(item->m_strPath) && !dir.IsAllItem(item->m_strPath) ||
(item->m_strPath.Left(14).Equals("videodb://3/4/") &&
item->m_strPath.size() > 14 && item->m_bIsFolder))
{
buttons.Add(CONTEXT_BUTTON_SET_ARTIST_THUMB, 13359);
}
if (m_vecItems->m_strPath.Equals("plugin://music/"))
buttons.Add(CONTEXT_BUTTON_SET_PLUGIN_THUMB, 1044);
//Set default or clear default
NODE_TYPE nodetype = dir.GetDirectoryType(item->m_strPath);
if (!item->IsParentFolder() && !inPlaylists &&
(nodetype == NODE_TYPE_ROOT ||
nodetype == NODE_TYPE_OVERVIEW ||
nodetype == NODE_TYPE_TOP100))
{
if (!item->m_strPath.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->m_strPath);
if (childtype == NODE_TYPE_ALBUM || childtype == NODE_TYPE_ARTIST ||
nodetype == NODE_TYPE_GENRE || nodetype == NODE_TYPE_ALBUM)
{
// 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.GetMusicVideoArtistByName(item->GetMusicInfoTag()->GetArtist()) > -1)
//.........这里部分代码省略.........
示例14: SetThumb
void CGUIWindowMusicNav::SetThumb(int iItem, CONTEXT_BUTTON button)
{
CFileItem* 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++);
CFileItem *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))
{
CFileItem *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()))
{
CFileItem *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))
{
CFileItem* 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))
{
CFileItem* pItem = new CFileItem(strThumb,false);
pItem->SetLabel(g_localizeStrings.Get(20017));
pItem->SetThumbnailImage(strThumb);
//.........这里部分代码省略.........
示例15: PlayFile
int CUPnPPlayer::PlayFile(const CFileItem& file, const CPlayerOptions& options, CGUIDialogBusy*& dialog, XbmcThreads::EndTime& timeout)
{
CFileItem item(file);
NPT_Reference<CThumbLoader> thumb_loader;
NPT_Reference<PLT_MediaObject> obj;
NPT_String path(file.GetPath().c_str());
NPT_String tmp, resource;
EMediaControllerQuirks quirks = EMEDIACONTROLLERQUIRKS_NONE;
NPT_CHECK_POINTER_LABEL_SEVERE(m_delegate, failed);
if (file.IsVideoDb())
thumb_loader = NPT_Reference<CThumbLoader>(new CVideoThumbLoader());
else if (item.IsMusicDb())
thumb_loader = NPT_Reference<CThumbLoader>(new CMusicThumbLoader());
obj = BuildObject(item, path, false, thumb_loader, NULL, CUPnP::GetServer(), UPnPPlayer);
if(obj.IsNull()) goto failed;
NPT_CHECK_LABEL_SEVERE(PLT_Didl::ToDidl(*obj, "", tmp), failed_todidl);
tmp.Insert(didl_header, 0);
tmp.Append(didl_footer);
quirks = GetMediaControllerQuirks(m_delegate->m_device.AsPointer());
if (quirks & EMEDIACONTROLLERQUIRKS_X_MKV)
{
for (NPT_Cardinal i=0; i< obj->m_Resources.GetItemCount(); i++) {
if (obj->m_Resources[i].m_ProtocolInfo.GetContentType().Compare("video/x-matroska") == 0) {
CLog::Log(LOGDEBUG, "CUPnPPlayer::PlayFile(%s): applying video/x-mkv quirk", file.GetPath().c_str());
NPT_String protocolInfo = obj->m_Resources[i].m_ProtocolInfo.ToString();
protocolInfo.Replace(":video/x-matroska:", ":video/x-mkv:");
obj->m_Resources[i].m_ProtocolInfo = PLT_ProtocolInfo(protocolInfo);
}
}
}
/* The resource uri's are stored in the Didl. We must choose the best resource
* for the playback device */
NPT_Cardinal res_index;
NPT_CHECK_LABEL_SEVERE(m_control->FindBestResource(m_delegate->m_device, *obj, res_index), failed_findbestresource);
// get the transport info to evaluate the TransportState to be able to
// determine whether we first need to call Stop()
timeout.Set(timeout.GetInitialTimeoutValue());
NPT_CHECK_LABEL_SEVERE(m_control->GetTransportInfo(m_delegate->m_device
, m_delegate->m_instance
, m_delegate), failed_gettransportinfo);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_traevnt, timeout, dialog), failed_gettransportinfo);
if (m_delegate->m_trainfo.cur_transport_state != "NO_MEDIA_PRESENT" &&
m_delegate->m_trainfo.cur_transport_state != "STOPPED")
{
timeout.Set(timeout.GetInitialTimeoutValue());
NPT_CHECK_LABEL_SEVERE(m_control->Stop(m_delegate->m_device
, m_delegate->m_instance
, m_delegate), failed_stop);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_resevent, timeout, dialog), failed_stop);
NPT_CHECK_LABEL_SEVERE(m_delegate->m_resstatus, failed_stop);
}
timeout.Set(timeout.GetInitialTimeoutValue());
NPT_CHECK_LABEL_SEVERE(m_control->SetAVTransportURI(m_delegate->m_device
, m_delegate->m_instance
, obj->m_Resources[res_index].m_Uri
, (const char*)tmp
, m_delegate), failed_setavtransporturi);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_resevent, timeout, dialog), failed_setavtransporturi);
NPT_CHECK_LABEL_SEVERE(m_delegate->m_resstatus, failed_setavtransporturi);
timeout.Set(timeout.GetInitialTimeoutValue());
NPT_CHECK_LABEL_SEVERE(m_control->Play(m_delegate->m_device
, m_delegate->m_instance
, "1"
, m_delegate), failed_play);
NPT_CHECK_LABEL_SEVERE(WaitOnEvent(m_delegate->m_resevent, timeout, dialog), failed_play);
NPT_CHECK_LABEL_SEVERE(m_delegate->m_resstatus, failed_play);
/* wait for PLAYING state */
timeout.Set(timeout.GetInitialTimeoutValue());
do {
NPT_CHECK_LABEL_SEVERE(m_control->GetTransportInfo(m_delegate->m_device
, m_delegate->m_instance
, m_delegate), failed_waitplaying);
{ CSingleLock lock(m_delegate->m_section);
if(m_delegate->m_trainfo.cur_transport_state == "PLAYING"
|| m_delegate->m_trainfo.cur_transport_state == "PAUSED_PLAYBACK")
break;
if(m_delegate->m_trainfo.cur_transport_state == "STOPPED"
&& m_delegate->m_trainfo.cur_transport_status != "OK")
{
CLog::Log(LOGERROR, "UPNP: CUPnPPlayer::OpenFile - remote player signalled error %s", file.GetPath().c_str());
return NPT_FAILURE;
}
}
//.........这里部分代码省略.........