本文整理汇总了C++中addon::ScraperPtr::Content方法的典型用法代码示例。如果您正苦于以下问题:C++ ScraperPtr::Content方法的具体用法?C++ ScraperPtr::Content怎么用?C++ ScraperPtr::Content使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类addon::ScraperPtr
的用法示例。
在下文中一共展示了ScraperPtr::Content方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Show
int CGUIDialogInfoProviderSettings::Show(ADDON::ScraperPtr& scraper)
{
CGUIDialogInfoProviderSettings *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogInfoProviderSettings>(WINDOW_DIALOG_INFOPROVIDER_SETTINGS);
if (!dialog || !scraper)
return -1;
if (scraper->Content() != CONTENT_ARTISTS && scraper->Content() != CONTENT_ALBUMS)
return -1;
dialog->m_showSingleScraper = true;
dialog->m_singleScraperType = scraper->Content();
if (dialog->m_singleScraperType == CONTENT_ALBUMS)
dialog->SetAlbumScraper(scraper);
else
dialog->SetArtistScraper(scraper);
// toast selected but disabled scrapers
if (CServiceBroker::GetAddonMgr().IsAddonDisabled(scraper->ID()))
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(24024), scraper->Name(), 2000, true);
dialog->Open();
bool confirmed = dialog->IsConfirmed();
unsigned int applyToItems = dialog->m_applyToItems;
if (confirmed)
{
if (dialog->m_singleScraperType == CONTENT_ALBUMS)
scraper = dialog->GetAlbumScraper();
else
{
scraper = dialog->GetArtistScraper();
// Save artist information folder (here not in the caller) when applying setting as default for all artists
if (applyToItems == INFOPROVIDERAPPLYOPTIONS::INFOPROVIDER_DEFAULT)
CServiceBroker::GetSettings().SetString(CSettings::SETTING_MUSICLIBRARY_ARTISTSFOLDER, dialog->m_strArtistInfoPath);
}
if (scraper)
scraper->SetPathSettings(dialog->m_singleScraperType, "");
}
dialog->ResetDefaults();
if (confirmed)
return applyToItems;
else
return -1;
}
示例2: OnItemInfo
void CGUIWindowVideoNav::OnItemInfo(const CFileItem& fileItem, ADDON::ScraperPtr& scraper)
{
if (!scraper || scraper->Content() == CONTENT_NONE)
{
m_database.Open(); // since we can be called from the music library without being inited
if (fileItem.IsVideoDb())
scraper = m_database.GetScraperForPath(fileItem.GetVideoInfoTag()->m_strPath);
else
{
std::string strPath,strFile;
URIUtils::Split(fileItem.GetPath(),strPath,strFile);
scraper = m_database.GetScraperForPath(strPath);
}
m_database.Close();
}
CGUIWindowVideoBase::OnItemInfo(fileItem, scraper);
}
示例3: Show
bool CGUIDialogContentSettings::Show(ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings, bool& bRunScan, CONTENT_TYPE musicContext/*=CONTENT_NONE*/)
{
CGUIDialogContentSettings *dialog = (CGUIDialogContentSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTENT_SETTINGS);
if (!dialog)
return false;
if (scraper)
{
dialog->m_content = musicContext != CONTENT_NONE ? musicContext : scraper->Content();
dialog->m_origContent = dialog->m_content;
dialog->m_scraper = scraper;
// toast selected but disabled scrapers
if (!scraper->Enabled())
g_application.m_guiDialogKaiToast.QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(24023), scraper->Name(), 2000, true);
}
dialog->m_bRunScan = bRunScan;
dialog->m_bScanRecursive = (settings.recurse > 0 && !settings.parent_name) || (settings.recurse > 1 && settings.parent_name);
dialog->m_bUseDirNames = settings.parent_name;
dialog->m_bExclude = settings.exclude;
dialog->m_bSingleItem = settings.parent_name_root;
dialog->m_bNoUpdate = settings.noupdate;
dialog->m_bNeedSave = false;
dialog->DoModal();
if (dialog->m_bNeedSave)
{
scraper = boost::dynamic_pointer_cast<CScraper>(dialog->m_scraper);
CONTENT_TYPE content = dialog->m_content;
if (!scraper || content == CONTENT_NONE)
{
scraper.reset();
bRunScan = false;
settings.exclude = dialog->m_bExclude;
}
else
{
settings.exclude = false;
settings.noupdate = dialog->m_bNoUpdate;
bRunScan = dialog->m_bRunScan;
scraper->SetPathSettings(content, "");
if (content == CONTENT_TVSHOWS)
{
settings.parent_name = dialog->m_bSingleItem;
settings.parent_name_root = dialog->m_bSingleItem;
settings.recurse = 0;
}
else if (content == CONTENT_MOVIES)
{
if (dialog->m_bUseDirNames)
{
settings.parent_name = true;
settings.parent_name_root = false;
settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 1;
if (dialog->m_bSingleItem)
{
settings.parent_name_root = true;
settings.recurse = 0;
}
}
else
{
settings.parent_name = false;
settings.parent_name_root = false;
settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 0;
}
}
else if (content == CONTENT_MUSICVIDEOS)
{
settings.parent_name = false;
settings.parent_name_root = false;
settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 0;
}
}
}
dialog->m_scraper.reset();
dialog->m_content = dialog->m_origContent = CONTENT_NONE;
return dialog->m_bNeedSave;
}
示例4: GetContextButtons
void CGUIWindowVideoNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
CGUIWindowVideoBase::GetContextButtons(itemNumber, buttons);
CVideoDatabaseDirectory dir;
NODE_TYPE node = dir.GetDirectoryChildType(m_vecItems->GetPath());
if (!item)
{
// nothing to do here
}
else if (m_vecItems->IsPath("sources://video/"))
{
// get the usual shares
CGUIDialogContextMenu::GetContextButtons("video", item, buttons);
if (!item->IsDVD() && item->GetPath() != "add" && !item->IsParentFolder() &&
(CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
{
CVideoDatabase database;
database.Open();
ADDON::ScraperPtr info = database.GetScraperForPath(item->GetPath());
if (!item->IsLiveTV() && !item->IsPlugin() && !item->IsAddonsPath() && !URIUtils::IsUPnP(item->GetPath()))
{
if (info && info->Content() != CONTENT_NONE)
{
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20442);
buttons.Add(CONTEXT_BUTTON_SCAN, 13349);
}
else
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20333);
}
}
}
else
{
// are we in the playlists location?
bool inPlaylists = m_vecItems->IsPath(CUtil::VideoPlaylistsLocation()) ||
m_vecItems->IsPath("special://videoplaylists/");
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_artist.empty())
{
CMusicDatabase database;
database.Open();
if (database.GetArtistByName(StringUtils::Join(item->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator)) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ARTIST, 20396);
}
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strAlbum.empty())
{
CMusicDatabase database;
database.Open();
if (database.GetAlbumByName(item->GetVideoInfoTag()->m_strAlbum) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ALBUM, 20397);
}
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strAlbum.empty() &&
!item->GetVideoInfoTag()->m_artist.empty() &&
!item->GetVideoInfoTag()->m_strTitle.empty())
{
CMusicDatabase database;
database.Open();
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);
// can we update the database?
if (CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser)
{
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)
{
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);
//.........这里部分代码省略.........
示例5: Work
bool CVideoLibraryRefreshingJob::Work(CVideoDatabase &db)
{
if (m_item == nullptr)
return false;
// determine the scraper for the item's path
VIDEO::SScanSettings scanSettings;
ADDON::ScraperPtr scraper = db.GetScraperForPath(m_item->GetPath(), scanSettings);
if (scraper == nullptr)
return false;
// copy the scraper in case we need it again
ADDON::ScraperPtr originalScraper(scraper);
// get the item's correct title
std::string itemTitle = m_searchTitle;
if (itemTitle.empty())
itemTitle = m_item->GetMovieName(scanSettings.parent_name);
CScraperUrl scraperUrl;
VIDEO::CVideoInfoScanner scanner;
bool needsRefresh = m_forceRefresh;
bool hasDetails = false;
bool ignoreNfo = m_ignoreNfo;
// run this in a loop in case we need to refresh again
bool failure = false;
do
{
if (!ignoreNfo)
{
// check if there's an NFO for the item
CNfoFile::NFOResult nfoResult = scanner.CheckForNFOFile(m_item.get(), scanSettings.parent_name_root, scraper, scraperUrl);
// if there's no NFO remember it in case we have to refresh again
if (nfoResult == CNfoFile::ERROR_NFO)
ignoreNfo = true;
else if (nfoResult != CNfoFile::NO_NFO)
hasDetails = true;
// if we are performing a forced refresh ask the user to choose between using a valid NFO and a valid scraper
if (needsRefresh && IsModal() && !scraper->IsNoop() &&
(nfoResult == CNfoFile::URL_NFO || nfoResult == CNfoFile::COMBINED_NFO || nfoResult == CNfoFile::FULL_NFO))
{
int heading = 20159;
if (scraper->Content() == CONTENT_MOVIES)
heading = 13346;
else if (scraper->Content() == CONTENT_TVSHOWS)
heading = m_item->m_bIsFolder ? 20351 : 20352;
else if (scraper->Content() == CONTENT_MUSICVIDEOS)
heading = 20393;
if (CGUIDialogYesNo::ShowAndGetInput(heading, 20446))
{
hasDetails = false;
ignoreNfo = true;
scraperUrl.Clear();
scraper = originalScraper;
}
}
}
// no need to re-fetch the episode guide for episodes
if (scraper->Content() == CONTENT_TVSHOWS && !m_item->m_bIsFolder)
hasDetails = true;
// if we don't have an url or need to refresh anyway do the web search
if (!hasDetails && (needsRefresh || scraperUrl.m_url.empty()))
{
SetTitle(StringUtils::Format(g_localizeStrings.Get(197).c_str(), scraper->Name().c_str()));
SetText(itemTitle);
SetProgress(0);
// clear any cached data from the scraper
scraper->ClearCache();
// create the info downloader for the scraper
CVideoInfoDownloader infoDownloader(scraper);
// try to find a matching item
MOVIELIST itemResultList;
int result = infoDownloader.FindMovie(itemTitle, itemResultList, GetProgressDialog());
// close the progress dialog
MarkFinished();
if (result > 0)
{
// there are multiple matches for the item
if (!itemResultList.empty())
{
// choose the first match
if (!IsModal())
scraperUrl = itemResultList.at(0);
else
{
// ask the user what to do
CGUIDialogSelect* selectDialog = static_cast<CGUIDialogSelect*>(g_windowManager.GetWindow(WINDOW_DIALOG_SELECT));
selectDialog->Reset();
selectDialog->SetHeading(scraper->Content() == CONTENT_TVSHOWS ? 20356 : 196);
for (const auto& itemResult : itemResultList)
//.........这里部分代码省略.........
示例6: Show
bool CGUIDialogContentSettings::Show(ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings, CONTENT_TYPE content /* = CONTENT_NONE */)
{
CGUIDialogContentSettings *dialog = g_windowManager.GetWindow<CGUIDialogContentSettings>(WINDOW_DIALOG_CONTENT_SETTINGS);
if (dialog == NULL)
return false;
if (scraper != NULL)
{
dialog->SetContent(content != CONTENT_NONE ? content : scraper->Content());
dialog->SetScraper(scraper);
// toast selected but disabled scrapers
if (CServiceBroker::GetAddonMgr().IsAddonDisabled(scraper->ID()))
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(24024), scraper->Name(), 2000, true);
}
dialog->SetScanSettings(settings);
dialog->Open();
bool confirmed = dialog->IsConfirmed();
if (confirmed)
{
scraper = dialog->GetScraper();
content = dialog->GetContent();
if (scraper == NULL || content == CONTENT_NONE)
settings.exclude = dialog->GetExclude();
else
{
settings.exclude = false;
settings.noupdate = dialog->GetNoUpdating();
scraper->SetPathSettings(content, "");
if (content == CONTENT_TVSHOWS)
{
settings.parent_name = settings.parent_name_root = dialog->GetContainsSingleItem();
settings.recurse = 0;
}
else if (content == CONTENT_MOVIES || content == CONTENT_MUSICVIDEOS)
{
if (dialog->GetUseDirectoryNames())
{
settings.parent_name = true;
settings.parent_name_root = false;
settings.recurse = dialog->GetScanRecursive() ? INT_MAX : 1;
if (dialog->GetContainsSingleItem())
{
settings.parent_name_root = true;
settings.recurse = 0;
}
}
else
{
settings.parent_name = false;
settings.parent_name_root = false;
settings.recurse = dialog->GetScanRecursive() ? INT_MAX : 0;
}
}
}
}
// now that we have evaluated all settings we need to reset the content
dialog->ResetContent();
return confirmed;
}
示例7: FillLibraryArt
bool CVideoThumbLoader::FillLibraryArt(CFileItem *pItem)
{
if (pItem->GetVideoInfoTag()->m_iDbId > -1 &&
!pItem->GetVideoInfoTag()->m_type.IsEmpty())
{
CVideoDatabase db;
db.Open();
map<string, string> artwork;
if (db.GetArtForItem(pItem->GetVideoInfoTag()->m_iDbId, pItem->GetVideoInfoTag()->m_type, artwork))
pItem->SetArt(artwork);
else
{
if (pItem->GetVideoInfoTag()->m_type == "movie" ||
pItem->GetVideoInfoTag()->m_type == "episode" ||
pItem->GetVideoInfoTag()->m_type == "tvshow" ||
pItem->GetVideoInfoTag()->m_type == "musicvideo")
{ // no art in the library, so find it locally and add
SScanSettings settings;
ADDON::ScraperPtr info = db.GetScraperForPath(pItem->GetVideoInfoTag()->m_strPath, settings);
if (info)
{
CFileItem item(*pItem);
item.SetPath(pItem->GetVideoInfoTag()->GetPath());
CVideoInfoScanner scanner;
scanner.GetArtwork(&item, info->Content(), settings.parent_name_root, true);
pItem->SetArt(item.GetArt());
}
}
else if (pItem->GetVideoInfoTag()->m_type == "set")
{ // no art for a set -> use the first movie for this set for art
CFileItemList items;
if (db.GetMoviesNav("", items, -1, -1, -1, -1, -1, -1, pItem->GetVideoInfoTag()->m_iDbId) && items.Size() > 0)
{
LoadItem(items[0].get());
if (!items[0]->GetArt().empty())
pItem->SetArt(items[0]->GetArt());
}
}
else if (pItem->GetVideoInfoTag()->m_type == "actor" ||
pItem->GetVideoInfoTag()->m_type == "artist" ||
pItem->GetVideoInfoTag()->m_type == "writer" ||
pItem->GetVideoInfoTag()->m_type == "director")
{
// We can't realistically get the local thumbs (as we'd need to check every movie that contains this actor)
// and most users won't have local actor thumbs that are actually different than the scraped ones.
if (g_guiSettings.GetBool("videolibrary.actorthumbs"))
{
pItem->GetVideoInfoTag()->m_strPictureURL.Parse();
CStdString thumb = CScraperUrl::GetThumbURL(pItem->GetVideoInfoTag()->m_strPictureURL.GetFirstThumb());
if (!thumb.IsEmpty())
pItem->SetThumbnailImage(thumb);
}
}
else if (pItem->GetVideoInfoTag()->m_type == "season")
{
// season art is fetched on scan from the tvshow root path (m_strPath in the season info tag)
// or from the show m_strPictureURL member of the tvshow, so grab the tvshow to get this.
CVideoInfoTag tag;
db.GetTvShowInfo(pItem->GetVideoInfoTag()->m_strPath, tag, pItem->GetVideoInfoTag()->m_iIdShow);
map<int, string> seasons;
CVideoInfoScanner::GetSeasonThumbs(tag, seasons, true);
map<int, string>::iterator season = seasons.find(pItem->GetVideoInfoTag()->m_iSeason);
if (season != seasons.end())
pItem->SetThumbnailImage(season->second);
}
// add to the database for next time around
map<string, string> artwork = pItem->GetArt();
if (!artwork.empty())
{
db.SetArtForItem(pItem->GetVideoInfoTag()->m_iDbId, pItem->GetVideoInfoTag()->m_type, artwork);
for (map<string, string>::iterator i = artwork.begin(); i != artwork.end(); ++i)
CTextureCache::Get().BackgroundCacheImage(i->second);
}
else // nothing found - set an empty thumb so that next time around we don't hit here again
db.SetArtForItem(pItem->GetVideoInfoTag()->m_iDbId, pItem->GetVideoInfoTag()->m_type, "thumb", "");
}
// For episodes and seasons, we want to set fanart for that of the show
if (!pItem->HasProperty("fanart_image") && pItem->GetVideoInfoTag()->m_iIdShow >= 0)
{
string fanart = db.GetArtForItem(pItem->GetVideoInfoTag()->m_iIdShow, "tvshow", "fanart");
if (!fanart.empty())
pItem->SetProperty("fanart_image", fanart);
}
db.Close();
}
return !pItem->GetArt().empty();
}
示例8: GetContextButtons
void CGUIWindowVideoNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
CGUIWindowVideoBase::GetContextButtons(itemNumber, buttons);
if (item && item->GetProperty("pluginreplacecontextitems").asBoolean())
return;
CVideoDatabaseDirectory dir;
NODE_TYPE node = dir.GetDirectoryChildType(m_vecItems->GetPath());
if (!item)
{
// nothing to do here
}
else if (m_vecItems->IsPath("sources://video/"))
{
// get the usual shares
CGUIDialogContextMenu::GetContextButtons("video", item, buttons);
// add scan button somewhere here
if (g_application.IsVideoScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
if (!item->IsDVD() && item->GetPath() != "add" && !item->IsParentFolder() &&
(CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
{
CVideoDatabase database;
database.Open();
ADDON::ScraperPtr info = database.GetScraperForPath(item->GetPath());
if (!item->IsLiveTV() && !item->IsPlugin() && !item->IsAddonsPath() && !URIUtils::IsUPnP(item->GetPath()))
{
if (info && info->Content() != CONTENT_NONE)
{
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20442);
buttons.Add(CONTEXT_BUTTON_SCAN, 13349);
}
else
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20333);
}
}
}
else
{
// are we in the playlists location?
bool inPlaylists = m_vecItems->IsPath(CUtil::VideoPlaylistsLocation()) ||
m_vecItems->IsPath("special://videoplaylists/");
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_artist.empty())
{
CMusicDatabase database;
database.Open();
if (database.GetArtistByName(StringUtils::Join(item->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator)) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ARTIST, 20396);
}
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0)
{
CMusicDatabase database;
database.Open();
if (database.GetAlbumByName(item->GetVideoInfoTag()->m_strAlbum) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ALBUM, 20397);
}
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0 &&
item->GetVideoInfoTag()->m_artist.size() > 0 &&
item->GetVideoInfoTag()->m_strTitle.size() > 0)
{
CMusicDatabase database;
database.Open();
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://"))
{
//.........这里部分代码省略.........
示例9: GetContextButtons
void CGUIWindowVideoNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
CGUIWindowVideoBase::GetContextButtons(itemNumber, buttons);
if (item && item->GetPropertyBOOL("pluginreplacecontextitems"))
return;
CVideoDatabaseDirectory dir;
NODE_TYPE node = dir.GetDirectoryChildType(m_vecItems->m_strPath);
if (!item)
{
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (pScanDlg && pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353);
else
buttons.Add(CONTEXT_BUTTON_UPDATE_LIBRARY, 653);
}
else
{
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 (!item->m_bIsFolder && !item->m_strPath.Left(19).Equals("newsmartplaylist://"))
buttons.Add(CONTEXT_BUTTON_INFO, 13346);
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strArtist.IsEmpty())
{
CMusicDatabase database;
database.Open();
if (database.GetArtistByName(item->GetVideoInfoTag()->m_strArtist) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ARTIST, 20396);
}
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0)
{
CMusicDatabase database;
database.Open();
if (database.GetAlbumByName(item->GetVideoInfoTag()->m_strAlbum) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ALBUM, 20397);
}
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0 &&
item->GetVideoInfoTag()->m_strArtist.size() > 0 &&
item->GetVideoInfoTag()->m_strTitle.size() > 0)
{
CMusicDatabase database;
database.Open();
if (database.GetSongByArtistAndAlbumAndTitle(item->GetVideoInfoTag()->m_strArtist,
item->GetVideoInfoTag()->m_strAlbum,
item->GetVideoInfoTag()->m_strTitle) > -1)
{
buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 20398);
}
}
if (!item->IsParentFolder())
{
// can we update the database?
if (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser)
{
if (node == NODE_TYPE_TITLE_TVSHOWS)
{
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (pScanDlg && pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353);
else
buttons.Add(CONTEXT_BUTTON_UPDATE_TVSHOW, 13349);
}
if ((info && info->Content() == CONTENT_TVSHOWS && item->m_bIsFolder) ||
(item->IsVideoDb() && item->HasVideoInfoTag() && !item->m_bIsFolder))
{
if (item->m_bIsFolder || item->GetVideoInfoTag()->m_playCount > 0)
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); //Mark as UnWatched
if (item->m_bIsFolder || item->GetVideoInfoTag()->m_playCount == 0)
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); //Mark as Watched
if (node != NODE_TYPE_SEASONS)
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()) // 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);
//.........这里部分代码省略.........
示例10: GetContextButtons
void CGUIWindowVideoNav::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
CFileItemPtr item;
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
item = m_vecItems->Get(itemNumber);
CGUIWindowVideoBase::GetContextButtons(itemNumber, buttons);
if (item && item->GetPropertyBOOL("pluginreplacecontextitems"))
return;
CVideoDatabaseDirectory dir;
NODE_TYPE node = dir.GetDirectoryChildType(m_vecItems->m_strPath);
if (!item)
{
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (pScanDlg && pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353);
else
buttons.Add(CONTEXT_BUTTON_UPDATE_LIBRARY, 653);
}
else if (m_vecItems->m_strPath.Equals("sources://video/"))
{
// get the usual shares
CGUIDialogContextMenu::GetContextButtons("video", item, buttons);
// add scan button somewhere here
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
if (pScanDlg && pScanDlg->IsScanning())
buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
if (!item->IsDVD() && item->m_strPath != "add" &&
(g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
{
CVideoDatabase database;
database.Open();
ADDON::ScraperPtr info = database.GetScraperForPath(item->m_strPath);
if (!pScanDlg || (pScanDlg && !pScanDlg->IsScanning()))
{
if (!item->IsLiveTV() && !item->IsPlugin() && !item->IsAddonsPath())
{
if (info && info->Content() != CONTENT_NONE)
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20442);
else
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20333);
}
}
if (info && (!pScanDlg || (pScanDlg && !pScanDlg->IsScanning())))
buttons.Add(CONTEXT_BUTTON_SCAN, 13349);
}
}
else
{
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 (!item->m_bIsFolder && !item->m_strPath.Left(19).Equals("newsmartplaylist://"))
buttons.Add(CONTEXT_BUTTON_INFO, 13346);
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strArtist.IsEmpty())
{
CMusicDatabase database;
database.Open();
if (database.GetArtistByName(item->GetVideoInfoTag()->m_strArtist) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ARTIST, 20396);
}
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0)
{
CMusicDatabase database;
database.Open();
if (database.GetAlbumByName(item->GetVideoInfoTag()->m_strAlbum) > -1)
buttons.Add(CONTEXT_BUTTON_GO_TO_ALBUM, 20397);
}
if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_strAlbum.size() > 0 &&
item->GetVideoInfoTag()->m_strArtist.size() > 0 &&
item->GetVideoInfoTag()->m_strTitle.size() > 0)
{
CMusicDatabase database;
database.Open();
if (database.GetSongByArtistAndAlbumAndTitle(item->GetVideoInfoTag()->m_strArtist,
item->GetVideoInfoTag()->m_strAlbum,
item->GetVideoInfoTag()->m_strTitle) > -1)
{
buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 20398);
}
}
if (!item->IsParentFolder())
{
// can we update the database?
if (g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser)
{
if (node == NODE_TYPE_TITLE_TVSHOWS)
{
CGUIDialogVideoScan *pScanDlg = (CGUIDialogVideoScan *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_SCAN);
//.........这里部分代码省略.........
示例11: LoadItem
/**
* Look for a thumbnail for pItem. If one does not exist, look for an autogenerated
* thumbnail. If that does not exist, attempt to autogenerate one. Finally, check
* for the existance of fanart and set properties accordinly.
* @return: true if pItem has been modified
*/
bool CVideoThumbLoader::LoadItem(CFileItem* pItem)
{
if (pItem->m_bIsShareOrDrive
|| pItem->IsParentFolder())
return false;
// resume point
if (pItem->HasVideoInfoTag() && pItem->GetVideoInfoTag()->m_resumePoint.totalTimeInSeconds == 0)
{
CVideoDatabase db;
db.Open();
if (db.GetResumePoint(*pItem->GetVideoInfoTag()))
pItem->SetInvalid();
db.Close();
}
// video db items normally have info in the database
if (pItem->HasVideoInfoTag() && pItem->GetVideoInfoTag()->m_iDbId > -1 &&
!pItem->GetVideoInfoTag()->m_type.IsEmpty() && pItem->GetArt().empty())
{
CVideoDatabase db;
db.Open();
map<string, string> artwork;
if (db.GetArtForItem(pItem->GetVideoInfoTag()->m_iDbId, pItem->GetVideoInfoTag()->m_type, artwork))
pItem->SetArt(artwork);
else
{
if (pItem->GetVideoInfoTag()->m_type == "movie" ||
pItem->GetVideoInfoTag()->m_type == "episode" ||
pItem->GetVideoInfoTag()->m_type == "tvshow" ||
pItem->GetVideoInfoTag()->m_type == "musicvideo")
{ // no art in the library, so find it locally and add
SScanSettings settings;
ADDON::ScraperPtr info = db.GetScraperForPath(pItem->GetVideoInfoTag()->m_strPath, settings);
if (info)
{
CFileItem item(*pItem);
item.SetPath(pItem->GetVideoInfoTag()->GetPath());
CVideoInfoScanner scanner;
scanner.GetArtwork(&item, info->Content(), settings.parent_name_root, true);
pItem->SetArt(item.GetArt());
}
}
else if (pItem->GetVideoInfoTag()->m_type == "set")
{ // no art for a set -> use the first movie for this set for art
CFileItemList items;
if (db.GetMoviesNav("", items, -1, -1, -1, -1, -1, -1, pItem->GetVideoInfoTag()->m_iDbId) && items.Size() > 0)
{
if (db.GetArtForItem(items[0]->GetVideoInfoTag()->m_iDbId, items[0]->GetVideoInfoTag()->m_type, artwork))
pItem->SetArt(artwork);
}
}
else if (pItem->GetVideoInfoTag()->m_type == "actor" ||
pItem->GetVideoInfoTag()->m_type == "artist" ||
pItem->GetVideoInfoTag()->m_type == "writer" ||
pItem->GetVideoInfoTag()->m_type == "director")
{
// We can't realistically get the local thumbs (as we'd need to check every movie that contains this actor)
// and most users won't have local actor thumbs that are actually different than the scraped ones.
if (g_guiSettings.GetBool("videolibrary.actorthumbs"))
{
pItem->GetVideoInfoTag()->m_strPictureURL.Parse();
CStdString thumb = CScraperUrl::GetThumbURL(pItem->GetVideoInfoTag()->m_strPictureURL.GetFirstThumb());
if (!thumb.IsEmpty())
pItem->SetThumbnailImage(thumb);
}
}
else if (pItem->GetVideoInfoTag()->m_type == "season")
{
// season art is fetched on scan from the tvshow root path (m_strPath in the season info tag)
// or from the show m_strPictureURL member of the tvshow, so grab the tvshow to get this.
CVideoInfoTag tag;
db.GetTvShowInfo(pItem->GetVideoInfoTag()->m_strPath, tag, pItem->GetVideoInfoTag()->m_iIdShow);
map<int, string> seasons;
CVideoInfoScanner::GetSeasonThumbs(tag, seasons, true);
map<int, string>::iterator season = seasons.find(pItem->GetVideoInfoTag()->m_iSeason);
if (season != seasons.end())
pItem->SetThumbnailImage(season->second);
}
// add to the database for next time around
map<string, string> artwork = pItem->GetArt();
if (!artwork.empty())
{
db.SetArtForItem(pItem->GetVideoInfoTag()->m_iDbId, pItem->GetVideoInfoTag()->m_type, artwork);
for (map<string, string>::iterator i = artwork.begin(); i != artwork.end(); ++i)
CTextureCache::Get().BackgroundCacheImage(i->second);
}
else // nothing found - set an empty thumb so that next time around we don't hit here again
db.SetArtForItem(pItem->GetVideoInfoTag()->m_iDbId, pItem->GetVideoInfoTag()->m_type, "thumb", "");
}
// For episodes and seasons, we want to set fanart for that of the show
if (!pItem->HasProperty("fanart_image") && pItem->GetVideoInfoTag()->m_iIdShow >= 0)
{
string fanart = db.GetArtForItem(pItem->GetVideoInfoTag()->m_iIdShow, "tvshow", "fanart");
//.........这里部分代码省略.........