core: send start index when playing on remote session

This commit is contained in:
Chris Josten 2023-01-05 15:53:52 +01:00
parent 7a7ddc7717
commit 3783de9ce7
5 changed files with 177 additions and 2 deletions

View File

@ -27728,6 +27728,33 @@ public:
void setPlayCommand(PlayCommand newPlayCommand);
/**
* @brief Optional. The index of the audio stream to play.
*/
const qint32 &audioStreamIndex() const;
void setAudioStreamIndex(qint32 newAudioStreamIndex);
bool audioStreamIndexNull() const;
void setAudioStreamIndexNull();
/**
* @brief Optional. The media source id.
*/
const QString &mediaSourceId() const;
void setMediaSourceId(QString newMediaSourceId);
bool mediaSourceIdNull() const;
void setMediaSourceIdNull();
/**
* @brief Optional. The start index.
*/
const qint32 &startIndex() const;
void setStartIndex(qint32 newStartIndex);
bool startIndexNull() const;
void setStartIndexNull();
/**
* @brief The starting position of the first item.
*/
@ -27737,6 +27764,15 @@ public:
void setStartPositionTicksNull();
/**
* @brief Optional. The index of the subtitle stream to play.
*/
const qint32 &subtitleStreamIndex() const;
void setSubtitleStreamIndex(qint32 newSubtitleStreamIndex);
bool subtitleStreamIndexNull() const;
void setSubtitleStreamIndexNull();
private:
// Required path parameters
QString m_sessionId;
@ -27746,7 +27782,11 @@ private:
PlayCommand m_playCommand;
// Optional query parameters
std::optional<qint32> m_audioStreamIndex = std::nullopt;
QString m_mediaSourceId;
std::optional<qint32> m_startIndex = std::nullopt;
std::optional<qint64> m_startPositionTicks = std::nullopt;
std::optional<qint32> m_subtitleStreamIndex = std::nullopt;
};

View File

@ -34508,6 +34508,41 @@
"format": "int64",
"nullable": true
}
},
{
"name": "mediaSourceId",
"in": "query",
"description": "Optional. The media source id.",
"schema": {
"type": "string"
}
},
{
"name": "audioStreamIndex",
"in": "query",
"description": "Optional. The index of the audio stream to play.",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "subtitleStreamIndex",
"in": "query",
"description": "Optional. The index of the subtitle stream to play.",
"schema": {
"type": "integer",
"format": "int32"
}
},
{
"name": "startIndex",
"in": "query",
"description": "Optional. The start index.",
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"responses": {
@ -55377,4 +55412,4 @@
}
}
}
}
}

View File

@ -245,6 +245,18 @@ QUrlQuery PlayLoader::query(const PlayParams &params) const {
if (!params.startPositionTicksNull()) {
result.addQueryItem("startPositionTicks", Support::toString<std::optional<qint64>>(params.startPositionTicks()));
}
if (!params.mediaSourceIdNull()) {
result.addQueryItem("mediaSourceId", Support::toString<QString>(params.mediaSourceId()));
}
if (!params.audioStreamIndexNull()) {
result.addQueryItem("audioStreamIndex", Support::toString<std::optional<qint32>>(params.audioStreamIndex()));
}
if (!params.subtitleStreamIndexNull()) {
result.addQueryItem("subtitleStreamIndex", Support::toString<std::optional<qint32>>(params.subtitleStreamIndex()));
}
if (!params.startIndexNull()) {
result.addQueryItem("startIndex", Support::toString<std::optional<qint32>>(params.startIndex()));
}
return result;
}

View File

@ -47966,6 +47966,69 @@ void PlayParams::setPlayCommand(PlayCommand newPlayCommand) {
}
const qint32 &PlayParams::audioStreamIndex() const {
return m_audioStreamIndex.value();
}
void PlayParams::setAudioStreamIndex(qint32 newAudioStreamIndex) {
m_audioStreamIndex = newAudioStreamIndex;
}
bool PlayParams::audioStreamIndexNull() const {
// Nullable: true
// Type Nullable: false
return !m_audioStreamIndex.has_value();
}
void PlayParams::setAudioStreamIndexNull() {
m_audioStreamIndex = std::nullopt;
}
const QString &PlayParams::mediaSourceId() const {
return m_mediaSourceId;
}
void PlayParams::setMediaSourceId(QString newMediaSourceId) {
m_mediaSourceId = newMediaSourceId;
}
bool PlayParams::mediaSourceIdNull() const {
// Nullable: true
// Type Nullable: true
return m_mediaSourceId.isNull();
}
void PlayParams::setMediaSourceIdNull() {
m_mediaSourceId.clear();
}
const qint32 &PlayParams::startIndex() const {
return m_startIndex.value();
}
void PlayParams::setStartIndex(qint32 newStartIndex) {
m_startIndex = newStartIndex;
}
bool PlayParams::startIndexNull() const {
// Nullable: true
// Type Nullable: false
return !m_startIndex.has_value();
}
void PlayParams::setStartIndexNull() {
m_startIndex = std::nullopt;
}
const qint64 &PlayParams::startPositionTicks() const {
return m_startPositionTicks.value();
}
@ -47987,6 +48050,27 @@ void PlayParams::setStartPositionTicksNull() {
}
const qint32 &PlayParams::subtitleStreamIndex() const {
return m_subtitleStreamIndex.value();
}
void PlayParams::setSubtitleStreamIndex(qint32 newSubtitleStreamIndex) {
m_subtitleStreamIndex = newSubtitleStreamIndex;
}
bool PlayParams::subtitleStreamIndexNull() const {
// Nullable: true
// Type Nullable: false
return !m_subtitleStreamIndex.has_value();
}
void PlayParams::setSubtitleStreamIndexNull() {
m_subtitleStreamIndex = std::nullopt;
}
// PostParams

View File

@ -243,7 +243,11 @@ void RemoteJellyfinPlayback::playItemInList(const QStringList &items, int index,
}
params.setPlayCommand(DTO::PlayCommand::PlayNow);
params.setItemIds(items);
//params.setStartIndex(index);
params.setStartIndex(index);
params.setAudioStreamIndex(this->audioIndex());
if (this->subtitleIndex() >= 0) {
params.setSubtitleStreamIndex(this->subtitleIndex());
}
CommandLoader *loader = new CommandLoader(&m_apiClient);
loader->setParameters(params);