本文整理汇总了C++中addon::ScraperPtr::SaveSettings方法的典型用法代码示例。如果您正苦于以下问题:C++ ScraperPtr::SaveSettings方法的具体用法?C++ ScraperPtr::SaveSettings怎么用?C++ ScraperPtr::SaveSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类addon::ScraperPtr
的用法示例。
在下文中一共展示了ScraperPtr::SaveSettings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
// Set Information provider and settings
int applyto = CGUIDialogInfoProviderSettings::Show(scraper);
if (applyto >= 0)
{
bool result = false;
CVariant msgctxt;
switch (applyto)
{
case INFOPROVIDERAPPLYOPTIONS::INFOPROVIDER_THISITEM: // Change information provider for specific item
result = m_musicdatabase.SetScraper(id, content, scraper);
break;
case INFOPROVIDERAPPLYOPTIONS::INFOPROVIDER_ALLVIEW: // Change information provider for the filtered items shown on this node
{
msgctxt = 38069;
if (content == CONTENT_ARTISTS)
msgctxt = 38068;
if (CGUIDialogYesNo::ShowAndGetInput(CVariant{ 20195 }, msgctxt)) // Change information provider, confirm for all shown
{
// Set scraper for all items on curent view.
std::string strPath = "musicdb://";
if (content == CONTENT_ARTISTS)
strPath += "artists";
else
strPath += "albums";
URIUtils::AddSlashAtEnd(strPath);
// Items on view could be limited by navigation criteria, smart playlist rules or a filter.
// Get these options, except ID, from item path
CURL musicUrl(item->GetPath()); //Use CURL, as CMusicDbUrl removes "filter" option
if (content == CONTENT_ARTISTS)
musicUrl.RemoveOption("artistid");
else
musicUrl.RemoveOption("albumid");
strPath += musicUrl.GetOptions();
result = m_musicdatabase.SetScraperAll(strPath, scraper);
}
}
break;
case INFOPROVIDERAPPLYOPTIONS::INFOPROVIDER_DEFAULT: // Change information provider for all items
{
msgctxt = 38071;
if (content == CONTENT_ARTISTS)
msgctxt = 38070;
if (CGUIDialogYesNo::ShowAndGetInput(CVariant{20195}, msgctxt)) // Change information provider, confirm default and clear
{
// Save scraper addon default setting values
scraper->SaveSettings();
// Set default scraper
if (content == CONTENT_ARTISTS)
CServiceBroker::GetSettings()->SetString(CSettings::SETTING_MUSICLIBRARY_ARTISTSSCRAPER, scraper->ID());
else
CServiceBroker::GetSettings()->SetString(CSettings::SETTING_MUSICLIBRARY_ALBUMSSCRAPER, scraper->ID());
CServiceBroker::GetSettings()->Save();
// Clear all item specifc settings
if (content == CONTENT_ARTISTS)
result = m_musicdatabase.SetScraperAll("musicdb://artists/", nullptr);
else
result = m_musicdatabase.SetScraperAll("musicdb://albums/", nullptr);
}
}
default:
break;
}
if (!result)
return false;
// Refresh additional information using the new settings
if (applyto == INFOPROVIDERAPPLYOPTIONS::INFOPROVIDER_ALLVIEW || applyto == INFOPROVIDERAPPLYOPTIONS::INFOPROVIDER_DEFAULT)
{
// Change information provider, all artists or albums
if (CGUIDialogYesNo::ShowAndGetInput(CVariant{20195}, CVariant{38072}))
OnItemInfoAll(m_vecItems->GetPath(), true);
//.........这里部分代码省略.........