Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed: Split the music scraping into separate album and artist scra…

…pers.

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@30654 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information...
commit c0774430ef654a49ae93a4049653ba04ddba8cf0 1 parent 2f22b97
jmarshallnz authored
View
4 language/English/strings.xml
@@ -1711,8 +1711,8 @@
<string id="20190">Custom</string>
<string id="20191">Enable debug logging</string>
<string id="20192">Download additional information during updates</string>
-
- <string id="20194">Default service for music information</string>
+ <string id="20193">Default service for album information</string>
+ <string id="20194">Default service for artist information</string>
<string id="20195">Change scraper</string>
<string id="20196">Export music library</string>
<string id="20197">Import music library</string>
View
3  xbmc/GUISettings.cpp
@@ -270,7 +270,8 @@ void CGUISettings::Initialize()
AddBool(ml, "musiclibrary.showcompilationartists", 13414, true);
AddSeparator(ml,"musiclibrary.sep1");
AddBool(ml,"musiclibrary.downloadinfo", 20192, false);
- AddDefaultAddon(ml, "musiclibrary.scraper", 20194, "metadata.allmusic.com", ADDON_SCRAPER_ALBUMS);
+ AddDefaultAddon(ml, "musiclibrary.albumscraper", 20193, "metadata.allmusic.com", ADDON_SCRAPER_ALBUMS);
+ AddDefaultAddon(ml, "musiclibrary.artistscraper", 20194, "metadata.allmusic.com", ADDON_SCRAPER_ARTISTS);
AddBool(ml, "musiclibrary.updateonstartup", 22000, false);
AddBool(NULL, "musiclibrary.backgroundupdate", 22001, false);
AddSeparator(ml,"musiclibrary.sep2");
View
29 xbmc/GUIWindowMusicNav.cpp
@@ -493,8 +493,6 @@ void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &butt
m_vecItems->m_strPath.Equals("special://musicplaylists/");
CMusicDatabaseDirectory dir;
- ADDON::ScraperPtr 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() && !item->m_bIsFolder)
@@ -535,10 +533,13 @@ void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &butt
}
// 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->Supports(CONTENT_ALBUMS))
+ if (dir.IsArtistDir(item->m_strPath) && !dir.IsAllItem(item->m_strPath) &&
+ item->m_bIsFolder && !item->IsVideoDb())
{
- buttons.Add(CONTEXT_BUTTON_INFO_ALL, 21884);
+ ADDON::ScraperPtr info;
+ m_musicdatabase.GetScraperForPath(item->m_strPath, info, ADDON::ADDON_SCRAPER_ARTISTS);
+ if (info && info->Supports(CONTENT_ARTISTS))
+ buttons.Add(CONTEXT_BUTTON_INFO_ALL, 21884);
}
//Set default or clear default
@@ -729,22 +730,22 @@ bool CGUIWindowMusicNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
else if (params.GetArtistId() != -1)
path.Format("musicdb://2/%i/",params.GetArtistId());
- if (!m_musicdatabase.GetScraperForPath(path,scraper))
+ CONTENT_TYPE content = CONTENT_ALBUMS;
+ if (m_vecItems->m_strPath.Left(12).Equals("musicdb://1/") || item->m_strPath.Left(12).Equals("musicdb://2/"))
+ {
+ content = CONTENT_ARTISTS;
+ }
+
+ if (!m_musicdatabase.GetScraperForPath(path, scraper, ADDON::ScraperTypeFromContent(content)))
{
ADDON::AddonPtr defaultScraper;
- if (ADDON::CAddonMgr::Get().GetDefault(ADDON::ADDON_SCRAPER_ALBUMS, defaultScraper))
+ if (ADDON::CAddonMgr::Get().GetDefault(ADDON::ScraperTypeFromContent(content), defaultScraper))
{
scraper = boost::dynamic_pointer_cast<ADDON::CScraper>(defaultScraper->Clone(defaultScraper));
}
}
- CONTENT_TYPE context = CONTENT_ALBUMS;
- if (m_vecItems->m_strPath.Left(12).Equals("musicdb://1/") || item->m_strPath.Left(12).Equals("musicdb://2/"))
- {
- context = CONTENT_ARTISTS;
- }
-
- if (CGUIDialogContentSettings::Show(scraper, bScan, context))
+ if (CGUIDialogContentSettings::Show(scraper, bScan, content))
{
m_musicdatabase.SetScraperForPath(path,scraper);
if (bScan)
View
12 xbmc/MusicDatabase.cpp
@@ -4035,7 +4035,7 @@ bool CMusicDatabase::SetScraperForPath(const CStdString& strPath, const ADDON::S
return false;
}
-bool CMusicDatabase::GetScraperForPath(const CStdString& strPath, ADDON::ScraperPtr& info)
+bool CMusicDatabase::GetScraperForPath(const CStdString& strPath, ADDON::ScraperPtr& info, const ADDON::TYPE &type)
{
try
{
@@ -4095,15 +4095,14 @@ bool CMusicDatabase::GetScraperForPath(const CStdString& strPath, ADDON::Scraper
info->LoadUserXML(m_pDS->fv("content.strSettings").get_asString());
}
else
- { // use default scraper for this content type
+ { // use default scraper of the requested type
ADDON::AddonPtr defaultScraper;
- // FIXME: Content is none, so what content type should we be using? This works currently as we only have one default music scraper
- if (ADDON::CAddonMgr::Get().GetDefault(ADDON::ADDON_SCRAPER_ALBUMS, defaultScraper))
+ if (ADDON::CAddonMgr::Get().GetDefault(type, defaultScraper))
{
info = boost::dynamic_pointer_cast<ADDON::CScraper>(defaultScraper->Clone(defaultScraper));
if (info)
{
- info->m_pathContent = content;
+ info->m_pathContent = (boost::dynamic_pointer_cast<ADDON::CScraper>(defaultScraper))->Content();
}
}
}
@@ -4113,8 +4112,7 @@ bool CMusicDatabase::GetScraperForPath(const CStdString& strPath, ADDON::Scraper
if (!info)
{ // use default music scraper instead
ADDON::AddonPtr addon;
- // FIXME: Content is none, so what content type should we be using? This works currently as we only have one default music scraper
- if(ADDON::CAddonMgr::Get().GetDefault(ADDON::ADDON_SCRAPER_ALBUMS, addon))
+ if(ADDON::CAddonMgr::Get().GetDefault(type, addon))
{
info = boost::dynamic_pointer_cast<ADDON::CScraper>(addon);
return (info);
View
2  xbmc/MusicDatabase.h
@@ -189,7 +189,7 @@ class CMusicDatabase : public CDatabase
bool SetSongRating(const CStdString &filePath, char rating);
bool SetScraperForPath(const CStdString& strPath, const ADDON::ScraperPtr& info);
- bool GetScraperForPath(const CStdString& strPath, ADDON::ScraperPtr& info);
+ bool GetScraperForPath(const CStdString& strPath, ADDON::ScraperPtr& info, const ADDON::TYPE &type);
/*! \brief Check whether a given scraper is in use.
\param scraper the scraper to check for.
View
6 xbmc/MusicInfoScanner.cpp
@@ -808,7 +808,7 @@ bool CMusicInfoScanner::DownloadAlbumInfo(const CStdString& strPath, const CStdS
// find album info
ADDON::ScraperPtr info;
- if (!m_musicDatabase.GetScraperForPath(strPath,info))
+ if (!m_musicDatabase.GetScraperForPath(strPath, info, ADDON::ADDON_SCRAPER_ALBUMS))
{
m_musicDatabase.Close();
return false;
@@ -856,7 +856,7 @@ bool CMusicInfoScanner::DownloadAlbumInfo(const CStdString& strPath, const CStdS
CLog::Log(LOGERROR,"Unable to find an url in nfo file: %s", strNfo.c_str());
}
- if (!scraper.CheckValidOrFallback(g_guiSettings.GetString("musiclibrary.scraper")))
+ if (!scraper.CheckValidOrFallback(g_guiSettings.GetString("musiclibrary.albumscraper")))
{ // 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;
@@ -1035,7 +1035,7 @@ bool CMusicInfoScanner::DownloadArtistInfo(const CStdString& strPath, const CStd
// find artist info
ADDON::ScraperPtr info;
- if (!m_musicDatabase.GetScraperForPath(strPath,info))
+ if (!m_musicDatabase.GetScraperForPath(strPath, info, ADDON::ADDON_SCRAPER_ARTISTS))
{
m_musicDatabase.Close();
return false;
View
5 xbmc/NfoFile.cpp
@@ -222,10 +222,7 @@ int CNfoFile::Scrape(const ScraperPtr& scraper, const CStdString& strURL /* = ""
CScraperParser parser;
if (!parser.Load(scraper))
return 0;
- if (scraper->Type() != m_type &&
- // FIXME: Artists != Albums anymore?
- !(m_type == ADDON_SCRAPER_ARTISTS && scraper->Type() == ADDON_SCRAPER_ALBUMS))
- // artists are scraped by album content scrapers
+ if (scraper->Type() != m_type)
{
return 1;
}
View
5 xbmc/addons/AddonManager.cpp
@@ -328,9 +328,10 @@ bool CAddonMgr::GetDefault(const TYPE &type, AddonPtr &addon)
setting = g_guiSettings.GetString("musicplayer.visualisation");
break;
case ADDON_SCRAPER_ALBUMS:
+ setting = g_guiSettings.GetString("musiclibrary.albumscraper");
+ break;
case ADDON_SCRAPER_ARTISTS:
- // FIXME: Split these up?
- setting = g_guiSettings.GetString("musiclibrary.scraper");
+ setting = g_guiSettings.GetString("musiclibrary.artistscraper");
break;
case ADDON_SCRAPER_MOVIES:
setting = g_guiSettings.GetString("scrapers.moviedefault");
View
32 xbmc/addons/Scraper.cpp
@@ -109,6 +109,27 @@ CScraper::CScraper(const cp_extension_t *ext) :
m_language = CAddonMgr::Get().GetExtValue(ext->configuration, "language");
m_requiressettings = CAddonMgr::Get().GetExtValue(ext->configuration,"requiressettings").Equals("true");
}
+ switch (Type())
+ {
+ case ADDON_SCRAPER_ALBUMS:
+ m_pathContent = CONTENT_ALBUMS;
+ break;
+ case ADDON_SCRAPER_ARTISTS:
+ m_pathContent = CONTENT_ARTISTS;
+ break;
+ case ADDON_SCRAPER_MOVIES:
+ m_pathContent = CONTENT_MOVIES;
+ break;
+ case ADDON_SCRAPER_MUSICVIDEOS:
+ m_pathContent = CONTENT_MUSICVIDEOS;
+ break;
+ case ADDON_SCRAPER_TVSHOWS:
+ m_pathContent = CONTENT_TVSHOWS;
+ break;
+ default:
+ m_pathContent = CONTENT_NONE;
+ break;
+ }
}
AddonPtr CScraper::Clone(const AddonPtr &self) const
@@ -119,19 +140,12 @@ AddonPtr CScraper::Clone(const AddonPtr &self) const
CScraper::CScraper(const CScraper &rhs, const AddonPtr &self)
: CAddon(rhs, self)
{
- m_pathContent = CONTENT_NONE;
+ m_pathContent = rhs.m_pathContent;
}
bool CScraper::Supports(const CONTENT_TYPE &content) const
{
- const TYPE contentType = ScraperTypeFromContent(content);
- if (Type() == contentType)
- return true;
- // FIXME: Special-casing music
- if ((content == CONTENT_ALBUMS || content == CONTENT_ARTISTS) &&
- (Type() == ADDON_SCRAPER_ALBUMS || Type() == ADDON_SCRAPER_ARTISTS))
- return true;
- return false;
+ return Type() == ScraperTypeFromContent(content);
}
bool CScraper::LoadSettings()
Please sign in to comment.
Something went wrong with that request. Please try again.