aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbmc/FileItem.cpp17
-rw-r--r--xbmc/filesystem/ShoutcastFile.cpp9
-rw-r--r--xbmc/music/tags/MusicInfoTag.cpp11
-rw-r--r--xbmc/music/tags/MusicInfoTag.h3
-rw-r--r--xbmc/settings/AdvancedSettings.cpp5
-rw-r--r--xbmc/settings/AdvancedSettings.h1
6 files changed, 46 insertions, 0 deletions
diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp
index 3d1d437502..06d1285e50 100644
--- a/xbmc/FileItem.cpp
+++ b/xbmc/FileItem.cpp
@@ -1689,6 +1689,23 @@ void CFileItem::SetFromMusicInfoTag(const MUSIC_INFO::CMusicInfoTag &music)
m_strPath = music.GetURL();
m_bIsFolder = URIUtils::HasSlashAtEnd(m_strPath);
+ static const std::string ORIGINAL_THUMB = "OriginalThumb";
+ const std::string thumb = music.GetStationArt();
+ if (!thumb.empty())
+ {
+ // Overwrite whatever thumb we have; remember what we had originally.
+ if (!HasProperty(ORIGINAL_THUMB))
+ SetProperty(ORIGINAL_THUMB, GetArt("thumb"));
+
+ SetArt("thumb", music.GetStationArt());
+ }
+ else if (HasProperty(ORIGINAL_THUMB))
+ {
+ // Restore original thumb
+ SetArt("thumb", GetProperty(ORIGINAL_THUMB).asString());
+ ClearProperty(ORIGINAL_THUMB);
+ }
+
*GetMusicInfoTag() = music;
FillInDefaultIcon();
FillInMimeType(false);
diff --git a/xbmc/filesystem/ShoutcastFile.cpp b/xbmc/filesystem/ShoutcastFile.cpp
index 93ffde7e0b..c901969f85 100644
--- a/xbmc/filesystem/ShoutcastFile.cpp
+++ b/xbmc/filesystem/ShoutcastFile.cpp
@@ -15,9 +15,12 @@
#include "FileCache.h"
#include "FileItem.h"
+#include "ServiceBroker.h"
#include "URL.h"
#include "filesystem/CurlFile.h"
#include "messaging/ApplicationMessenger.h"
+#include "settings/AdvancedSettings.h"
+#include "settings/SettingsComponent.h"
#include "utils/CharsetConverter.h"
#include "utils/HTMLUtil.h"
#include "utils/JSONVariantParser.h"
@@ -185,6 +188,7 @@ bool CShoutcastFile::ExtractTagInfo(const char* buf)
std::string title;
std::string artistInfo;
+ std::string coverURL;
CRegExp reURL(true);
reURL.RegComp("StreamUrl=\'(.*?)\';");
@@ -216,6 +220,7 @@ bool CShoutcastFile::ExtractTagInfo(const char* buf)
// Example: StreamUrl='https://listenapi.bauerradio.com/api9/eventdata/58431417'
artistInfo = json["eventSongArtist"].asString();
title = json["eventSongTitle"].asString();
+ coverURL = json["eventImageUrl"].asString();
}
}
}
@@ -263,9 +268,13 @@ bool CShoutcastFile::ExtractTagInfo(const char* buf)
}
}
+ if (!CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_bShoutcastArt)
+ coverURL.clear();
+
CSingleLock lock(m_tagSection);
m_tag.SetArtist(artistInfo);
m_tag.SetTitle(title);
+ m_tag.SetStationArt(coverURL);
}
}
diff --git a/xbmc/music/tags/MusicInfoTag.cpp b/xbmc/music/tags/MusicInfoTag.cpp
index 91911da869..77429c370d 100644
--- a/xbmc/music/tags/MusicInfoTag.cpp
+++ b/xbmc/music/tags/MusicInfoTag.cpp
@@ -318,6 +318,11 @@ const std::string& CMusicInfoTag::GetStationName() const
return m_stationName;
}
+const std::string& CMusicInfoTag::GetStationArt() const
+{
+ return m_stationArt;
+}
+
void CMusicInfoTag::SetURL(const std::string& strURL)
{
m_strURL = strURL;
@@ -765,6 +770,11 @@ void CMusicInfoTag::SetAlbumReleaseStatus(const std::string& ReleaseStatus)
m_strReleaseStatus = ReleaseStatus;
}
+void CMusicInfoTag::SetStationArt(const std::string& strStationArt)
+{
+ m_stationArt = strStationArt;
+}
+
void CMusicInfoTag::SetArtist(const CArtist& artist)
{
SetArtist(artist.strArtist);
@@ -1183,6 +1193,7 @@ void CMusicInfoTag::Clear()
m_bitrate = 0;
m_channels = 0;
m_stationName.clear();
+ m_stationArt.clear();
}
void CMusicInfoTag::AppendArtist(const std::string &artist)
diff --git a/xbmc/music/tags/MusicInfoTag.h b/xbmc/music/tags/MusicInfoTag.h
index b1225cd34c..b0cf31eaaf 100644
--- a/xbmc/music/tags/MusicInfoTag.h
+++ b/xbmc/music/tags/MusicInfoTag.h
@@ -84,6 +84,7 @@ public:
int GetSampleRate() const;
const std::string& GetAlbumReleaseStatus() const;
const std::string& GetStationName() const;
+ const std::string& GetStationArt() const;
const EmbeddedArtInfo &GetCoverArtInfo() const;
const ReplayGain& GetReplayGain() const;
CAlbum::ReleaseType GetAlbumReleaseType() const;
@@ -155,6 +156,7 @@ public:
void SetSampleRate(int samplerate);
void SetAlbumReleaseStatus(const std::string& strReleaseStatus);
void SetStationName(const std::string& strStationName); // name of online radio station
+ void SetStationArt(const std::string& strStationArt);
/*! \brief Append a unique artist to the artist list
Checks if we have this artist already added, and if not adds it to the songs artist list.
@@ -252,6 +254,7 @@ protected:
int m_channels;
int m_bitrate;
std::string m_stationName;
+ std::string m_stationArt; // Used to fetch thumb URL for Shoutcasts
EmbeddedArtInfo m_coverArt; ///< art information
diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp
index 9ffc1606b9..907828d705 100644
--- a/xbmc/settings/AdvancedSettings.cpp
+++ b/xbmc/settings/AdvancedSettings.cpp
@@ -265,6 +265,8 @@ void CAdvancedSettings::Initialize()
m_bFTPThumbs = false;
+ m_bShoutcastArt = true;
+
m_musicThumbs = "folder.jpg|Folder.jpg|folder.JPG|Folder.JPG|cover.jpg|Cover.jpg|cover.jpeg|thumb.jpg|Thumb.jpg|thumb.JPG|Thumb.JPG";
m_fanartImages = "fanart.jpg|fanart.png";
m_musicArtistExtraArt = { };
@@ -1038,6 +1040,9 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file)
if (pThumbs)
GetCustomExtensions(pThumbs,m_musicThumbs);
+ // show art for shoutcast v2 streams (set to false for devices with limited storage)
+ XMLUtils::GetBoolean(pRootElement, "shoutcastart", m_bShoutcastArt);
+
// movie fanarts
TiXmlElement* pFanart = pRootElement->FirstChildElement("fanart");
if (pFanart)
diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h
index 16fe0f898d..5aed3de94a 100644
--- a/xbmc/settings/AdvancedSettings.h
+++ b/xbmc/settings/AdvancedSettings.h
@@ -227,6 +227,7 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler
bool m_bHTTPDirectoryStatFilesize;
bool m_bFTPThumbs;
+ bool m_bShoutcastArt;
std::string m_musicThumbs;
std::string m_fanartImages;