Hello community, here is the log from the commit of package juk for openSUSE:13.1 checked in at 2013-10-03 15:49:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:13.1/juk (Old) and /work/SRC/openSUSE:13.1/.juk.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "juk" Changes: -------- --- /work/SRC/openSUSE:13.1/juk/juk.changes 2013-09-23 10:54:36.000000000 +0200 +++ /work/SRC/openSUSE:13.1/.juk.new/juk.changes 2013-10-03 15:49:32.000000000 +0200 @@ -1,0 +2,7 @@ +Sat Sep 28 15:15:00 UTC 2013 - [email protected] + +- Update to 4.11.2 + * KDE 4.11.2 bugfix release + * See http://www.kde.org/announcements/announce-4.11.2.php + +------------------------------------------------------------------- Old: ---- juk-4.11.1.tar.xz New: ---- juk-4.11.2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ juk.spec ++++++ --- /var/tmp/diff_new_pack.ay8Uhd/_old 2013-10-03 15:49:32.000000000 +0200 +++ /var/tmp/diff_new_pack.ay8Uhd/_new 2013-10-03 15:49:32.000000000 +0200 @@ -25,7 +25,7 @@ License: GPL-2.0+ Group: Productivity/Multimedia/Sound/Players Url: http://www.kde.org -Version: 4.11.1 +Version: 4.11.2 Release: 0 Source0: %{name}-%{version}.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ juk-4.11.1.tar.xz -> juk-4.11.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.11.1/juk.cpp new/juk-4.11.2/juk.cpp --- old/juk-4.11.1/juk.cpp 2013-08-28 19:09:48.000000000 +0200 +++ new/juk-4.11.2/juk.cpp 2013-09-26 21:25:39.000000000 +0200 @@ -50,6 +50,7 @@ #include "keydialog.h" #include "tagguesserconfigdlg.h" #include "filerenamerconfigdlg.h" +#include "scrobbler.h" #include "scrobbleconfigdlg.h" #include "actioncollection.h" #include "cache.h" @@ -79,6 +80,7 @@ m_statusLabel(0), m_systemTray(0), m_player(new PlayerManager), + m_scrobbler(0), m_shuttingDown(false) { // Expect segfaults if you change this order. @@ -97,7 +99,6 @@ setupActions(); setupLayout(); - bool firstRun = !KGlobal::config()->hasGroup("MainWindow"); if(firstRun) { @@ -124,6 +125,7 @@ connect(m_splitter, SIGNAL(guiReady()), SLOT(slotSetupSystemTray())); readConfig(); setupGlobalAccels(); + activateScrobblerIfEnabled(); connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), SLOT(slotAboutToQuit())); @@ -321,9 +323,9 @@ act = collection->addAction("fileRenamerConfig", this, SLOT(slotConfigureFileRenamer())); act->setText(i18n("&File Renamer...")); - + act = collection->addAction("scrobblerConfig", this, SLOT(slotConfigureScrobbling())); - act->setText(i18n("&Configure scrobbling...")); + act->setText(i18n("&Configure scrobbling...")); ////////////////////////////////////////////////// // just in the toolbar @@ -606,8 +608,23 @@ void JuK::slotConfigureScrobbling() { ScrobbleConfigDlg(this).exec(); + activateScrobblerIfEnabled(); } +void JuK::activateScrobblerIfEnabled() +{ + bool isScrobbling = Scrobbler::isScrobblingEnabled(); + + if (!m_scrobbler && isScrobbling) { + m_scrobbler = new Scrobbler(this); + connect (m_player, SIGNAL(signalItemChanged(FileHandle)), + m_scrobbler, SLOT(nowPlaying(FileHandle))); + } + else if (m_scrobbler && !isScrobbling) { + delete m_scrobbler; + m_scrobbler = 0; + } +} void JuK::slotUndo() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.11.1/juk.h new/juk-4.11.2/juk.h --- old/juk-4.11.1/juk.h 2013-08-28 19:09:48.000000000 +0200 +++ new/juk-4.11.2/juk.h 2013-09-26 21:25:39.000000000 +0200 @@ -30,6 +30,7 @@ class SystemTray; class PlayerManager; class PlaylistSplitter; +class Scrobbler; class JuK : public KXmlGuiWindow { @@ -53,6 +54,8 @@ void keyPressEvent(QKeyEvent *); + void activateScrobblerIfEnabled(); + /** * readSettings() is separate from readConfig() in that it contains settings * that need to be read before the GUI is setup. @@ -91,6 +94,7 @@ KToggleAction *m_toggleSplashAction; PlayerManager *m_player; + Scrobbler *m_scrobbler; bool m_startDocked; bool m_showSplash; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.11.1/main.cpp new/juk-4.11.2/main.cpp --- old/juk-4.11.1/main.cpp 2013-08-28 19:09:48.000000000 +0200 +++ new/juk-4.11.2/main.cpp 2013-09-26 21:25:39.000000000 +0200 @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { KAboutData aboutData("juk", 0, ki18n("JuK"), - "3.10", ki18n(description), KAboutData::License_GPL, + "3.10.1", ki18n(description), KAboutData::License_GPL, ki18n("© 2002–2013, Scott Wheeler, Michael Pyne, and others"), KLocalizedString(), "http://www.kde.org/applications/multimedia/juk/"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.11.1/playermanager.cpp new/juk-4.11.2/playermanager.cpp --- old/juk-4.11.1/playermanager.cpp 2013-06-28 19:40:30.000000000 +0200 +++ new/juk-4.11.2/playermanager.cpp 2013-09-26 21:25:39.000000000 +0200 @@ -71,10 +71,6 @@ // later, just disable it here. -- mpyne // setup(); new PlayerAdaptor( this ); - - - m_scrobbler = new Scrobbler(this); - connect(this, SIGNAL(signalItemChanged(FileHandle)), m_scrobbler, SLOT(nowPlaying(FileHandle))); } PlayerManager::~PlayerManager() @@ -432,7 +428,6 @@ void PlayerManager::slotNeedNextUrl() { - m_scrobbler->scrobble(); if(m_file.isNull() || !m_crossfadeTracks) return; @@ -537,7 +532,7 @@ QTimer::singleShot(2000, this, SLOT(slotUpdateGuiIfStopped())); JuK::JuKInstance()->setWindowTitle(i18n("JuK")); - + emit signalStop(); } else if(newstate == Phonon::PlayingState) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.11.1/playermanager.h new/juk-4.11.2/playermanager.h --- old/juk-4.11.1/playermanager.h 2013-06-28 19:40:30.000000000 +0200 +++ new/juk-4.11.2/playermanager.h 2013-09-26 21:25:39.000000000 +0200 @@ -29,7 +29,6 @@ #include <Phonon/Global> #include <Phonon/Path> -class Scrobbler; class KSelectAction; class StatusLabel; class PlaylistInterface; @@ -143,7 +142,6 @@ FileHandle m_file; PlaylistInterface *m_playlistInterface; StatusLabel *m_statusLabel; - Scrobbler *m_scrobbler; bool m_muted; bool m_setup; bool m_crossfadeTracks; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.11.1/scrobbler.cpp new/juk-4.11.2/scrobbler.cpp --- old/juk-4.11.1/scrobbler.cpp 2013-08-28 19:09:48.000000000 +0200 +++ new/juk-4.11.2/scrobbler.cpp 2013-09-26 21:25:39.000000000 +0200 @@ -33,7 +33,6 @@ Scrobbler::Scrobbler(QObject* parent) : QObject(parent) - , m_startedPlaying(0) , m_networkAccessManager(0) { KConfigGroup config(KGlobal::config(), "Scrobbling"); @@ -49,6 +48,17 @@ { } +bool Scrobbler::isScrobblingEnabled() +{ + KConfigGroup config(KGlobal::config(), "Scrobbling"); + + // TODO: use kwallet + QString username = config.readEntry("Username", ""); + QString password = config.readEntry("Password", ""); + + return (!username.isEmpty() && !password.isEmpty()); +} + QByteArray Scrobbler::md5(QByteArray data) { return QCryptographicHash::hash(data, QCryptographicHash::Md5) @@ -153,6 +163,10 @@ return; } + if (!m_file.isNull()) { + scrobble(); // Update time-played info for last track + } + QMap<QString, QString> params; params["method"] = "track.updateNowPlaying"; params["sk"] = sessionKey; @@ -165,8 +179,8 @@ sign(params); post(params); - m_file = file; - m_startedPlaying = QDateTime::currentMSecsSinceEpoch() / 1000; + m_file = file; // May be FileHandle::null() + m_playbackTimer = QDateTime::currentDateTime(); } void Scrobbler::scrobble() @@ -181,6 +195,13 @@ return; } + int halfDuration = m_file.tag()->seconds() / 2; + int timeElapsed = m_playbackTimer.secsTo(QDateTime::currentDateTime()); + + if (timeElapsed < 30 || timeElapsed < halfDuration) { + return; // API says not to scrobble if the user didn't play long enough + } + kDebug() << "Scrobbling" << m_file.tag()->title(); QMap<QString, QString> params; @@ -189,7 +210,7 @@ params["track"] = m_file.tag()->title(); params["artist"] = m_file.tag()->artist(); params["album"] = m_file.tag()->album(); - params["timestamp"] = QString::number(m_startedPlaying); + params["timestamp"] = QString::number(m_playbackTimer.toTime_t()); params["trackNumber"] = QString::number(m_file.tag()->track()); params["duration"] = QString::number(m_file.tag()->seconds()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/juk-4.11.1/scrobbler.h new/juk-4.11.2/scrobbler.h --- old/juk-4.11.1/scrobbler.h 2013-06-28 19:40:30.000000000 +0200 +++ new/juk-4.11.2/scrobbler.h 2013-09-26 21:25:39.000000000 +0200 @@ -18,6 +18,7 @@ #include <QObject> #include <QMap> +#include <QDateTime> #include "filehandle.h" @@ -33,6 +34,8 @@ explicit Scrobbler(QObject* parent = 0); virtual ~Scrobbler(); + static bool isScrobblingEnabled(); + public slots: void nowPlaying(const FileHandle&); void scrobble(); @@ -52,7 +55,7 @@ void post(QMap<QString, QString> &request); QByteArray md5(QByteArray data); - qint64 m_startedPlaying; + QDateTime m_playbackTimer; FileHandle m_file; QNetworkAccessManager *m_networkAccessManager; }; -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
