本文整理汇总了C++中addon::ScraperPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ScraperPtr类的具体用法?C++ ScraperPtr怎么用?C++ ScraperPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ScraperPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Load
bool CMusicAlbumInfo::Load(XFILE::CCurlFile& http, const ADDON::ScraperPtr& scraper)
{
bool fSuccess = scraper->GetAlbumDetails(http, m_albumURL, m_album);
if (fSuccess && m_strTitle2.empty())
m_strTitle2 = m_album.strAlbum;
SetLoaded(fSuccess);
return fSuccess;
}
开发者ID:Sithisackt,项目名称:kodi,代码行数:8,代码来源:MusicAlbumInfo.cpp
示例2: 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;
}
开发者ID:BigNoid,项目名称:xbmc,代码行数:45,代码来源:GUIDialogInfoProviderSettings.cpp
示例3: 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);
}
开发者ID:,项目名称:,代码行数:17,代码来源:
示例4: 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)
//.........这里部分代码省略.........
开发者ID:0xheart0,项目名称:xbmc,代码行数:101,代码来源:VideoLibraryRefreshingJob.cpp
示例5: DownloadArtistInfo
bool CMusicInfoScanner::DownloadArtistInfo(const CStdString& strPath, const CStdString& strArtist, bool& bCanceled, CGUIDialogProgress* pDialog)
{
XFILE::MUSICDATABASEDIRECTORY::CQueryParams params;
XFILE::MUSICDATABASEDIRECTORY::CDirectoryNode::GetDatabaseInfo(strPath, params);
bCanceled = false;
CArtist artist;
m_musicDatabase.Open();
if (m_musicDatabase.GetArtistInfo(params.GetArtistId(),artist)) // already got the info
return true;
// find artist info
ADDON::ScraperPtr info;
if (!m_musicDatabase.GetScraperForPath(strPath, info, ADDON::ADDON_SCRAPER_ARTISTS) || !info)
{
m_musicDatabase.Close();
return false;
}
if (m_handle)
{
m_handle->SetTitle(StringUtils::Format(g_localizeStrings.Get(20320), info->Name().c_str()));
m_handle->SetText(strArtist);
}
// clear our scraper cache
info->ClearCache();
CMusicInfoScraper scraper(info);
// handle nfo files
CStdString strArtistPath, strNfo;
m_musicDatabase.GetArtistPath(params.GetArtistId(),strArtistPath);
URIUtils::AddFileToFolder(strArtistPath,"artist.nfo",strNfo);
CNfoFile::NFOResult result=CNfoFile::NO_NFO;
CNfoFile nfoReader;
if (XFILE::CFile::Exists(strNfo))
{
CLog::Log(LOGDEBUG,"Found matching nfo file: %s", strNfo.c_str());
result = nfoReader.Create(strNfo, info);
if (result == CNfoFile::FULL_NFO)
{
CLog::Log(LOGDEBUG, "%s Got details from nfo", __FUNCTION__);
CArtist artist;
nfoReader.GetDetails(artist);
m_musicDatabase.SetArtistInfo(params.GetArtistId(), artist);
map<string, string> artwork = GetArtistArtwork(params.GetArtistId(), &artist);
m_musicDatabase.SetArtForItem(params.GetArtistId(), "artist", artwork);
m_musicDatabase.Close();
return true;
}
else if (result == CNfoFile::URL_NFO || result == CNfoFile::COMBINED_NFO)
{
CScraperUrl scrUrl(nfoReader.ScraperUrl());
CMusicArtistInfo artist("nfo",scrUrl);
info = nfoReader.GetScraperInfo();
CLog::Log(LOGDEBUG,"-- nfo-scraper: %s",info->Name().c_str());
CLog::Log(LOGDEBUG,"-- nfo url: %s", scrUrl.m_url[0].m_url.c_str());
scraper.SetScraperInfo(info);
scraper.GetArtists().push_back(artist);
}
else
CLog::Log(LOGERROR,"Unable to find an url in nfo file: %s", strNfo.c_str());
}
if (!scraper.GetArtistCount())
{
scraper.FindArtistInfo(strArtist);
while (!scraper.Completed())
{
if (m_bStop)
{
scraper.Cancel();
bCanceled = true;
}
Sleep(1);
}
}
int iSelectedArtist = 0;
if (result == CNfoFile::NO_NFO)
{
if (scraper.Succeeded() && scraper.GetArtistCount() >= 1)
{
// now load the first match
if (pDialog && scraper.GetArtistCount() > 1)
{
// if we found more then 1 album, let user choose one
CGUIDialogSelect *pDlg = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (pDlg)
{
pDlg->SetHeading(g_localizeStrings.Get(21890));
pDlg->Reset();
pDlg->EnableButton(true, 413); // manual
for (int i = 0; i < scraper.GetArtistCount(); ++i)
{
// set the label to artist
CFileItem item(scraper.GetArtist(i).GetArtist());
CStdString strTemp=scraper.GetArtist(i).GetArtist().strArtist;
if (!scraper.GetArtist(i).GetArtist().strBorn.IsEmpty())
//.........这里部分代码省略.........
开发者ID:AdolphHuan,项目名称:xbmc,代码行数:101,代码来源:MusicInfoScanner.cpp
示例6: DownloadAlbumInfo
bool CMusicInfoScanner::DownloadAlbumInfo(const CStdString& strPath, const CStdString& strArtist, const CStdString& strAlbum, bool& bCanceled, CMusicAlbumInfo& albumInfo, CGUIDialogProgress* pDialog)
{
CAlbum album;
VECSONGS songs;
XFILE::MUSICDATABASEDIRECTORY::CQueryParams params;
XFILE::MUSICDATABASEDIRECTORY::CDirectoryNode::GetDatabaseInfo(strPath, params);
bCanceled = false;
m_musicDatabase.Open();
if (m_musicDatabase.HasAlbumInfo(params.GetAlbumId()) && m_musicDatabase.GetAlbumInfo(params.GetAlbumId(),album,&songs))
return true;
// find album info
ADDON::ScraperPtr info;
if (!m_musicDatabase.GetScraperForPath(strPath, info, ADDON::ADDON_SCRAPER_ALBUMS) || !info)
{
m_musicDatabase.Close();
return false;
}
if (m_handle)
{
m_handle->SetTitle(StringUtils::Format(g_localizeStrings.Get(20321), info->Name().c_str()));
m_handle->SetText(strArtist+" - "+strAlbum);
}
// clear our scraper cache
info->ClearCache();
CMusicInfoScraper scraper(info);
// handle nfo files
CStdString strAlbumPath, strNfo;
m_musicDatabase.GetAlbumPath(params.GetAlbumId(),strAlbumPath);
URIUtils::AddFileToFolder(strAlbumPath,"album.nfo",strNfo);
CNfoFile::NFOResult result=CNfoFile::NO_NFO;
CNfoFile nfoReader;
if (XFILE::CFile::Exists(strNfo))
{
CLog::Log(LOGDEBUG,"Found matching nfo file: %s", strNfo.c_str());
result = nfoReader.Create(strNfo, info, -1, strPath);
if (result == CNfoFile::FULL_NFO)
{
CLog::Log(LOGDEBUG, "%s Got details from nfo", __FUNCTION__);
CAlbum album;
nfoReader.GetDetails(album);
m_musicDatabase.SetAlbumInfo(params.GetAlbumId(), album, album.songs);
GetAlbumArtwork(params.GetAlbumId(), album);
m_musicDatabase.Close();
return true;
}
else if (result == CNfoFile::URL_NFO || result == CNfoFile::COMBINED_NFO)
{
CScraperUrl scrUrl(nfoReader.ScraperUrl());
CMusicAlbumInfo album("nfo",scrUrl);
info = nfoReader.GetScraperInfo();
CLog::Log(LOGDEBUG,"-- nfo-scraper: %s",info->Name().c_str());
CLog::Log(LOGDEBUG,"-- nfo url: %s", scrUrl.m_url[0].m_url.c_str());
scraper.SetScraperInfo(info);
scraper.GetAlbums().push_back(album);
}
else
CLog::Log(LOGERROR,"Unable to find an url in nfo file: %s", strNfo.c_str());
}
if (!scraper.CheckValidOrFallback(g_guiSettings.GetString("musiclibrary.albumsscraper")))
{ // the current scraper is invalid, as is the default - bail
CLog::Log(LOGERROR, "%s - current and default scrapers are invalid. Pick another one", __FUNCTION__);
return false;
}
if (!scraper.GetAlbumCount())
{
scraper.FindAlbumInfo(strAlbum, strArtist);
while (!scraper.Completed())
{
if (m_bStop)
{
scraper.Cancel();
bCanceled = true;
}
Sleep(1);
}
}
CGUIDialogSelect *pDlg=NULL;
int iSelectedAlbum=0;
if (result == CNfoFile::NO_NFO)
{
iSelectedAlbum = -1; // set negative so that we can detect a failure
if (scraper.Succeeded() && scraper.GetAlbumCount() >= 1)
{
int bestMatch = -1;
double bestRelevance = 0;
double minRelevance = THRESHOLD;
if (scraper.GetAlbumCount() > 1) // score the matches
{
//show dialog with all albums found
if (pDialog)
{
//.........这里部分代码省略.........
开发者ID:AdolphHuan,项目名称:xbmc,代码行数:101,代码来源:MusicInfoScanner.cpp
示例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;
//.........这里部分代码省略.........
开发者ID:JamesLinus,项目名称:xbmc,代码行数:101,代码来源:GUIWindowMusicNav.cpp
示例8: 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;
}
开发者ID:FLyrfors,项目名称:xbmc,代码行数:66,代码来源:GUIDialogContentSettings.cpp
示例9: 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");
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:
示例10: DownloadArtistInfo
INFO_RET CMusicInfoScanner::DownloadArtistInfo(const CArtist& artist, const ADDON::ScraperPtr& info, MUSIC_GRABBER::CMusicArtistInfo& artistInfo, CGUIDialogProgress* pDialog)
{
if (m_handle)
{
m_handle->SetTitle(StringUtils::Format(g_localizeStrings.Get(20320).c_str(), info->Name().c_str()));
m_handle->SetText(artist.strArtist);
}
// clear our scraper cache
info->ClearCache();
CMusicInfoScraper scraper(info);
bool bMusicBrainz = false;
if (!artist.strMusicBrainzArtistID.empty())
{
CScraperUrl musicBrainzURL;
if (ResolveMusicBrainz(artist.strMusicBrainzArtistID, info, musicBrainzURL))
{
CMusicArtistInfo artistNfo("nfo", musicBrainzURL);
scraper.GetArtists().clear();
scraper.GetArtists().push_back(artistNfo);
bMusicBrainz = true;
}
}
// handle nfo files
std::string path = artist.strPath;
if (path.empty())
m_musicDatabase.GetArtistPath(artist.idArtist, path);
std::string strNfo = URIUtils::AddFileToFolder(path, "artist.nfo");
CNfoFile::NFOResult result=CNfoFile::NO_NFO;
CNfoFile nfoReader;
if (XFILE::CFile::Exists(strNfo))
{
CLog::Log(LOGDEBUG,"Found matching nfo file: %s", strNfo.c_str());
result = nfoReader.Create(strNfo, info);
if (result == CNfoFile::FULL_NFO)
{
CLog::Log(LOGDEBUG, "%s Got details from nfo", __FUNCTION__);
nfoReader.GetDetails(artistInfo.GetArtist());
return INFO_ADDED;
}
else if (result == CNfoFile::URL_NFO || result == CNfoFile::COMBINED_NFO)
{
CScraperUrl scrUrl(nfoReader.ScraperUrl());
CMusicArtistInfo artistNfo("nfo",scrUrl);
ADDON::ScraperPtr nfoReaderScraper = nfoReader.GetScraperInfo();
CLog::Log(LOGDEBUG,"-- nfo-scraper: %s",nfoReaderScraper->Name().c_str());
CLog::Log(LOGDEBUG,"-- nfo url: %s", scrUrl.m_url[0].m_url.c_str());
scraper.SetScraperInfo(nfoReaderScraper);
scraper.GetArtists().push_back(artistNfo);
}
else
CLog::Log(LOGERROR,"Unable to find an url in nfo file: %s", strNfo.c_str());
}
if (!scraper.GetArtistCount())
{
scraper.FindArtistInfo(artist.strArtist);
while (!scraper.Completed())
{
if (m_bStop)
{
scraper.Cancel();
return INFO_CANCELLED;
}
Sleep(1);
}
}
int iSelectedArtist = 0;
if (result == CNfoFile::NO_NFO && !bMusicBrainz)
{
if (scraper.GetArtistCount() >= 1)
{
// now load the first match
if (pDialog && scraper.GetArtistCount() > 1)
{
// if we found more then 1 album, let user choose one
CGUIDialogSelect *pDlg = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
if (pDlg)
{
pDlg->SetHeading(g_localizeStrings.Get(21890));
pDlg->Reset();
pDlg->EnableButton(true, 413); // manual
for (int i = 0; i < scraper.GetArtistCount(); ++i)
{
// set the label to artist
CFileItem item(scraper.GetArtist(i).GetArtist());
std::string strTemp=scraper.GetArtist(i).GetArtist().strArtist;
if (!scraper.GetArtist(i).GetArtist().strBorn.empty())
strTemp += " ("+scraper.GetArtist(i).GetArtist().strBorn+")";
if (!scraper.GetArtist(i).GetArtist().genre.empty())
{
std::string genres = StringUtils::Join(scraper.GetArtist(i).GetArtist().genre, g_advancedSettings.m_musicItemSeparator);
if (!genres.empty())
strTemp = StringUtils::Format("[%s] %s", genres.c_str(), strTemp.c_str());
//.........这里部分代码省略.........
开发者ID:Sithisackt,项目名称:kodi,代码行数:101,代码来源:MusicInfoScanner.cpp
示例11: 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 &&
//.........这里部分代码省略.........
开发者ID:AWilco,项目名称:xbmc,代码行数:101,代码来源:GUIWindowMusicNav.cpp
示例12: 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);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:
示例13: GetContextButtons
void CGUIWindowMusicNav::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->IsPath(CUtil::MusicPlaylistsLocation()) ||
m_vecItems->IsPath("special://musicplaylists/");
if (m_vecItems->IsPath("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!
MEDIA_DETECT::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
// 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->IsPath("add") && !item->IsParentFolder() &&
!item->IsPlugin() &&
!StringUtils::StartsWithNoCase(item->GetPath(), "addons://") &&
(CProfilesManager::GetInstance().GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser))
{
buttons.Add(CONTEXT_BUTTON_SCAN, 13352);
}
CGUIMediaWindow::GetContextButtons(itemNumber, buttons);
}
else
{
CGUIWindowMusicBase::GetContextButtons(itemNumber, buttons);
CMusicDatabaseDirectory dir;
// enable query all albums button only in album view
if (item->IsAlbum() && !dir.IsAllItem(item->GetPath()) &&
item->m_bIsFolder && !item->IsVideoDb() && !item->IsParentFolder() &&
!item->IsPlugin() && !StringUtils::StartsWithNoCase(item->GetPath(), "musicsearch://"))
{
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 20059);
}
// enable query all artist button only in artist view
if (dir.IsArtistDir(item->GetPath()) && !dir.IsAllItem(item->GetPath()) &&
item->m_bIsFolder && !item->IsVideoDb())
{
ADDON::ScraperPtr info;
if(m_musicdatabase.GetScraperForPath(item->GetPath(), info, ADDON::ADDON_SCRAPER_ARTISTS))
{
if (info && info->Supports(CONTENT_ARTISTS))
buttons.Add(CONTEXT_BUTTON_INFO_ALL, 21884);
}
}
//Set default or clear default
NODE_TYPE nodetype = dir.GetDirectoryType(item->GetPath());
if (!item->IsParentFolder() && !inPlaylists &&
(nodetype == NODE_TYPE_ROOT ||
nodetype == NODE_TYPE_OVERVIEW ||
nodetype == NODE_TYPE_TOP100))
{
if (!item->IsPath(CSettings::GetInstance().GetString(CSettings::SETTING_MYMUSIC_DEFAULTLIBVIEW)))
buttons.Add(CONTEXT_BUTTON_SET_DEFAULT, 13335); // set default
if (!CSettings::GetInstance().GetString(CSettings::SETTING_MYMUSIC_DEFAULTLIBVIEW).empty())
buttons.Add(CONTEXT_BUTTON_CLEAR_DEFAULT, 13403); // clear default
}
NODE_TYPE childtype = dir.GetDirectoryChildType(item->GetPath());
if (childtype == NODE_TYPE_ALBUM ||
childtype == NODE_TYPE_ARTIST ||
nodetype == NODE_TYPE_GENRE ||
nodetype == NODE_TYPE_ALBUM ||
nodetype == NODE_TYPE_ALBUM_RECENTLY_ADDED ||
nodetype == NODE_TYPE_ALBUM_COMPILATIONS)
{
// we allow the user to set content for
// 1. general artist and album nodes
// 2. specific per genre
// 3. specific per artist
// 4. specific per album
buttons.Add(CONTEXT_BUTTON_SET_CONTENT, 20195);
}
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetArtistString().empty())
{
CVideoDatabase database;
database.Open();
//.........这里部分代码省略.........
开发者ID:johnfraney,项目名称:xbmc,代码行数:101,代码来源:GUIWindowMusicNav.cpp
示例14: ManageInfoProvider
bool CGUIWindowMusicNav::ManageInfoProvider(const CFileItemPtr item)
{
CQueryParams params;
CDirectoryNode::GetDatabaseInfo(item->GetPath(), params);
// Management of Info provider only valid for specific artist or album items
if (params.GetAlbumId() == -1 && params.GetArtistId() == -1)
return false;
// Set things up for processing artist or albums
CONTENT_TYPE content = CONTENT_ALBUMS;
int id = params.GetAlbumId();
if (id == -1)
{
content = CONTENT_ARTISTS;
id = params.GetArtistId();
}
ADDON::ScraperPtr scraper;
// Get specific scraper and settings for current item or use default
if (!m_musicdatabase.GetScraper(id, content, scraper))
{
ADDON::AddonPtr defaultScraper;
if (ADDON::CAddonSystemSettings::GetInstance().GetActive(
ADDON::ScraperTypeFromContent(content), defaultScraper))
{
scraper = std::dynamic_pointer_cast<ADDON::CScraper>(defaultScraper);
}
}
/
|
请发表评论