mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-06 02:32:44 +00:00
[3/3] update openapi spec: update code interacting with generated code
Adjusted C++ code to handle with new and renamed objects, as well as properties with different types. As a result of changing types, the QML side had to be updated as well. I hope I found everything by manually testing. Additionally, the Qt Quick application has been updated to test the remote sessions more easily and to make it launch again.
This commit is contained in:
parent
9e1a20cd3a
commit
0c72906f88
39 changed files with 366 additions and 317 deletions
|
@ -430,15 +430,15 @@ void ApiClient::authenticate(QString username, QString password, bool storeCrede
|
|||
}
|
||||
|
||||
void ApiClient::submitQuickConnectCode(const QString &code) {
|
||||
using QQAuthorizeLoader = Loader::HTTP::AuthorizeLoader;
|
||||
Loader::AuthorizeParams params;
|
||||
using QQAuthorizeLoader = Loader::HTTP::AuthorizeQuickConnectLoader;
|
||||
Loader::AuthorizeQuickConnectParams params;
|
||||
params.setCode(code);
|
||||
|
||||
QQAuthorizeLoader *loader = new QQAuthorizeLoader(this);
|
||||
loader->setParameters(params);
|
||||
loader->load();
|
||||
|
||||
loader->connect(loader, &QQAuthorizeLoader::error, this, [this, loader](QString message) {
|
||||
loader->connect(loader, &QQAuthorizeLoader::error, this, [this, loader](const QString &message) {
|
||||
qDebug() << "QQ error: " << message;
|
||||
emit this->quickConnectRejected();
|
||||
loader->deleteLater();
|
||||
|
@ -475,17 +475,18 @@ void ApiClient::generateDeviceProfile() {
|
|||
Q_D(ApiClient);
|
||||
QSharedPointer<DTO::DeviceProfile> deviceProfile = QSharedPointer<DTO::DeviceProfile>::create(Model::DeviceProfile::generateProfile());
|
||||
deviceProfile->setJellyfinId(d->deviceId);
|
||||
deviceProfile->setFriendlyName(QSysInfo::prettyProductName());
|
||||
deviceProfile->setName(QSysInfo::prettyProductName());
|
||||
deviceProfile->setMaxStreamingBitrate(d->settings->maxStreamingBitRate());
|
||||
d->deviceProfile = deviceProfile;
|
||||
|
||||
QSharedPointer<DTO::ClientCapabilitiesDto> clientCapabilities = QSharedPointer<DTO::ClientCapabilitiesDto>::create(true, // supports mediaControl
|
||||
false, // supports content uploading
|
||||
true, // supports persistent identifier
|
||||
false, // supports sync
|
||||
deviceProfile);
|
||||
clientCapabilities->setPlayableMediaTypes({"Audio", "Video", "Photo"});
|
||||
clientCapabilities->setSupportedCommands(d->supportedCommands);
|
||||
QSharedPointer<DTO::ClientCapabilitiesDto> clientCapabilities = QSharedPointer<DTO::ClientCapabilitiesDto>::create(
|
||||
QList({ MediaType::Audio, MediaType::Video, MediaType::Photo }),
|
||||
d->supportedCommands,
|
||||
true, // supports mediaControl
|
||||
true, // supports persistent identifier
|
||||
deviceProfile
|
||||
);
|
||||
|
||||
clientCapabilities->setAppStoreUrl("https://chris.netsoj.nl/projects/harbour-sailfin");
|
||||
clientCapabilities->setIconUrl("https://chris.netsoj.nl/static/img/logo.png");
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ void BaseModelLoader::setApiClient(ApiClient *newApiClient) {
|
|||
|
||||
void BaseModelLoader::setLimit(int newLimit) {
|
||||
m_explicitLimitSet = newLimit >= 0;
|
||||
qCDebug(jellyfinApiModel) << "Limit explicitly set to " << newLimit;
|
||||
this->m_limit = newLimit;
|
||||
emit limitChanged(newLimit);
|
||||
}
|
||||
|
@ -144,12 +143,12 @@ bool setRequestStartIndex(Loader::GetLatestMediaParams ¶ms, int offset) {
|
|||
}
|
||||
|
||||
template<>
|
||||
void setRequestLimit(Loader::GetItemsByUserIdParams ¶ms, int limit) {
|
||||
void setRequestLimit(Loader::GetItemsParams ¶ms, int limit) {
|
||||
params.setLimit(limit);
|
||||
}
|
||||
|
||||
template<>
|
||||
bool setRequestStartIndex(Loader::GetItemsByUserIdParams ¶ms, int index) {
|
||||
bool setRequestStartIndex(Loader::GetItemsParams ¶ms, int index) {
|
||||
params.setStartIndex(index);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
*/
|
||||
#include "JellyfinQt/jellyfin.h"
|
||||
|
||||
#include "JellyfinQt/dto/collectiontype.h"
|
||||
#include "JellyfinQt/model/item.h"
|
||||
#include "JellyfinQt/dto/itemsortby.h"
|
||||
#include "JellyfinQt/dto/itemfields.h"
|
||||
#include "JellyfinQt/dto/mediastream.h"
|
||||
#include "JellyfinQt/dto/nameguidpair.h"
|
||||
|
@ -92,11 +94,16 @@ void JellyfinPlugin::registerTypes(const char *uri) {
|
|||
qmlRegisterType<ViewModel::LiveTvChannelsLoader>(uri, 1, 0, "LiveTvChannelsLoader");
|
||||
|
||||
// Enumerations
|
||||
qmlRegisterUncreatableType<Jellyfin::DTO::CollectionTypeClass>(uri, 1, 0, "CollectionType", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::DTO::GeneralCommandTypeClass>(uri, 1, 0, "GeneralCommandType", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::ViewModel::ModelStatusClass>(uri, 1, 0, "ModelStatus", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::DTO::PlayMethodClass>(uri, 1, 0, "PlayMethod", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::DTO::ItemFieldsClass>(uri, 1, 0, "ItemFields", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::DTO::ImageTypeClass>(uri, 1, 0, "ImageType", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::DTO::MediaTypeClass>(uri, 1, 0, "MediaType", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::DTO::BaseItemKindClass>(uri, 1, 0, "ItemType", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::DTO::PlayMethodClass>(uri, 1, 0, "PlayMethod", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::DTO::ItemSortByClass>(uri, 1, 0, "SortBy", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::DTO::SortOrderClass>(uri, 1, 0, "SortOrder", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::ViewModel::ModelStatusClass>(uri, 1, 0, "ModelStatus", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::ViewModel::NowPlayingSection>(uri, 1, 0, "NowPlayingSection", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::Model::PlayerStateClass>(uri, 1, 0, "PlayerState", "Is an enum");
|
||||
qmlRegisterUncreatableType<Jellyfin::Model::MediaStatusClass>(uri, 1, 0, "MediaStatus", "Is an enum");
|
||||
|
|
|
@ -46,7 +46,7 @@ PlaybackManager *LocalSession::createPlaybackManager() const {
|
|||
}
|
||||
|
||||
// ControllableJellyfinSession
|
||||
ControllableJellyfinSession::ControllableJellyfinSession(const QSharedPointer<DTO::SessionInfo> info, ApiClient &apiClient, QObject *parent)
|
||||
ControllableJellyfinSession::ControllableJellyfinSession(const QSharedPointer<DTO::SessionInfoDto> info, ApiClient &apiClient, QObject *parent)
|
||||
: ControllableSession(parent),
|
||||
m_data(info),
|
||||
m_apiClient(apiClient){}
|
||||
|
@ -147,14 +147,15 @@ void RemoteJellyfinSessionScanner::startScanning() {
|
|||
d->loader->setParameters(params);
|
||||
connect(d->loader, &Loader::HTTP::GetSessionsLoader::ready, this, [this, d, localSession]() {
|
||||
if (d->loader == nullptr) return;
|
||||
QList<DTO::SessionInfo> sessions = d->loader->result();
|
||||
QList<DTO::SessionInfoDto> sessions = d->loader->result();
|
||||
qDebug() << "Found " << sessions.count() << " sessions";
|
||||
|
||||
for(auto it = sessions.begin(); it != sessions.end(); it++) {
|
||||
|
||||
// Skip this device
|
||||
if (it->deviceId() == localSession->id()) continue;
|
||||
|
||||
emit sessionFound(new ControllableJellyfinSession(QSharedPointer<DTO::SessionInfo>::create(*it), *d->apiClient));
|
||||
emit sessionFound(new ControllableJellyfinSession(QSharedPointer<DTO::SessionInfoDto>::create(*it), *d->apiClient));
|
||||
}
|
||||
});
|
||||
d->loader->load();
|
||||
|
|
|
@ -53,8 +53,6 @@ int DeviceProfile::maxStreamingBitrate() {
|
|||
}
|
||||
|
||||
DTO::DeviceProfile DeviceProfile::generateProfile() {
|
||||
using JsonPair = QPair<QString, QJsonValue>;
|
||||
|
||||
QStringList audioCodes = {
|
||||
"aac",
|
||||
"flac",
|
||||
|
@ -94,130 +92,138 @@ DTO::DeviceProfile DeviceProfile::generateProfile() {
|
|||
|
||||
|
||||
// AAC
|
||||
DTO::CodecProfile codecProfile1(DTO::CodecType::VideoAudio);
|
||||
DTO::CodecProfile codecProfile1(
|
||||
DTO::CodecType::VideoAudio,
|
||||
{
|
||||
createCondition(CondVal::IsSecondaryAudio,
|
||||
Condition::Equals,
|
||||
"false",
|
||||
false)
|
||||
},
|
||||
{}
|
||||
);
|
||||
codecProfile1.setCodec("aac");
|
||||
QList<DTO::ProfileCondition> codecProfile1Conditions;
|
||||
codecProfile1Conditions.append(createCondition(CondVal::IsSecondaryAudio,
|
||||
Condition::Equals,
|
||||
"false",
|
||||
false));
|
||||
codecProfile1.setConditions(codecProfile1Conditions);
|
||||
|
||||
|
||||
DTO::CodecProfile codecProfile2(DTO::CodecType::Video);
|
||||
codecProfile2.setCodec("h264");
|
||||
codecProfile2.setConditions({
|
||||
createCondition(CondVal::IsAnamorphic,
|
||||
DTO::CodecProfile codecProfile2(
|
||||
DTO::CodecType::Video,
|
||||
{
|
||||
createCondition(CondVal::IsAnamorphic,
|
||||
Condition::NotEquals,
|
||||
"true", false),
|
||||
createCondition(CondVal::VideoProfile,
|
||||
Condition::EqualsAny,
|
||||
"baseline|constrained baseline", false), //"high|main|baseline|constrained baseline"
|
||||
createCondition(CondVal::VideoLevel,
|
||||
Condition::LessThanEqual,
|
||||
"51", false),
|
||||
createCondition(CondVal::IsInterlaced,
|
||||
Condition::NotEquals,
|
||||
"true", false)
|
||||
});
|
||||
createCondition(CondVal::VideoProfile,
|
||||
Condition::EqualsAny,
|
||||
"baseline|constrained baseline", false), //"high|main|baseline|constrained baseline"
|
||||
createCondition(CondVal::VideoLevel,
|
||||
Condition::LessThanEqual,
|
||||
"51", false),
|
||||
createCondition(CondVal::IsInterlaced,
|
||||
Condition::NotEquals,
|
||||
"true", false)
|
||||
},
|
||||
{}
|
||||
);
|
||||
codecProfile2.setCodec("h264");
|
||||
|
||||
QList<DTO::CodecProfile> codecProfiles = {
|
||||
codecProfile1,
|
||||
codecProfile2
|
||||
};
|
||||
// Hard coded nr 1:
|
||||
DTO::TranscodingProfile transcoding1(DTO::DlnaProfileType::Audio,
|
||||
false, // estimeateContentLength
|
||||
false, // enable MPEG2 TS M2 mode
|
||||
DTO::TranscodeSeekInfo::Auto,
|
||||
false, // copyTimestamps
|
||||
DTO::EncodingContext::Streaming,
|
||||
false, // enable subtitles in manifest
|
||||
0, // minSegments
|
||||
0, // minSegmentLength
|
||||
true // set break on nonkeyframes
|
||||
);
|
||||
transcoding1.setAudioCodec("aac");
|
||||
transcoding1.setContainer("ts");
|
||||
DTO::TranscodingProfile transcoding1(
|
||||
QStringLiteral("ts"),
|
||||
DTO::DlnaProfileType::Audio,
|
||||
QStringLiteral("h264"),
|
||||
QStringLiteral("aac"),
|
||||
DTO::MediaStreamProtocol::Hls,
|
||||
false, // estimeateContentLength
|
||||
false, // enable MPEG2 TS M2 mode
|
||||
DTO::TranscodeSeekInfo::Auto,
|
||||
false, // copyTimestamps
|
||||
DTO::EncodingContext::Streaming,
|
||||
false, // enable subtitles in manifest
|
||||
0, // minSegments
|
||||
0, // minSegmentLength
|
||||
true, // set break on nonkeyframes,
|
||||
{}, // conditions
|
||||
true // Enable audio VBR encoding
|
||||
);
|
||||
transcoding1.setMaxAudioChannels("2");
|
||||
transcoding1.setProtocol("hls");
|
||||
|
||||
// Hard code nr 2
|
||||
DTO::TranscodingProfile transcoding2(DTO::DlnaProfileType::Video,
|
||||
false, // estimate content length
|
||||
false, // enable MPEG2 ts M2 mode
|
||||
DTO::TranscodeSeekInfo::Auto,
|
||||
false, // copy timestamps
|
||||
DTO::EncodingContext::Streaming,
|
||||
false, // enable subtitles in manifest
|
||||
0, // minSegments
|
||||
0, // minSegmentLength
|
||||
true // set break on non-keyframes
|
||||
);
|
||||
transcoding2.setAudioCodec("mp3,aac");
|
||||
transcoding2.setContainer("ts");
|
||||
DTO::TranscodingProfile transcoding2(
|
||||
QStringLiteral("ts"),
|
||||
DTO::DlnaProfileType::Video,
|
||||
QStringLiteral("h264"),
|
||||
QStringLiteral("mp3,aac"),
|
||||
DTO::MediaStreamProtocol::Hls,
|
||||
false, // estimate content length
|
||||
false, // enable MPEG2 ts M2 mode
|
||||
DTO::TranscodeSeekInfo::Auto,
|
||||
false, // copy timestamps
|
||||
DTO::EncodingContext::Streaming,
|
||||
false, // enable subtitles in manifest
|
||||
0, // minSegments
|
||||
0, // minSegmentLength
|
||||
true, // set break on non-keyframes
|
||||
{}, // conditions
|
||||
true// enableAudioVbrEncoding
|
||||
);
|
||||
transcoding2.setMaxAudioChannels("2");
|
||||
transcoding2.setProtocol("hls");
|
||||
transcoding2.setVideoCodec("h264");
|
||||
|
||||
// Fallback
|
||||
DTO::TranscodingProfile transcoding3(DTO::DlnaProfileType::Video,
|
||||
false, // estimate content length
|
||||
false, // enable MPEG2 ts M2 mode
|
||||
DTO::TranscodeSeekInfo::Auto,
|
||||
false, // copy timestamps
|
||||
DTO::EncodingContext::Static,
|
||||
false, // enable subtitles in manifest
|
||||
0, // minSegments
|
||||
0, // minSegmentLength
|
||||
true // set break on non-keyframes
|
||||
);
|
||||
transcoding3.setContainer("mp4");
|
||||
transcoding3.setAudioCodec(videoAudioCodecs.join(','));
|
||||
transcoding3.setVideoCodec("h264");
|
||||
transcoding3.setProtocol("http");
|
||||
DTO::TranscodingProfile transcoding3(
|
||||
QStringLiteral("mp4"),
|
||||
DTO::DlnaProfileType::Video,
|
||||
QStringLiteral("h264"),
|
||||
videoAudioCodecs.join(","),
|
||||
DTO::MediaStreamProtocol::Http,
|
||||
false, // estimate content length
|
||||
false, // enable MPEG2 ts M2 mode
|
||||
DTO::TranscodeSeekInfo::Auto,
|
||||
false, // copy timestamps
|
||||
DTO::EncodingContext::Static,
|
||||
false, // enable subtitles in manifest
|
||||
0, // minSegments
|
||||
0, // minSegmentLength
|
||||
true, // set break on non-keyframes
|
||||
{},
|
||||
true
|
||||
);
|
||||
|
||||
QList<DTO::TranscodingProfile> transcodingProfiles = {
|
||||
transcoding1, transcoding2, transcoding3
|
||||
};
|
||||
|
||||
if (supportsHls() && !hlsVideoAudioCodecs.isEmpty()) {
|
||||
DTO::TranscodingProfile transcoding4(DTO::DlnaProfileType::Video,
|
||||
false, // estimate content length
|
||||
false, // enable MPEG2 ts M2 mode
|
||||
DTO::TranscodeSeekInfo::Auto,
|
||||
false, // copy timestamps
|
||||
DTO::EncodingContext::Streaming,
|
||||
false, // enable subtitles in manifest
|
||||
1, // minSegments
|
||||
0, // minSegmentLength
|
||||
true // set break on non-keyframes
|
||||
);
|
||||
transcoding4.setContainer("ts");
|
||||
transcoding4.setAudioCodec(hlsVideoAudioCodecs.join(','));
|
||||
transcoding4.setVideoCodec(hlsVideoCodecs.join(','));
|
||||
transcoding4.setProtocol("hls");
|
||||
DTO::TranscodingProfile transcoding4(
|
||||
QStringLiteral("ts"),
|
||||
DTO::DlnaProfileType::Video,
|
||||
hlsVideoAudioCodecs.join(","),
|
||||
hlsVideoAudioCodecs.join(","),
|
||||
DTO::MediaStreamProtocol::Hls,
|
||||
false, // estimate content length
|
||||
false, // enable MPEG2 ts M2 mode
|
||||
DTO::TranscodeSeekInfo::Auto,
|
||||
false, // copy timestamps
|
||||
DTO::EncodingContext::Streaming,
|
||||
false, // enable subtitles in manifest
|
||||
1, // minSegments
|
||||
0, // minSegmentLength
|
||||
true, // set break on non-keyframes
|
||||
{},
|
||||
true
|
||||
);
|
||||
transcoding4.setMaxAudioChannels("2");
|
||||
transcodingProfiles.append(transcoding4);
|
||||
}
|
||||
|
||||
// Response profiles (or whatever it actually does?)
|
||||
DTO::ResponseProfile responseProfile1(DTO::DlnaProfileType::Video);
|
||||
responseProfile1.setContainer("m4v");
|
||||
responseProfile1.setMimeType("video/mp4");
|
||||
QList<DTO::ResponseProfile> responseProfiles = {
|
||||
responseProfile1
|
||||
};
|
||||
|
||||
// Direct play profiles
|
||||
// Video
|
||||
DTO::DirectPlayProfile directPlayProfile1(DTO::DlnaProfileType::Video);
|
||||
directPlayProfile1.setContainer("mp4,m4v");
|
||||
DTO::DirectPlayProfile directPlayProfile1("mp4,m4v", DTO::DlnaProfileType::Video);
|
||||
directPlayProfile1.setVideoCodec(mp4VideoCodecs.join(','));
|
||||
directPlayProfile1.setAudioCodec(videoAudioCodecs.join(','));
|
||||
|
||||
DTO::DirectPlayProfile directPlayProfile2(DTO::DlnaProfileType::Video);
|
||||
directPlayProfile2.setContainer("mkv");
|
||||
DTO::DirectPlayProfile directPlayProfile2("mkv", DTO::DlnaProfileType::Video);
|
||||
directPlayProfile2.setVideoCodec(mp4VideoCodecs.join(','));
|
||||
directPlayProfile2.setAudioCodec(videoAudioCodecs.join(','));
|
||||
|
||||
|
@ -227,43 +233,36 @@ DTO::DeviceProfile DeviceProfile::generateProfile() {
|
|||
// Audio
|
||||
for (auto it = audioCodes.begin(); it != audioCodes.end(); it++) {
|
||||
if (*it == "mp2") {
|
||||
DTO::DirectPlayProfile profile(DTO::DlnaProfileType::Audio);
|
||||
profile.setContainer("mp2,mp3");
|
||||
DTO::DirectPlayProfile profile("mp2,mp3", DTO::DlnaProfileType::Audio);
|
||||
profile.setAudioCodec("mp2");
|
||||
directPlayProfiles.append(profile);
|
||||
} else if(*it == "mp3") {
|
||||
DTO::DirectPlayProfile profile(DTO::DlnaProfileType::Audio);
|
||||
profile.setContainer("mp3");
|
||||
DTO::DirectPlayProfile profile("mp3", DTO::DlnaProfileType::Audio);
|
||||
profile.setAudioCodec("mp3");
|
||||
directPlayProfiles.append(profile);
|
||||
} else if (*it == "webma") {
|
||||
DTO::DirectPlayProfile profile(DTO::DlnaProfileType::Audio);
|
||||
profile.setContainer("webma,webm");
|
||||
DTO::DirectPlayProfile profile("webma,webm", DTO::DlnaProfileType::Audio);
|
||||
directPlayProfiles.append(profile);
|
||||
} else {
|
||||
DTO::DirectPlayProfile profile(DTO::DlnaProfileType::Audio);
|
||||
profile.setContainer(*it);
|
||||
DTO::DirectPlayProfile profile(*it, DTO::DlnaProfileType::Audio);
|
||||
directPlayProfiles.append(profile);
|
||||
}
|
||||
}
|
||||
|
||||
QList<DTO::ContainerProfile> containerProfiles = { };
|
||||
|
||||
QList<DTO::SubtitleProfile> subtitleProfiles = {
|
||||
DTO::SubtitleProfile(DTO::SubtitleDeliveryMethodClass::Hls),
|
||||
DTO::SubtitleProfile(DTO::SubtitleDeliveryMethodClass::Encode)
|
||||
};
|
||||
|
||||
DTO::DeviceProfile profile(
|
||||
QSharedPointer<DTO::DeviceIdentification>::create(),
|
||||
false, // enableAlbumArtInDidl
|
||||
false, // enableSingleAlbumArtLimit
|
||||
false, // enableSingleSubtitleLimit
|
||||
std::numeric_limits<qint32>().max(), // max album art width
|
||||
std::numeric_limits<qint32>().max(), // max album art height
|
||||
0, // timeline offset seconds
|
||||
false, // request plain video items
|
||||
false, // request plain folders
|
||||
false, // enableMSMediaReceiverRegistrar,
|
||||
false //ignoreTranscodeByteRangeRequests
|
||||
directPlayProfiles,
|
||||
transcodingProfiles,
|
||||
containerProfiles,
|
||||
codecProfiles,
|
||||
subtitleProfiles
|
||||
);
|
||||
profile.setCodecProfiles(codecProfiles);
|
||||
profile.setDirectPlayProfiles(directPlayProfiles);
|
||||
profile.setResponseProfiles(responseProfiles);
|
||||
profile.setTranscodingProfiles(transcodingProfiles);
|
||||
profile.setMaxStreamingBitrate(std::make_optional<qint32>(maxStreamingBitrate()));
|
||||
return profile;
|
||||
}
|
||||
|
|
|
@ -26,12 +26,16 @@ namespace Model {
|
|||
Item::Item(ApiClient *apiClient, QObject *parent)
|
||||
: Item(DTO::BaseItemDto(
|
||||
QString(), // id
|
||||
ExtraType::Unknown,
|
||||
Video3DFormat::EnumNotSet,
|
||||
PlayAccess::Full,
|
||||
QSharedPointer<UserItemDataDto>::create(0, 0, false, false),
|
||||
BaseItemKind::EnumNotSet,
|
||||
QSharedPointer<UserItemDataDto>::create(0, 0, false, false, QString(), QString()),
|
||||
CollectionType::EnumNotSet,
|
||||
VideoType::EnumNotSet,
|
||||
LocationType::Virtual,
|
||||
IsoType::EnumNotSet,
|
||||
MediaType::EnumNotSet,
|
||||
ImageOrientation::EnumNotSet,
|
||||
ChannelType::EnumNotSet,
|
||||
ProgramAudio::EnumNotSet,
|
||||
|
|
|
@ -232,7 +232,7 @@ public:
|
|||
void requestItemUrl(QSharedPointer<Model::Item> item);
|
||||
|
||||
// slots
|
||||
void handlePlaybackInfoResponse(QString itemId, QString mediaType, DTO::PlaybackInfoResponse &response);
|
||||
void handlePlaybackInfoResponse(QString itemId, MediaType mediaType, DTO::PlaybackInfoResponse &response);
|
||||
/// Called when we have fetched the playback URL and playSession
|
||||
void onItemUrlReceived(const QString &itemId, const QUrl &url, const QString &playSession,
|
||||
// Fully specify class to please MOC
|
||||
|
@ -352,7 +352,7 @@ void LocalPlaybackManagerPrivate::setItem(QSharedPointer<Model::Item> newItem) {
|
|||
}
|
||||
}
|
||||
|
||||
void LocalPlaybackManagerPrivate::handlePlaybackInfoResponse(QString itemId, QString mediaType, DTO::PlaybackInfoResponse &response) {
|
||||
void LocalPlaybackManagerPrivate::handlePlaybackInfoResponse(QString itemId, MediaType mediaType, DTO::PlaybackInfoResponse &response) {
|
||||
Q_Q(LocalPlaybackManager);
|
||||
//TODO: move the item URL fetching logic out of this function, into MediaSourceInfo?
|
||||
QList<DTO::MediaSourceInfo> mediaSources = response.mediaSources();
|
||||
|
@ -394,15 +394,16 @@ void LocalPlaybackManagerPrivate::handlePlaybackInfoResponse(QString itemId, QSt
|
|||
resultingUrl = QUrl::fromLocalFile(source.path());
|
||||
playMethod = PlayMethod::DirectPlay;
|
||||
} else if (source.supportsDirectStream() && !transcodePreferred) {
|
||||
if (mediaType == "Video") {
|
||||
mediaType.append('s');
|
||||
QString mediaTypeUrl = Support::toString(mediaType);
|
||||
if (mediaType == MediaType::Video) {
|
||||
mediaTypeUrl.append('s');
|
||||
}
|
||||
QUrlQuery query;
|
||||
query.addQueryItem("mediaSourceId", source.jellyfinId());
|
||||
query.addQueryItem("deviceId", m_apiClient->deviceId());
|
||||
query.addQueryItem("api_key", m_apiClient->token());
|
||||
query.addQueryItem("Static", "True");
|
||||
resultingUrl = QUrl(m_apiClient->baseUrl() + "/" + mediaType + "/" + itemId
|
||||
resultingUrl = QUrl(m_apiClient->baseUrl() + "/" + mediaTypeUrl + "/" + itemId
|
||||
+ "/stream." + source.container() + "?" + query.toString(QUrl::EncodeReserved));
|
||||
playMethod = PlayMethod::DirectStream;
|
||||
} else if (source.supportsTranscoding() && !source.transcodingUrlNull() && transcodingAllowed) {
|
||||
|
|
|
@ -149,7 +149,9 @@ void PlaybackReporterPrivate::postPlaybackInfo(PlaybackInfoType type) {
|
|||
m_playbackManager->player()->state() == PlayerState::Paused,
|
||||
false, // is muted?
|
||||
m_playbackManager->playMethod(),
|
||||
DTO::RepeatMode::RepeatNone);
|
||||
DTO::RepeatMode::RepeatNone,
|
||||
DTO::PlaybackOrder::Default
|
||||
);
|
||||
|
||||
progress.setSessionId(m_playbackManager->sessionId());
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <JellyfinQt/model/remotejellyfinplayback.h>
|
||||
|
||||
#include <JellyfinQt/apiclient.h>
|
||||
#include <JellyfinQt/dto/sessioninfo.h>
|
||||
#include <JellyfinQt/dto/sessioninfodto.h>
|
||||
#include <JellyfinQt/loader/http/items.h>
|
||||
#include <JellyfinQt/loader/http/session.h>
|
||||
#include <JellyfinQt/loader/requesttypes.h>
|
||||
|
@ -174,7 +174,7 @@ void RemoteJellyfinPlayback::onPositionTimerFired() {
|
|||
emit positionChanged(position());
|
||||
}
|
||||
|
||||
void RemoteJellyfinPlayback::onSessionInfoUpdated(const QString &sessionId, const SessionInfo &sessionInfo) {
|
||||
void RemoteJellyfinPlayback::onSessionInfoUpdated(const QString &sessionId, const SessionInfoDto &sessionInfo) {
|
||||
if (sessionId != m_sessionId) return;
|
||||
m_lastSessionInfo = sessionInfo;
|
||||
|
||||
|
@ -245,8 +245,7 @@ void RemoteJellyfinPlayback::sendGeneralCommand(DTO::GeneralCommandType command,
|
|||
using CommandLoader = Loader::HTTP::SendFullGeneralCommandLoader;
|
||||
|
||||
Params params;
|
||||
QSharedPointer<DTO::GeneralCommand> fullCommand = QSharedPointer<DTO::GeneralCommand>::create(command, m_apiClient.userId());
|
||||
fullCommand->setArguments(arguments);
|
||||
QSharedPointer<DTO::GeneralCommand> fullCommand = QSharedPointer<DTO::GeneralCommand>::create(command, m_apiClient.userId(), arguments);
|
||||
params.setBody(fullCommand);
|
||||
params.setSessionId(m_sessionId);
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ void Item::setUserData(DTO::UserItemDataDto &newData) {
|
|||
|
||||
void Item::setUserData(QSharedPointer<DTO::UserItemDataDto> newData) {
|
||||
if (m_data.isNull() || m_data->userData().isNull()) {
|
||||
m_userData->setData(QSharedPointer<DTO::UserData>::create(0, 0, false, false));
|
||||
m_userData->setData(QSharedPointer<DTO::UserData>::create(0, 0, false, false, QString(), QString()));
|
||||
} else {
|
||||
m_userData->setData(newData);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ LatestMediaLoader::LatestMediaLoader(QObject *parent)
|
|||
: LatestMediaBase(new Jellyfin::Loader::HTTP::GetLatestMediaLoader(), parent){ }
|
||||
|
||||
UserItemsLoader::UserItemsLoader(QObject *parent)
|
||||
: UserItemsLoaderBase(new Jellyfin::Loader::HTTP::GetItemsByUserIdLoader(), parent) {}
|
||||
: UserItemsLoaderBase(new Jellyfin::Loader::HTTP::GetItemsLoader(), parent) {}
|
||||
|
||||
ResumeItemsLoader::ResumeItemsLoader(QObject *parent)
|
||||
: ResumeItemsLoaderBase(new Jellyfin::Loader::HTTP::GetResumeItemsLoader(), parent) {}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Jellyfin {
|
|||
namespace ViewModel {
|
||||
|
||||
UserData::UserData(QObject *parent)
|
||||
: UserData(QSharedPointer<DTO::UserItemDataDto>::create(0, 0, false, false), parent) {
|
||||
: UserData(QSharedPointer<DTO::UserItemDataDto>::create(0, 0, false, false, QString(), QString()), parent) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -30,13 +30,13 @@ UserData::UserData(QSharedPointer<DTO::UserItemDataDto> data, QObject *parent)
|
|||
: QObject(parent),
|
||||
m_data(data) {
|
||||
if (m_data.isNull()) {
|
||||
m_data = QSharedPointer<DTO::UserItemDataDto>::create(0, 0, false, false);
|
||||
m_data = QSharedPointer<DTO::UserItemDataDto>::create(0, 0, false, false, QString(), QString());
|
||||
}
|
||||
}
|
||||
|
||||
void UserData::setData(QSharedPointer<DTO::UserItemDataDto> data) {
|
||||
if (data.isNull()) {
|
||||
m_data = QSharedPointer<DTO::UserItemDataDto>::create(0, 0, false, false);
|
||||
m_data = QSharedPointer<DTO::UserItemDataDto>::create(0, 0, false, false, QString(), QString());
|
||||
} else {
|
||||
m_data = data;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include <JellyfinQt/dto/generalcommand.h>
|
||||
#include <JellyfinQt/dto/generalcommandtype.h>
|
||||
#include <JellyfinQt/dto/playstaterequest.h>
|
||||
#include <JellyfinQt/dto/sessioninfo.h>
|
||||
#include <JellyfinQt/dto/sessioninfodto.h>
|
||||
#include <JellyfinQt/dto/useritemdatadto.h>
|
||||
|
||||
Q_LOGGING_CATEGORY(jellyfinWebSocket, "jellyfin.websocket");
|
||||
|
@ -157,7 +157,7 @@ void WebSocket::textMessageReceived(const QString &message) {
|
|||
}
|
||||
} else if (messageType == QStringLiteral("Sessions")) {
|
||||
try {
|
||||
QList<DTO::SessionInfo> sessionInfoList = Support::fromJsonValue<QList<DTO::SessionInfo>>(data);
|
||||
QList<DTO::SessionInfoDto> sessionInfoList = Support::fromJsonValue<QList<DTO::SessionInfoDto>>(data);
|
||||
for (auto it = sessionInfoList.cbegin(); it != sessionInfoList.cend(); it++) {
|
||||
emit m_apiClient->eventbus()->sessionInfoUpdated(it->jellyfinId(), *it);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue