summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@nokia.com>2011-11-05 03:23:24 +0100
committerYoann Lopes <yoann.lopes@nokia.com>2011-11-05 03:23:24 +0100
commitbc7a27bc5d042009705045a7960609836a1a2cbb (patch)
treeabc01d9d2ac00b54b9c8a0c1601cd06c4ef27f55
parentdfb7c69141109b966785c4f167ee69451978457b (diff)
Switched to libspotify 10.v1.2.0
-rw-r--r--deployment.pri2
-rw-r--r--libQtSpotify/qspotifyartistbrowse.cpp15
-rw-r--r--libQtSpotify/qspotifysession.cpp31
-rw-r--r--libQtSpotify/qspotifysession.h14
-rw-r--r--libQtSpotify/qspotifytrack.cpp14
-rw-r--r--libQtSpotify/qspotifytrack.h22
-rw-r--r--libQtSpotify/qspotifyuser.cpp20
-rw-r--r--libQtSpotify/qspotifyuser.h16
-rw-r--r--qml/MainPage.qml4
-rwxr-xr-xqtc_packaging/debian_harmattan/rules2
10 files changed, 90 insertions, 50 deletions
diff --git a/deployment.pri b/deployment.pri
index c965f26..39104f5 100644
--- a/deployment.pri
+++ b/deployment.pri
@@ -102,7 +102,7 @@ symbian {
export(desktopfile.files)
export(desktopfile.path)
export(target.path)
- libspotify.files = $$PWD/libspotify/lib/libspotify.so.9
+ libspotify.files = $$PWD/libspotify/lib/libspotify.so.10
libspotify.path = /opt/MeeSpot/lib
export(libspotify.files)
export(libspotify.path)
diff --git a/libQtSpotify/qspotifyartistbrowse.cpp b/libQtSpotify/qspotifyartistbrowse.cpp
index 7fe77c5..4a66fe9 100644
--- a/libQtSpotify/qspotifyartistbrowse.cpp
+++ b/libQtSpotify/qspotifyartistbrowse.cpp
@@ -5,22 +5,22 @@
** Contact: Yoann Lopes (yoann.lopes@nokia.com)
**
** This file is part of the MeeSpot project.
-**
+**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
-**
+**
** Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
-**
+**
** Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
-**
+**
** Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the names of its
** contributors may be used to endorse or promote products derived from
** this software without specific prior written permission.
-**
+**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@@ -103,7 +103,10 @@ void QSpotifyArtistBrowse::setArtist(QSpotifyArtist *artist)
emit busyChanged();
QMutexLocker lock(&g_mutex);
- m_sp_artistbrowse = sp_artistbrowse_create(QSpotifySession::instance()->spsession(), m_artist->spartist(), callback_artistbrowse_complete, 0);
+ m_sp_artistbrowse = sp_artistbrowse_create(QSpotifySession::instance()->spsession(),
+ m_artist->spartist(),
+ SP_ARTISTBROWSE_NO_TRACKS,
+ callback_artistbrowse_complete, 0);
g_artistBrowseObjects.insert(m_sp_artistbrowse, this);
m_topHitsSearch.setQuery(QString(QLatin1String("artist:\"%1\"")).arg(m_artist->name()));
diff --git a/libQtSpotify/qspotifysession.cpp b/libQtSpotify/qspotifysession.cpp
index 3bca818..eab98bd 100644
--- a/libQtSpotify/qspotifysession.cpp
+++ b/libQtSpotify/qspotifysession.cpp
@@ -157,6 +157,23 @@ private:
sp_image *m_image;
};
+class QSpotifyOfflineErrorEvent : public QEvent
+{
+public:
+ QSpotifyOfflineErrorEvent(sp_error error, const QString &message)
+ : QEvent(Type(QEvent::User + 16))
+ , m_error(error)
+ , m_message(message)
+ { }
+
+ sp_error error() const { return m_error; }
+ QString message() const { return m_message; }
+
+private:
+ sp_error m_error;
+ QString m_message;
+};
+
class QSpotifyAudioThreadWorker : public QObject
{
@@ -415,6 +432,12 @@ static void callback_log_message(sp_session *, const char *data)
fprintf(stderr, data);
}
+static void callback_offline_error(sp_session *, sp_error error)
+{
+ if (error != SP_ERROR_OK)
+ QCoreApplication::postEvent(QSpotifySession::instance(), new QSpotifyOfflineErrorEvent(error, QString::fromUtf8(sp_error_message(error))));
+}
+
QSpotifySession::QSpotifySession()
: QObject(0)
, m_timerID(0)
@@ -479,6 +502,7 @@ void QSpotifySession::init()
m_sp_callbacks.stop_playback = 0;
m_sp_callbacks.get_audio_buffer_stats = 0;
m_sp_callbacks.offline_status_updated = 0;
+ m_sp_callbacks.offline_error = callback_offline_error;
m_sp_config.api_version = SPOTIFY_API_VERSION;
m_sp_config.cache_location = "/home/user/MyDocs/.meespot";
@@ -626,6 +650,13 @@ bool QSpotifySession::event(QEvent *e)
onLoggedOut();
e->accept();
return true;
+ } else if (e->type() == QEvent::User + 16) {
+ // Offline error
+ QSpotifyOfflineErrorEvent *ev = static_cast<QSpotifyOfflineErrorEvent *>(e);
+ m_offlineErrorMessage = ev->message();
+ emit offlineErrorMessageChanged();
+ e->accept();
+ return true;
}
return QObject::event(e);
}
diff --git a/libQtSpotify/qspotifysession.h b/libQtSpotify/qspotifysession.h
index d237827..9ba25d5 100644
--- a/libQtSpotify/qspotifysession.h
+++ b/libQtSpotify/qspotifysession.h
@@ -62,6 +62,7 @@ class QSpotifySession : public QObject
Q_PROPERTY(ConnectionStatus connectionStatus READ connectionStatus NOTIFY connectionStatusChanged)
Q_PROPERTY(ConnectionError connectionError READ connectionError NOTIFY connectionErrorChanged)
Q_PROPERTY(QString connectionErrorMessage READ connectionErrorMessage NOTIFY connectionErrorChanged)
+ Q_PROPERTY(QString offlineErrorMessage READ offlineErrorMessage NOTIFY offlineErrorMessageChanged)
Q_PROPERTY(bool pendingConnectionRequest READ pendingConnectionRequest NOTIFY pendingConnectionRequestChanged)
Q_PROPERTY(QSpotifyUser *user READ user NOTIFY userChanged)
Q_PROPERTY(QSpotifyTrack *currentTrack READ currentTrack NOTIFY currentTrackChanged)
@@ -79,6 +80,7 @@ class QSpotifySession : public QObject
Q_PROPERTY(bool syncOverMobile READ syncOverMobile WRITE setSyncOverMobile NOTIFY syncOverMobileChanged)
Q_ENUMS(ConnectionStatus)
Q_ENUMS(ConnectionError)
+ Q_ENUMS(OfflineError)
Q_ENUMS(StreamingQuality)
public:
enum ConnectionStatus {
@@ -100,6 +102,15 @@ public:
OtherPermanent = SP_ERROR_OTHER_PERMANENT
};
+ enum OfflineError {
+ TooManyTracks = SP_ERROR_OFFLINE_TOO_MANY_TRACKS,
+ DiskCache = SP_ERROR_OFFLINE_DISK_CACHE,
+ Expired = SP_ERROR_OFFLINE_EXPIRED,
+ NotAllowed = SP_ERROR_OFFLINE_NOT_ALLOWED,
+ LicenseLost = SP_ERROR_OFFLINE_LICENSE_LOST,
+ LicenseError = SP_ERROR_OFFLINE_LICENSE_ERROR
+ };
+
enum StreamingQuality {
Unknown = -1,
LowQuality = SP_BITRATE_96k,
@@ -134,6 +145,7 @@ public:
void setConnectionError(ConnectionError error, const QString &message);
QString connectionErrorMessage() const { return m_connectionErrorMessage; }
+ QString offlineErrorMessage() const { return m_offlineErrorMessage; }
bool pendingConnectionRequest() const { return m_pending_connectionRequest; }
@@ -202,6 +214,7 @@ Q_SIGNALS:
void offlineModeChanged();
void syncOverMobileChanged();
void isLoggedInChanged();
+ void offlineErrorMessageChanged();
protected:
bool event(QEvent *);
@@ -243,6 +256,7 @@ private:
ConnectionError m_connectionError;
ConnectionRules m_connectionRules;
QString m_connectionErrorMessage;
+ QString m_offlineErrorMessage;
StreamingQuality m_streamingQuality;
StreamingQuality m_syncQuality;
bool m_syncOverMobile;
diff --git a/libQtSpotify/qspotifytrack.cpp b/libQtSpotify/qspotifytrack.cpp
index edee623..a95c6b1 100644
--- a/libQtSpotify/qspotifytrack.cpp
+++ b/libQtSpotify/qspotifytrack.cpp
@@ -68,7 +68,7 @@ QSpotifyTrack::QSpotifyTrack(sp_track *track, QSpotifyPlaylist *playlist)
{
sp_track_add_ref(track);
m_sp_track = track;
- m_error = Error(sp_track_error(m_sp_track));
+ m_error = TrackError(sp_track_error(m_sp_track));
connect(QSpotifySession::instance(), SIGNAL(currentTrackChanged()), this, SLOT(onSessionCurrentTrackChanged()));
connect(this, SIGNAL(dataChanged()), this, SIGNAL(trackDataChanged()));
@@ -94,7 +94,7 @@ QSpotifyTrack::QSpotifyTrack(sp_track *track, QSpotifyTrackList *tracklist)
{
sp_track_add_ref(track);
m_sp_track = track;
- m_error = Error(sp_track_error(m_sp_track));
+ m_error = TrackError(sp_track_error(m_sp_track));
connect(QSpotifySession::instance(), SIGNAL(currentTrackChanged()), this, SLOT(onSessionCurrentTrackChanged()));
connect(this, SIGNAL(dataChanged()), this, SIGNAL(trackDataChanged()));
@@ -119,7 +119,7 @@ bool QSpotifyTrack::updateData()
{
bool updated = false;
- Error error = Error(sp_track_error(m_sp_track));
+ TrackError error = TrackError(sp_track_error(m_sp_track));
if (m_error != error) {
m_error = error;
updated = true;
@@ -130,7 +130,7 @@ bool QSpotifyTrack::updateData()
int discNumber = sp_track_disc(m_sp_track);
int duration = sp_track_duration(m_sp_track);
int discIndex = sp_track_index(m_sp_track);
- bool isAvailable = sp_track_is_available(QSpotifySession::instance()->m_sp_session, m_sp_track);
+ bool isAvailable = sp_track_get_availability(QSpotifySession::instance()->m_sp_session, m_sp_track) == SP_TRACK_AVAILABILITY_AVAILABLE;
int numArtists = sp_track_num_artists(m_sp_track);
int popularity = sp_track_popularity(m_sp_track);
OfflineStatus offlineSt = OfflineStatus(sp_track_offline_get_status(m_sp_track));
@@ -322,16 +322,16 @@ void QSpotifyTrack::setSeen(bool s)
bool QSpotifyTrack::isAvailableOffline() const
{
- return m_offlineStatus == Yes;
+ return m_offlineStatus == Yes || m_offlineStatus == DoneResync;
}
bool QSpotifyTrack::isAvailable() const
{
- return m_isAvailable && (!QSpotifySession::instance()->offlineMode() || m_offlineStatus == Yes);
+ return m_isAvailable && (!QSpotifySession::instance()->offlineMode() || isAvailableOffline());
}
void QSpotifyTrack::onSessionOfflineModeChanged()
{
- if (m_offlineStatus != Yes)
+ if (!isAvailableOffline())
emit isAvailableChanged();
}
diff --git a/libQtSpotify/qspotifytrack.h b/libQtSpotify/qspotifytrack.h
index 8034abb..f9ceb98 100644
--- a/libQtSpotify/qspotifytrack.h
+++ b/libQtSpotify/qspotifytrack.h
@@ -62,7 +62,7 @@ class QSpotifyTrack : public QSpotifyObject
Q_PROPERTY(int discNumber READ discNumber NOTIFY trackDataChanged)
Q_PROPERTY(QString duration READ durationString NOTIFY trackDataChanged)
Q_PROPERTY(int durationMs READ duration NOTIFY trackDataChanged)
- Q_PROPERTY(Error error READ error NOTIFY trackDataChanged)
+ Q_PROPERTY(TrackError error READ error NOTIFY trackDataChanged)
Q_PROPERTY(int discIndex READ discIndex NOTIFY trackDataChanged)
Q_PROPERTY(bool isAvailable READ isAvailable NOTIFY isAvailableChanged)
Q_PROPERTY(bool isStarred READ isStarred WRITE setIsStarred NOTIFY isStarredChanged)
@@ -74,20 +74,24 @@ class QSpotifyTrack : public QSpotifyObject
Q_PROPERTY(QSpotifyAlbum *albumObject READ albumObject NOTIFY trackDataChanged)
Q_PROPERTY(QSpotifyArtist *artistObject READ artistObject NOTIFY trackDataChanged)
Q_PROPERTY(OfflineStatus offlineStatus READ offlineStatus NOTIFY offlineStatusChanged)
- Q_ENUMS(Error)
+ Q_ENUMS(TrackError)
Q_ENUMS(OfflineStatus)
public:
- enum Error {
+ enum TrackError {
Ok = SP_ERROR_OK,
IsLoading = SP_ERROR_IS_LOADING,
OtherPermanent = SP_ERROR_OTHER_PERMANENT
};
enum OfflineStatus {
- No = 0,
- Waiting = 1,
- Downloading = 2,
- Yes = 3
+ No = SP_TRACK_OFFLINE_NO,
+ Waiting = SP_TRACK_OFFLINE_WAITING,
+ Downloading = SP_TRACK_OFFLINE_DOWNLOADING,
+ Yes = SP_TRACK_OFFLINE_DONE,
+ Error = SP_TRACK_OFFLINE_ERROR,
+ DoneExpired = SP_TRACK_OFFLINE_DONE_EXPIRED,
+ LimitExceeded = SP_TRACK_OFFLINE_LIMIT_EXCEEDED,
+ DoneResync = SP_TRACK_OFFLINE_DONE_RESYNC
};
~QSpotifyTrack();
@@ -101,7 +105,7 @@ public:
int discNumber() const { return m_discNumber; }
int duration() const { return m_duration; }
QString durationString() const { return m_durationString; }
- Error error() const { return m_error; }
+ TrackError error() const { return m_error; }
int discIndex() const { return m_discIndex; }
bool isAvailable() const;
bool isStarred() const;
@@ -165,7 +169,7 @@ private:
int m_discNumber;
int m_duration;
QString m_durationString;
- Error m_error;
+ TrackError m_error;
int m_discIndex;
bool m_isAvailable;
QString m_name;
diff --git a/libQtSpotify/qspotifyuser.cpp b/libQtSpotify/qspotifyuser.cpp
index dc5fd62..32502dd 100644
--- a/libQtSpotify/qspotifyuser.cpp
+++ b/libQtSpotify/qspotifyuser.cpp
@@ -5,22 +5,22 @@
** Contact: Yoann Lopes (yoann.lopes@nokia.com)
**
** This file is part of the MeeSpot project.
-**
+**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
-**
+**
** Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
-**
+**
** Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
-**
+**
** Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the names of its
** contributors may be used to endorse or promote products derived from
** this software without specific prior written permission.
-**
+**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@@ -79,8 +79,6 @@ bool QSpotifyUser::updateData()
{
QString canonicalName = QString::fromUtf8(sp_user_canonical_name(m_sp_user));
QString displayName = QString::fromUtf8(sp_user_display_name(m_sp_user));
- QString fullName = QString::fromUtf8(sp_user_full_name(m_sp_user));
- QString picture = QString::fromUtf8(sp_user_picture(m_sp_user));
bool updated = false;
if (m_canonicalName != canonicalName) {
@@ -91,14 +89,6 @@ bool QSpotifyUser::updateData()
m_displayName = displayName;
updated = true;
}
- if (m_fullName != fullName) {
- m_fullName = fullName;
- updated = true;
- }
- if (m_picture != picture) {
- m_picture = picture;
- updated = true;
- }
return updated;
}
diff --git a/libQtSpotify/qspotifyuser.h b/libQtSpotify/qspotifyuser.h
index 947918b..ca73ba9 100644
--- a/libQtSpotify/qspotifyuser.h
+++ b/libQtSpotify/qspotifyuser.h
@@ -5,22 +5,22 @@
** Contact: Yoann Lopes (yoann.lopes@nokia.com)
**
** This file is part of the MeeSpot project.
-**
+**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
-**
+**
** Redistributions of source code must retain the above copyright notice,
** this list of conditions and the following disclaimer.
-**
+**
** Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
-**
+**
** Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the names of its
** contributors may be used to endorse or promote products derived from
** this software without specific prior written permission.
-**
+**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@@ -55,8 +55,6 @@ class QSpotifyUser : public QSpotifyObject
Q_OBJECT
Q_PROPERTY(QString canonicalName READ canonicalName NOTIFY userDataChanged)
Q_PROPERTY(QString displayName READ displayName NOTIFY userDataChanged)
- Q_PROPERTY(QString fullName READ fullName NOTIFY userDataChanged)
- Q_PROPERTY(QString picture READ picture NOTIFY userDataChanged)
Q_PROPERTY(QList<QObject *> playlists READ playlistsAsQObject NOTIFY playlistsChanged)
public:
~QSpotifyUser();
@@ -65,8 +63,6 @@ public:
QString canonicalName() const { return m_canonicalName; }
QString displayName() const { return m_displayName; }
- QString fullName() const { return m_fullName; }
- QString picture() const { return m_picture; }
QSpotifyPlaylistContainer *playlistContainer() const;
QSpotifyPlaylist *starredList() const;
@@ -96,8 +92,6 @@ private:
QString m_canonicalName;
QString m_displayName;
- QString m_fullName;
- QString m_picture;
mutable QSpotifyPlaylistContainer *m_playlistContainer;
mutable QSpotifyPlaylist *m_starredList;
diff --git a/qml/MainPage.qml b/qml/MainPage.qml
index 418d749..3c8e8f3 100644
--- a/qml/MainPage.qml
+++ b/qml/MainPage.qml
@@ -102,6 +102,10 @@ Page {
errorBanner.show();
}
}
+ onOfflineErrorMessageChanged: {
+ errorBanner.text = spotifySession.offlineErrorMessage;
+ errorBanner.show();
+ }
onPlayTokenLost: {
if (spotifySession.isPlaying) {
errorBanner.text = "Playback has been paused because your account is used somewhere else";
diff --git a/qtc_packaging/debian_harmattan/rules b/qtc_packaging/debian_harmattan/rules
index 0b5de12..8400a00 100755
--- a/qtc_packaging/debian_harmattan/rules
+++ b/qtc_packaging/debian_harmattan/rules
@@ -50,7 +50,7 @@ install: build
# Add here commands to install the package into debian/meespot.
$(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/meespot install
- chmod +x $(CURDIR)/debian/meespot/opt/MeeSpot/lib/libspotify.so.9
+ chmod +x $(CURDIR)/debian/meespot/opt/MeeSpot/lib/libspotify.so.10
# Build architecture-independent files here.