diff --git a/CMakeLists.txt b/CMakeLists.txt index dbc30c1da..1ec3aac8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,13 +234,23 @@ if(ENABLE_BREAKPAD) set(HAVE_BREAKPAD ON) endif(ENABLE_BREAKPAD) -if(ENABLE_SPOTIFY AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE AND QCA_FOUND) +if(ENABLE_SPOTIFY AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE) set(HAVE_SPOTIFY ON) -endif(ENABLE_SPOTIFY AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE AND QCA_FOUND) +endif(ENABLE_SPOTIFY AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE) -if(HAVE_SPOTIFY AND SPOTIFY_FOUND) +if(ENABLE_SPOTIFY_BLOB AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE AND SPOTIFY_FOUND) set(HAVE_SPOTIFY_BLOB ON) -endif(HAVE_SPOTIFY AND SPOTIFY_FOUND) +endif(ENABLE_SPOTIFY_BLOB AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE AND SPOTIFY_FOUND) + +if((NOT HAVE_SPOTIFY_BLOB) AND (NOT QCA_FOUND)) + # If we're not bundling the spotify blob then we must ensure QCA is available + # so we can verify the blob we download at runtime. + unset(HAVE_SPOTIFY) +endif((NOT HAVE_SPOTIFY_BLOB) AND (NOT QCA_FOUND)) + +if(QCA_FOUND) + set(HAVE_QCA ON) +endif(QCA_FOUND) if(ENABLE_VISUALISATIONS) diff --git a/src/config.h.in b/src/config.h.in index 373cba287..d2a383144 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -32,6 +32,7 @@ #cmakedefine HAVE_LIBINDICATE #cmakedefine HAVE_LIBLASTFM #cmakedefine HAVE_LIBMTP +#cmakedefine HAVE_QCA #cmakedefine HAVE_REMOTE #cmakedefine HAVE_SPARKLE #cmakedefine HAVE_SPOTIFY diff --git a/src/internet/spotifyblobdownloader.cpp b/src/internet/spotifyblobdownloader.cpp index 782440206..73fdc7312 100644 --- a/src/internet/spotifyblobdownloader.cpp +++ b/src/internet/spotifyblobdownloader.cpp @@ -15,6 +15,7 @@ along with Clementine. If not, see . */ +#include "config.h" #include "spotifyblobdownloader.h" #include "spotifyservice.h" #include "core/logging.h" @@ -25,7 +26,10 @@ #include #include #include -#include + +#ifdef HAVE_QCA + #include +#endif // HAVE_QCA const char* SpotifyBlobDownloader::kSignatureSuffix = ".sha1"; @@ -109,6 +113,7 @@ void SpotifyBlobDownloader::ReplyFinished() { file_data[filename] = reply->readAll(); } +#ifdef HAVE_QCA // Load the public key QCA::ConvertResult conversion_result; QCA::PublicKey key = QCA::PublicKey::fromPEMFile(":/clementine-spotify-public.pem", @@ -132,6 +137,7 @@ void SpotifyBlobDownloader::ReplyFinished() { return; } } +#endif // Make the destination directory and write the files into it QDir().mkpath(path_); diff --git a/src/main.cpp b/src/main.cpp index 9ab034a9e..ce756468f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -78,7 +78,7 @@ using boost::scoped_ptr; #include -#ifdef HAVE_SPOTIFY +#ifdef HAVE_QCA #include #endif @@ -373,7 +373,7 @@ int main(int argc, char *argv[]) { } #endif -#ifdef HAVE_SPOTIFY +#ifdef HAVE_QCA QCA::Initializer qca_initializer; #endif diff --git a/src/translations/translations.pot b/src/translations/translations.pot index 8c86a9238..4dabbbb73 100644 --- a/src/translations/translations.pot +++ b/src/translations/translations.pot @@ -566,7 +566,7 @@ msgstr "" msgid "Always start playing" msgstr "" -#: internet/spotifyblobdownloader.cpp:55 +#: internet/spotifyblobdownloader.cpp:59 msgid "" "An additional plugin is required to use Spotify in Clementine. Would you " "like to download and install it now?" @@ -793,7 +793,7 @@ msgstr "" msgid "CUE sheet support" msgstr "" -#: internet/spotifyblobdownloader.cpp:39 +#: internet/spotifyblobdownloader.cpp:43 msgid "Cancel" msgstr "" @@ -1432,7 +1432,7 @@ msgstr "" msgid "Downloading Magnatune catalogue" msgstr "" -#: internet/spotifyblobdownloader.cpp:39 +#: internet/spotifyblobdownloader.cpp:43 msgid "Downloading Spotify plugin" msgstr "" @@ -1584,7 +1584,7 @@ msgstr "" msgid "Error deleting songs" msgstr "" -#: internet/spotifyblobdownloader.cpp:187 +#: internet/spotifyblobdownloader.cpp:193 msgid "Error downloading Spotify plugin" msgstr "" @@ -3696,7 +3696,7 @@ msgstr "" msgid "Spotify plugin" msgstr "" -#: internet/spotifyblobdownloader.cpp:54 +#: internet/spotifyblobdownloader.cpp:58 msgid "Spotify plugin not installed" msgstr ""