diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2011-10-21 20:15:55 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@nokia.com> | 2011-10-21 20:15:55 +0200 |
commit | 93cd0000421b4dabfec5a967606be42980f9e02f (patch) | |
tree | e482ef6d673fd6b06c175367929897a000b2e047 /libQtSpotify | |
parent | e0023bb2150215607cc6fa63b654c753e417d6d3 (diff) |
Set the spotify cache limit to most of the drive space.
Diffstat (limited to 'libQtSpotify')
-rw-r--r-- | libQtSpotify/libQtSpotify.pri | 2 | ||||
-rw-r--r-- | libQtSpotify/qspotifysession.cpp | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/libQtSpotify/libQtSpotify.pri b/libQtSpotify/libQtSpotify.pri index 7358fab..ef8ed16 100644 --- a/libQtSpotify/libQtSpotify.pri +++ b/libQtSpotify/libQtSpotify.pri @@ -1,7 +1,7 @@ QT += network CONFIG += mobility -MOBILITY += multimedia +MOBILITY += multimedia systeminfo INCLUDEPATH += $$PWD diff --git a/libQtSpotify/qspotifysession.cpp b/libQtSpotify/qspotifysession.cpp index ea4cfc6..b4a2731 100644 --- a/libQtSpotify/qspotifysession.cpp +++ b/libQtSpotify/qspotifysession.cpp @@ -58,6 +58,7 @@ #include <QtCore/QDebug> #include <QtGui/QDesktopServices> #include <QtNetwork/QNetworkConfigurationManager> +#include <QtSystemInfo/QSystemStorageInfo> #define BUFFER_SIZE 409600 #define AUDIOSTREAM_UPDATE_INTERVAL 20 @@ -281,7 +282,6 @@ void QSpotifyAudioThreadWorker::startStreaming(int channels, int sampleRate) m_audioOutput = new QAudioOutput(af); m_audioOutput->setBufferSize(BUFFER_SIZE); - qDebug() << m_audioOutput->bufferSize(); m_iodevice = m_audioOutput->start(); m_audioOutput->suspend(); m_audioTimerID = startTimer(AUDIOSTREAM_UPDATE_INTERVAL); @@ -491,7 +491,11 @@ void QSpotifySession::init() fprintf(stderr, "failed to create session: %s\n", sp_error_message(error)); } else { - QSettings settings; + QtMobility::QSystemStorageInfo storageInfo; + qlonglong totalSpace = storageInfo.totalDiskSpace(QString::fromLatin1(m_sp_config.cache_location)); + sp_session_set_cache_size(m_sp_session, totalSpace / 1000000 - 1000); + + QSettings settings; // Remove stored login information from older version of MeeSpot if (settings.contains("username")) { |