Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Commit

Permalink
MPRIS seeks command specifies an offset from current position.
Browse files Browse the repository at this point in the history
Closes #1417
  • Loading branch information
CDrummond committed Dec 9, 2018
1 parent 67cbf7b commit 7cc3e3c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
25. When copying tracks to a device, only update cache if configured to do so.
26. Fix MusicBrainz disc ID calculation.
27. When loading URLs via commandline use AppendAndPlay.
28. MPRIS seeks command specifies an offset from current position.

2.3.2
-----
Expand Down
1 change: 1 addition & 0 deletions dbus/mpris.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Mpris::Mpris(QObject *p)
connect(this, SIGNAL(setRandom(bool)), MPDConnection::self(), SLOT(setRandom(bool)));
connect(this, SIGNAL(setRepeat(bool)), MPDConnection::self(), SLOT(setRepeat(bool)));
connect(this, SIGNAL(setSeekId(qint32, quint32)), MPDConnection::self(), SLOT(setSeekId(qint32, quint32)));
connect(this, SIGNAL(seek(qint32)), MPDConnection::self(), SLOT(seek(qint32)));
connect(this, SIGNAL(setVolume(int)), MPDConnection::self(), SLOT(setVolume(int)));

// connect(MPDConnection::self(), SIGNAL(currentSongUpdated(const Song &)), this, SLOT(updateCurrentSong(const Song &)));
Expand Down
3 changes: 2 additions & 1 deletion dbus/mpris.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Mpris : public QObject
void Stop() { StdActions::self()->stopPlaybackAction->trigger(); }
void StopAfterCurrent() { StdActions::self()->stopAfterCurrentTrackAction->trigger(); }
void Play();
void Seek(qlonglong pos) { emit setSeekId(-1, pos/1000000); }
void Seek(qlonglong pos) { emit seek(pos/1000000); }
void SetPosition(const QDBusObjectPath &trackId, qlonglong pos);
void OpenUri(const QString &) { }
QString PlaybackStatus() const;
Expand Down Expand Up @@ -120,6 +120,7 @@ public Q_SLOTS:
void setRandom(bool toggle);
void setRepeat(bool toggle);
void setSeekId(qint32 songId, quint32 time);
void seek(qint32 offset);
void setVolume(int vol);

void showMainWindow();
Expand Down
10 changes: 6 additions & 4 deletions mpd-interface/mpdconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1289,12 +1289,14 @@ void MPDConnection::playFirstTrack(bool emitErrors)
sendCommand("play 0", emitErrors);
}

void MPDConnection::seek()
void MPDConnection::seek(qint32 offset)
{
QObject *s=sender();
int offset=s ? s->property("offset").toInt() : 0;
if (0==offset) {
return;
QObject *s=sender();
offset=s ? s->property("offset").toInt() : 0;
if (0==offset) {
return;
}
}
toggleStopAfterCurrent(false);
Response response=sendCommand("status");
Expand Down
2 changes: 1 addition & 1 deletion mpd-interface/mpdconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public Q_SLOTS:
void setRating(const QStringList &files, quint8 val);
void getRating(const QString &file);

void seek();
void seek(qint32 offset=0);

Q_SIGNALS:
void connectionChanged(const MPDConnectionDetails &details);
Expand Down

0 comments on commit 7cc3e3c

Please sign in to comment.