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; }
bool CGUIDialogContentSettings::Show(SScraperInfo& scraper, VIDEO::SScanSettings& settings, bool& bRunScan, int iLabel) { CGUIDialogContentSettings *dialog = (CGUIDialogContentSettings *)m_gWindowManager.GetWindow(WINDOW_DIALOG_CONTENT_SETTINGS); if (!dialog) return false; dialog->m_info = scraper; if (iLabel != -1) // to switch between albums and artists dialog->m_strContentType = g_localizeStrings.Get(iLabel); dialog->m_scraperSettings = scraper.settings; 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 = scraper.strContent.Equals("None"); dialog->m_bSingleItem = settings.parent_name_root; dialog->m_bNeedSave = false; dialog->m_bUpdate = settings.noupdate; dialog->DoModal(); if (dialog->m_bNeedSave) { scraper = dialog->m_info; settings.noupdate = dialog->m_bUpdate; if (scraper.strContent.Equals("tvshows")) { settings.parent_name = dialog->m_bSingleItem; settings.parent_name_root = dialog->m_bSingleItem; settings.recurse = 0; bRunScan = dialog->m_bRunScan; } else if (scraper.strContent.Equals("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; } bRunScan = dialog->m_bRunScan; } else if (scraper.strContent.Equals("musicvideos")) { settings.parent_name = false; settings.parent_name_root = false; settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 0; bRunScan = dialog->m_bRunScan; } else if (scraper.strContent.Equals("albums")) { bRunScan = dialog->m_bRunScan; } else if (scraper.strContent.IsEmpty() || scraper.strContent.Equals("None") ) { if (dialog->m_bExclude) scraper.strContent = "None"; else scraper.strContent = ""; bRunScan = false; } if (!scraper.strContent.IsEmpty() && !scraper.strContent.Equals("None") && (!scraper.settings.GetPluginRoot() || scraper.settings.GetSettings().IsEmpty())) { // load default scraper settings scraper.settings.LoadSettingsXML("special://xbmc/system/scrapers/video/"+scraper.strPath); scraper.settings.SaveFromDefault(); } return true; } return false; }