1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2025-09-04 01:42:44 +00:00

core/RemoteJellyfinPlaybackManager: keep queue in sync

The playback queue is now kept in sync with the playback queue of the
remote jellyfin instance the manager is controlling.

Some additional guards were added in place in the shuffle and playlist
algorithm, since the situation can occur where the now playing index
falls outside of the playing playlist. This happens because when the
an playlist update is received, we need to do another HTTP request
before we know which items are in the queue, while the now playing index
has been updated.

This is a not-optimal way to fix that, but it works well enough for now
and a better solution can be implemented later. (Hello, person in the
future reading the git blame output!)
This commit is contained in:
Chris Josten 2024-01-02 00:19:13 +01:00
parent 61a7eaf52e
commit 6ed623d0f8
7 changed files with 114 additions and 10 deletions

View file

@ -131,6 +131,7 @@ public:
static const qint64 MS_TICK_FACTOR = 10000;
protected:
void setItem(QSharedPointer<Item> item);
void setQueueIndex(int index);
signals:
void playbackStateChanged(Jellyfin::Model::PlayerStateClass::Value newPlaybackState);

View file

@ -75,6 +75,17 @@ private:
void sendGeneralCommand(DTO::GeneralCommandType command, QJsonObject arguments = QJsonObject());
void sendCommand(Support::LoaderBase *loader);
void playItemInList(const QStringList &items, int index, qint64 resumeTicks = -1);
/**
* @brief isQueueSame Checks if the items in the list are the same as in the queue
* @param items The item ids to compare to the queue
* @return True if the same, otherwise false
*/
bool isQueueSame(QList<QueueItem> itemIds);
/**
* Updates the now playing queue, with the given items
* @param itemIds The item ids to load
*/
void updateQueue(QList<QueueItem> itemIds);
ApiClient &m_apiClient;
QString m_sessionId;
std::optional<DTO::SessionInfo> m_lastSessionInfo;