mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2025-09-07 18:42:44 +00:00
WIP: HttpLoader seems to work, Model still borked
This commit is contained in:
parent
e421adf733
commit
729e343661
1412 changed files with 13967 additions and 33794 deletions
|
@ -67,7 +67,7 @@ void AccessSchedule::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject AccessSchedule::toJson() {
|
||||
QJsonObject AccessSchedule::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Id"] = Jellyfin::Support::toJsonValue<qint32>(m_jellyfinId);
|
||||
result["UserId"] = Jellyfin::Support::toJsonValue<QString>(m_userId);
|
||||
|
@ -116,10 +116,15 @@ namespace Support {
|
|||
using AccessSchedule = Jellyfin::DTO::AccessSchedule;
|
||||
|
||||
template <>
|
||||
AccessSchedule fromJsonValue<AccessSchedule>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
AccessSchedule fromJsonValue(const QJsonValue &source, convertType<AccessSchedule>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return AccessSchedule::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const AccessSchedule &source, convertType<AccessSchedule>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -82,7 +82,7 @@ void ActivityLogEntry::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ActivityLogEntry::toJson() {
|
||||
QJsonObject ActivityLogEntry::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Id"] = Jellyfin::Support::toJsonValue<qint64>(m_jellyfinId);
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
|
@ -208,10 +208,15 @@ namespace Support {
|
|||
using ActivityLogEntry = Jellyfin::DTO::ActivityLogEntry;
|
||||
|
||||
template <>
|
||||
ActivityLogEntry fromJsonValue<ActivityLogEntry>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ActivityLogEntry fromJsonValue(const QJsonValue &source, convertType<ActivityLogEntry>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ActivityLogEntry::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ActivityLogEntry &source, convertType<ActivityLogEntry>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void ActivityLogEntryQueryResult::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ActivityLogEntryQueryResult::toJson() {
|
||||
QJsonObject ActivityLogEntryQueryResult::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Items"] = Jellyfin::Support::toJsonValue<QList<ActivityLogEntry>>(m_items);
|
||||
result["TotalRecordCount"] = Jellyfin::Support::toJsonValue<qint32>(m_totalRecordCount);
|
||||
|
@ -103,10 +103,15 @@ namespace Support {
|
|||
using ActivityLogEntryQueryResult = Jellyfin::DTO::ActivityLogEntryQueryResult;
|
||||
|
||||
template <>
|
||||
ActivityLogEntryQueryResult fromJsonValue<ActivityLogEntryQueryResult>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ActivityLogEntryQueryResult fromJsonValue(const QJsonValue &source, convertType<ActivityLogEntryQueryResult>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ActivityLogEntryQueryResult::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ActivityLogEntryQueryResult &source, convertType<ActivityLogEntryQueryResult>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -55,7 +55,7 @@ void AddVirtualFolderDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject AddVirtualFolderDto::toJson() {
|
||||
QJsonObject AddVirtualFolderDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["LibraryOptions"] = Jellyfin::Support::toJsonValue<QSharedPointer<LibraryOptions>>(m_libraryOptions);
|
||||
|
||||
|
@ -76,10 +76,15 @@ namespace Support {
|
|||
using AddVirtualFolderDto = Jellyfin::DTO::AddVirtualFolderDto;
|
||||
|
||||
template <>
|
||||
AddVirtualFolderDto fromJsonValue<AddVirtualFolderDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
AddVirtualFolderDto fromJsonValue(const QJsonValue &source, convertType<AddVirtualFolderDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return AddVirtualFolderDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const AddVirtualFolderDto &source, convertType<AddVirtualFolderDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -79,32 +79,32 @@ void AlbumInfo::setFromJson(QJsonObject source) {
|
|||
m_path = Jellyfin::Support::fromJsonValue<QString>(source["Path"]);
|
||||
m_metadataLanguage = Jellyfin::Support::fromJsonValue<QString>(source["MetadataLanguage"]);
|
||||
m_metadataCountryCode = Jellyfin::Support::fromJsonValue<QString>(source["MetadataCountryCode"]);
|
||||
m_providerIds = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["ProviderIds"]);
|
||||
m_providerIds = Jellyfin::Support::fromJsonValue<QJsonObject>(source["ProviderIds"]);
|
||||
m_year = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["Year"]);
|
||||
m_indexNumber = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["IndexNumber"]);
|
||||
m_parentIndexNumber = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["ParentIndexNumber"]);
|
||||
m_premiereDate = Jellyfin::Support::fromJsonValue<QDateTime>(source["PremiereDate"]);
|
||||
m_isAutomated = Jellyfin::Support::fromJsonValue<bool>(source["IsAutomated"]);
|
||||
m_albumArtists = Jellyfin::Support::fromJsonValue<QStringList>(source["AlbumArtists"]);
|
||||
m_artistProviderIds = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["ArtistProviderIds"]);
|
||||
m_artistProviderIds = Jellyfin::Support::fromJsonValue<QJsonObject>(source["ArtistProviderIds"]);
|
||||
m_songInfos = Jellyfin::Support::fromJsonValue<QList<SongInfo>>(source["SongInfos"]);
|
||||
|
||||
}
|
||||
|
||||
QJsonObject AlbumInfo::toJson() {
|
||||
QJsonObject AlbumInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Path"] = Jellyfin::Support::toJsonValue<QString>(m_path);
|
||||
result["MetadataLanguage"] = Jellyfin::Support::toJsonValue<QString>(m_metadataLanguage);
|
||||
result["MetadataCountryCode"] = Jellyfin::Support::toJsonValue<QString>(m_metadataCountryCode);
|
||||
result["ProviderIds"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_providerIds);
|
||||
result["ProviderIds"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_providerIds);
|
||||
result["Year"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_year);
|
||||
result["IndexNumber"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_indexNumber);
|
||||
result["ParentIndexNumber"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_parentIndexNumber);
|
||||
result["PremiereDate"] = Jellyfin::Support::toJsonValue<QDateTime>(m_premiereDate);
|
||||
result["IsAutomated"] = Jellyfin::Support::toJsonValue<bool>(m_isAutomated);
|
||||
result["AlbumArtists"] = Jellyfin::Support::toJsonValue<QStringList>(m_albumArtists);
|
||||
result["ArtistProviderIds"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_artistProviderIds);
|
||||
result["ArtistProviderIds"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_artistProviderIds);
|
||||
result["SongInfos"] = Jellyfin::Support::toJsonValue<QList<SongInfo>>(m_songInfos);
|
||||
|
||||
return result;
|
||||
|
@ -162,17 +162,17 @@ void AlbumInfo::setMetadataCountryCodeNull() {
|
|||
m_metadataCountryCode.clear();
|
||||
|
||||
}
|
||||
std::optional<QJsonObject> AlbumInfo::providerIds() const { return m_providerIds; }
|
||||
QJsonObject AlbumInfo::providerIds() const { return m_providerIds; }
|
||||
|
||||
void AlbumInfo::setProviderIds(std::optional<QJsonObject> newProviderIds) {
|
||||
void AlbumInfo::setProviderIds(QJsonObject newProviderIds) {
|
||||
m_providerIds = newProviderIds;
|
||||
}
|
||||
bool AlbumInfo::providerIdsNull() const {
|
||||
return !m_providerIds.has_value();
|
||||
return m_providerIds.isEmpty();
|
||||
}
|
||||
|
||||
void AlbumInfo::setProviderIdsNull() {
|
||||
m_providerIds = std::nullopt;
|
||||
m_providerIds= QJsonObject();
|
||||
|
||||
}
|
||||
std::optional<qint32> AlbumInfo::year() const { return m_year; }
|
||||
|
@ -246,17 +246,17 @@ void AlbumInfo::setAlbumArtistsNull() {
|
|||
m_albumArtists.clear();
|
||||
|
||||
}
|
||||
std::optional<QJsonObject> AlbumInfo::artistProviderIds() const { return m_artistProviderIds; }
|
||||
QJsonObject AlbumInfo::artistProviderIds() const { return m_artistProviderIds; }
|
||||
|
||||
void AlbumInfo::setArtistProviderIds(std::optional<QJsonObject> newArtistProviderIds) {
|
||||
void AlbumInfo::setArtistProviderIds(QJsonObject newArtistProviderIds) {
|
||||
m_artistProviderIds = newArtistProviderIds;
|
||||
}
|
||||
bool AlbumInfo::artistProviderIdsNull() const {
|
||||
return !m_artistProviderIds.has_value();
|
||||
return m_artistProviderIds.isEmpty();
|
||||
}
|
||||
|
||||
void AlbumInfo::setArtistProviderIdsNull() {
|
||||
m_artistProviderIds = std::nullopt;
|
||||
m_artistProviderIds= QJsonObject();
|
||||
|
||||
}
|
||||
QList<SongInfo> AlbumInfo::songInfos() const { return m_songInfos; }
|
||||
|
@ -280,10 +280,15 @@ namespace Support {
|
|||
using AlbumInfo = Jellyfin::DTO::AlbumInfo;
|
||||
|
||||
template <>
|
||||
AlbumInfo fromJsonValue<AlbumInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
AlbumInfo fromJsonValue(const QJsonValue &source, convertType<AlbumInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return AlbumInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const AlbumInfo &source, convertType<AlbumInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void AlbumInfoRemoteSearchQuery::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject AlbumInfoRemoteSearchQuery::toJson() {
|
||||
QJsonObject AlbumInfoRemoteSearchQuery::toJson() const {
|
||||
QJsonObject result;
|
||||
result["SearchInfo"] = Jellyfin::Support::toJsonValue<QSharedPointer<AlbumInfo>>(m_searchInfo);
|
||||
result["ItemId"] = Jellyfin::Support::toJsonValue<QString>(m_itemId);
|
||||
|
@ -113,10 +113,15 @@ namespace Support {
|
|||
using AlbumInfoRemoteSearchQuery = Jellyfin::DTO::AlbumInfoRemoteSearchQuery;
|
||||
|
||||
template <>
|
||||
AlbumInfoRemoteSearchQuery fromJsonValue<AlbumInfoRemoteSearchQuery>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
AlbumInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source, convertType<AlbumInfoRemoteSearchQuery>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return AlbumInfoRemoteSearchQuery::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const AlbumInfoRemoteSearchQuery &source, convertType<AlbumInfoRemoteSearchQuery>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void AllThemeMediaResult::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject AllThemeMediaResult::toJson() {
|
||||
QJsonObject AllThemeMediaResult::toJson() const {
|
||||
QJsonObject result;
|
||||
result["ThemeVideosResult"] = Jellyfin::Support::toJsonValue<QSharedPointer<ThemeMediaResult>>(m_themeVideosResult);
|
||||
result["ThemeSongsResult"] = Jellyfin::Support::toJsonValue<QSharedPointer<ThemeMediaResult>>(m_themeSongsResult);
|
||||
|
@ -96,10 +96,15 @@ namespace Support {
|
|||
using AllThemeMediaResult = Jellyfin::DTO::AllThemeMediaResult;
|
||||
|
||||
template <>
|
||||
AllThemeMediaResult fromJsonValue<AllThemeMediaResult>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
AllThemeMediaResult fromJsonValue(const QJsonValue &source, convertType<AllThemeMediaResult>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return AllThemeMediaResult::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const AllThemeMediaResult &source, convertType<AllThemeMediaResult>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ArchitectureClass::ArchitectureClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using Architecture = Jellyfin::DTO::Architecture;
|
||||
|
||||
template <>
|
||||
Architecture fromJsonValue<Architecture>(const QJsonValue &source) {
|
||||
Architecture fromJsonValue(const QJsonValue &source, convertType<Architecture>) {
|
||||
if (!source.isString()) return Architecture::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -65,5 +64,25 @@ Architecture fromJsonValue<Architecture>(const QJsonValue &source) {
|
|||
return Architecture::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const Architecture &source, convertType<Architecture>) {
|
||||
switch(source) {
|
||||
case Architecture::X86:
|
||||
return QStringLiteral("X86");
|
||||
case Architecture::X64:
|
||||
return QStringLiteral("X64");
|
||||
case Architecture::Arm:
|
||||
return QStringLiteral("Arm");
|
||||
case Architecture::Arm64:
|
||||
return QStringLiteral("Arm64");
|
||||
case Architecture::Wasm:
|
||||
return QStringLiteral("Wasm");
|
||||
|
||||
case Architecture::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -75,7 +75,7 @@ void ArtistInfo::setFromJson(QJsonObject source) {
|
|||
m_path = Jellyfin::Support::fromJsonValue<QString>(source["Path"]);
|
||||
m_metadataLanguage = Jellyfin::Support::fromJsonValue<QString>(source["MetadataLanguage"]);
|
||||
m_metadataCountryCode = Jellyfin::Support::fromJsonValue<QString>(source["MetadataCountryCode"]);
|
||||
m_providerIds = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["ProviderIds"]);
|
||||
m_providerIds = Jellyfin::Support::fromJsonValue<QJsonObject>(source["ProviderIds"]);
|
||||
m_year = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["Year"]);
|
||||
m_indexNumber = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["IndexNumber"]);
|
||||
m_parentIndexNumber = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["ParentIndexNumber"]);
|
||||
|
@ -85,13 +85,13 @@ void ArtistInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ArtistInfo::toJson() {
|
||||
QJsonObject ArtistInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Path"] = Jellyfin::Support::toJsonValue<QString>(m_path);
|
||||
result["MetadataLanguage"] = Jellyfin::Support::toJsonValue<QString>(m_metadataLanguage);
|
||||
result["MetadataCountryCode"] = Jellyfin::Support::toJsonValue<QString>(m_metadataCountryCode);
|
||||
result["ProviderIds"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_providerIds);
|
||||
result["ProviderIds"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_providerIds);
|
||||
result["Year"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_year);
|
||||
result["IndexNumber"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_indexNumber);
|
||||
result["ParentIndexNumber"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_parentIndexNumber);
|
||||
|
@ -154,17 +154,17 @@ void ArtistInfo::setMetadataCountryCodeNull() {
|
|||
m_metadataCountryCode.clear();
|
||||
|
||||
}
|
||||
std::optional<QJsonObject> ArtistInfo::providerIds() const { return m_providerIds; }
|
||||
QJsonObject ArtistInfo::providerIds() const { return m_providerIds; }
|
||||
|
||||
void ArtistInfo::setProviderIds(std::optional<QJsonObject> newProviderIds) {
|
||||
void ArtistInfo::setProviderIds(QJsonObject newProviderIds) {
|
||||
m_providerIds = newProviderIds;
|
||||
}
|
||||
bool ArtistInfo::providerIdsNull() const {
|
||||
return !m_providerIds.has_value();
|
||||
return m_providerIds.isEmpty();
|
||||
}
|
||||
|
||||
void ArtistInfo::setProviderIdsNull() {
|
||||
m_providerIds = std::nullopt;
|
||||
m_providerIds= QJsonObject();
|
||||
|
||||
}
|
||||
std::optional<qint32> ArtistInfo::year() const { return m_year; }
|
||||
|
@ -246,10 +246,15 @@ namespace Support {
|
|||
using ArtistInfo = Jellyfin::DTO::ArtistInfo;
|
||||
|
||||
template <>
|
||||
ArtistInfo fromJsonValue<ArtistInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ArtistInfo fromJsonValue(const QJsonValue &source, convertType<ArtistInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ArtistInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ArtistInfo &source, convertType<ArtistInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void ArtistInfoRemoteSearchQuery::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ArtistInfoRemoteSearchQuery::toJson() {
|
||||
QJsonObject ArtistInfoRemoteSearchQuery::toJson() const {
|
||||
QJsonObject result;
|
||||
result["SearchInfo"] = Jellyfin::Support::toJsonValue<QSharedPointer<ArtistInfo>>(m_searchInfo);
|
||||
result["ItemId"] = Jellyfin::Support::toJsonValue<QString>(m_itemId);
|
||||
|
@ -113,10 +113,15 @@ namespace Support {
|
|||
using ArtistInfoRemoteSearchQuery = Jellyfin::DTO::ArtistInfoRemoteSearchQuery;
|
||||
|
||||
template <>
|
||||
ArtistInfoRemoteSearchQuery fromJsonValue<ArtistInfoRemoteSearchQuery>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ArtistInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source, convertType<ArtistInfoRemoteSearchQuery>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ArtistInfoRemoteSearchQuery::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ArtistInfoRemoteSearchQuery &source, convertType<ArtistInfoRemoteSearchQuery>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void AuthenticateUserByName::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject AuthenticateUserByName::toJson() {
|
||||
QJsonObject AuthenticateUserByName::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Username"] = Jellyfin::Support::toJsonValue<QString>(m_username);
|
||||
result["Pw"] = Jellyfin::Support::toJsonValue<QString>(m_pw);
|
||||
|
@ -117,10 +117,15 @@ namespace Support {
|
|||
using AuthenticateUserByName = Jellyfin::DTO::AuthenticateUserByName;
|
||||
|
||||
template <>
|
||||
AuthenticateUserByName fromJsonValue<AuthenticateUserByName>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
AuthenticateUserByName fromJsonValue(const QJsonValue &source, convertType<AuthenticateUserByName>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return AuthenticateUserByName::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const AuthenticateUserByName &source, convertType<AuthenticateUserByName>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -88,7 +88,7 @@ void AuthenticationInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject AuthenticationInfo::toJson() {
|
||||
QJsonObject AuthenticationInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Id"] = Jellyfin::Support::toJsonValue<qint64>(m_jellyfinId);
|
||||
result["AccessToken"] = Jellyfin::Support::toJsonValue<QString>(m_accessToken);
|
||||
|
@ -235,10 +235,15 @@ namespace Support {
|
|||
using AuthenticationInfo = Jellyfin::DTO::AuthenticationInfo;
|
||||
|
||||
template <>
|
||||
AuthenticationInfo fromJsonValue<AuthenticationInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
AuthenticationInfo fromJsonValue(const QJsonValue &source, convertType<AuthenticationInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return AuthenticationInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const AuthenticationInfo &source, convertType<AuthenticationInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void AuthenticationInfoQueryResult::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject AuthenticationInfoQueryResult::toJson() {
|
||||
QJsonObject AuthenticationInfoQueryResult::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Items"] = Jellyfin::Support::toJsonValue<QList<AuthenticationInfo>>(m_items);
|
||||
result["TotalRecordCount"] = Jellyfin::Support::toJsonValue<qint32>(m_totalRecordCount);
|
||||
|
@ -103,10 +103,15 @@ namespace Support {
|
|||
using AuthenticationInfoQueryResult = Jellyfin::DTO::AuthenticationInfoQueryResult;
|
||||
|
||||
template <>
|
||||
AuthenticationInfoQueryResult fromJsonValue<AuthenticationInfoQueryResult>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
AuthenticationInfoQueryResult fromJsonValue(const QJsonValue &source, convertType<AuthenticationInfoQueryResult>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return AuthenticationInfoQueryResult::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const AuthenticationInfoQueryResult &source, convertType<AuthenticationInfoQueryResult>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void AuthenticationResult::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject AuthenticationResult::toJson() {
|
||||
QJsonObject AuthenticationResult::toJson() const {
|
||||
QJsonObject result;
|
||||
result["User"] = Jellyfin::Support::toJsonValue<QSharedPointer<UserDto>>(m_user);
|
||||
result["SessionInfo"] = Jellyfin::Support::toJsonValue<QSharedPointer<SessionInfo>>(m_sessionInfo);
|
||||
|
@ -120,10 +120,15 @@ namespace Support {
|
|||
using AuthenticationResult = Jellyfin::DTO::AuthenticationResult;
|
||||
|
||||
template <>
|
||||
AuthenticationResult fromJsonValue<AuthenticationResult>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
AuthenticationResult fromJsonValue(const QJsonValue &source, convertType<AuthenticationResult>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return AuthenticationResult::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const AuthenticationResult &source, convertType<AuthenticationResult>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -85,7 +85,7 @@ void BaseItem::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject BaseItem::toJson() {
|
||||
QJsonObject BaseItem::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Size"] = Jellyfin::Support::toJsonValue<std::optional<qint64>>(m_size);
|
||||
result["Container"] = Jellyfin::Support::toJsonValue<QString>(m_container);
|
||||
|
@ -211,10 +211,15 @@ namespace Support {
|
|||
using BaseItem = Jellyfin::DTO::BaseItem;
|
||||
|
||||
template <>
|
||||
BaseItem fromJsonValue<BaseItem>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
BaseItem fromJsonValue(const QJsonValue &source, convertType<BaseItem>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return BaseItem::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const BaseItem &source, convertType<BaseItem>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -401,7 +401,7 @@ void BaseItemDto::setFromJson(QJsonObject source) {
|
|||
m_indexNumberEnd = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["IndexNumberEnd"]);
|
||||
m_parentIndexNumber = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["ParentIndexNumber"]);
|
||||
m_remoteTrailers = Jellyfin::Support::fromJsonValue<QList<MediaUrl>>(source["RemoteTrailers"]);
|
||||
m_providerIds = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["ProviderIds"]);
|
||||
m_providerIds = Jellyfin::Support::fromJsonValue<QJsonObject>(source["ProviderIds"]);
|
||||
m_isHD = Jellyfin::Support::fromJsonValue<std::optional<bool>>(source["IsHD"]);
|
||||
m_isFolder = Jellyfin::Support::fromJsonValue<std::optional<bool>>(source["IsFolder"]);
|
||||
m_parentId = Jellyfin::Support::fromJsonValue<QString>(source["ParentId"]);
|
||||
|
@ -441,14 +441,14 @@ void BaseItemDto::setFromJson(QJsonObject source) {
|
|||
m_videoType = Jellyfin::Support::fromJsonValue<VideoType>(source["VideoType"]);
|
||||
m_partCount = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["PartCount"]);
|
||||
m_mediaSourceCount = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["MediaSourceCount"]);
|
||||
m_imageTags = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["ImageTags"]);
|
||||
m_imageTags = Jellyfin::Support::fromJsonValue<QJsonObject>(source["ImageTags"]);
|
||||
m_backdropImageTags = Jellyfin::Support::fromJsonValue<QStringList>(source["BackdropImageTags"]);
|
||||
m_screenshotImageTags = Jellyfin::Support::fromJsonValue<QStringList>(source["ScreenshotImageTags"]);
|
||||
m_parentLogoImageTag = Jellyfin::Support::fromJsonValue<QString>(source["ParentLogoImageTag"]);
|
||||
m_parentArtItemId = Jellyfin::Support::fromJsonValue<QString>(source["ParentArtItemId"]);
|
||||
m_parentArtImageTag = Jellyfin::Support::fromJsonValue<QString>(source["ParentArtImageTag"]);
|
||||
m_seriesThumbImageTag = Jellyfin::Support::fromJsonValue<QString>(source["SeriesThumbImageTag"]);
|
||||
m_imageBlurHashes = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["ImageBlurHashes"]);
|
||||
m_imageBlurHashes = Jellyfin::Support::fromJsonValue<QJsonObject>(source["ImageBlurHashes"]);
|
||||
m_seriesStudio = Jellyfin::Support::fromJsonValue<QString>(source["SeriesStudio"]);
|
||||
m_parentThumbItemId = Jellyfin::Support::fromJsonValue<QString>(source["ParentThumbItemId"]);
|
||||
m_parentThumbImageTag = Jellyfin::Support::fromJsonValue<QString>(source["ParentThumbImageTag"]);
|
||||
|
@ -505,7 +505,7 @@ void BaseItemDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject BaseItemDto::toJson() {
|
||||
QJsonObject BaseItemDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["OriginalTitle"] = Jellyfin::Support::toJsonValue<QString>(m_originalTitle);
|
||||
|
@ -557,7 +557,7 @@ QJsonObject BaseItemDto::toJson() {
|
|||
result["IndexNumberEnd"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_indexNumberEnd);
|
||||
result["ParentIndexNumber"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_parentIndexNumber);
|
||||
result["RemoteTrailers"] = Jellyfin::Support::toJsonValue<QList<MediaUrl>>(m_remoteTrailers);
|
||||
result["ProviderIds"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_providerIds);
|
||||
result["ProviderIds"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_providerIds);
|
||||
result["IsHD"] = Jellyfin::Support::toJsonValue<std::optional<bool>>(m_isHD);
|
||||
result["IsFolder"] = Jellyfin::Support::toJsonValue<std::optional<bool>>(m_isFolder);
|
||||
result["ParentId"] = Jellyfin::Support::toJsonValue<QString>(m_parentId);
|
||||
|
@ -597,14 +597,14 @@ QJsonObject BaseItemDto::toJson() {
|
|||
result["VideoType"] = Jellyfin::Support::toJsonValue<VideoType>(m_videoType);
|
||||
result["PartCount"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_partCount);
|
||||
result["MediaSourceCount"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_mediaSourceCount);
|
||||
result["ImageTags"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_imageTags);
|
||||
result["ImageTags"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_imageTags);
|
||||
result["BackdropImageTags"] = Jellyfin::Support::toJsonValue<QStringList>(m_backdropImageTags);
|
||||
result["ScreenshotImageTags"] = Jellyfin::Support::toJsonValue<QStringList>(m_screenshotImageTags);
|
||||
result["ParentLogoImageTag"] = Jellyfin::Support::toJsonValue<QString>(m_parentLogoImageTag);
|
||||
result["ParentArtItemId"] = Jellyfin::Support::toJsonValue<QString>(m_parentArtItemId);
|
||||
result["ParentArtImageTag"] = Jellyfin::Support::toJsonValue<QString>(m_parentArtImageTag);
|
||||
result["SeriesThumbImageTag"] = Jellyfin::Support::toJsonValue<QString>(m_seriesThumbImageTag);
|
||||
result["ImageBlurHashes"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_imageBlurHashes);
|
||||
result["ImageBlurHashes"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_imageBlurHashes);
|
||||
result["SeriesStudio"] = Jellyfin::Support::toJsonValue<QString>(m_seriesStudio);
|
||||
result["ParentThumbItemId"] = Jellyfin::Support::toJsonValue<QString>(m_parentThumbItemId);
|
||||
result["ParentThumbImageTag"] = Jellyfin::Support::toJsonValue<QString>(m_parentThumbImageTag);
|
||||
|
@ -1291,17 +1291,17 @@ void BaseItemDto::setRemoteTrailersNull() {
|
|||
m_remoteTrailers.clear();
|
||||
|
||||
}
|
||||
std::optional<QJsonObject> BaseItemDto::providerIds() const { return m_providerIds; }
|
||||
QJsonObject BaseItemDto::providerIds() const { return m_providerIds; }
|
||||
|
||||
void BaseItemDto::setProviderIds(std::optional<QJsonObject> newProviderIds) {
|
||||
void BaseItemDto::setProviderIds(QJsonObject newProviderIds) {
|
||||
m_providerIds = newProviderIds;
|
||||
}
|
||||
bool BaseItemDto::providerIdsNull() const {
|
||||
return !m_providerIds.has_value();
|
||||
return m_providerIds.isEmpty();
|
||||
}
|
||||
|
||||
void BaseItemDto::setProviderIdsNull() {
|
||||
m_providerIds = std::nullopt;
|
||||
m_providerIds= QJsonObject();
|
||||
|
||||
}
|
||||
std::optional<bool> BaseItemDto::isHD() const { return m_isHD; }
|
||||
|
@ -1797,17 +1797,17 @@ void BaseItemDto::setMediaSourceCountNull() {
|
|||
m_mediaSourceCount = std::nullopt;
|
||||
|
||||
}
|
||||
std::optional<QJsonObject> BaseItemDto::imageTags() const { return m_imageTags; }
|
||||
QJsonObject BaseItemDto::imageTags() const { return m_imageTags; }
|
||||
|
||||
void BaseItemDto::setImageTags(std::optional<QJsonObject> newImageTags) {
|
||||
void BaseItemDto::setImageTags(QJsonObject newImageTags) {
|
||||
m_imageTags = newImageTags;
|
||||
}
|
||||
bool BaseItemDto::imageTagsNull() const {
|
||||
return !m_imageTags.has_value();
|
||||
return m_imageTags.isEmpty();
|
||||
}
|
||||
|
||||
void BaseItemDto::setImageTagsNull() {
|
||||
m_imageTags = std::nullopt;
|
||||
m_imageTags= QJsonObject();
|
||||
|
||||
}
|
||||
QStringList BaseItemDto::backdropImageTags() const { return m_backdropImageTags; }
|
||||
|
@ -1888,17 +1888,17 @@ void BaseItemDto::setSeriesThumbImageTagNull() {
|
|||
m_seriesThumbImageTag.clear();
|
||||
|
||||
}
|
||||
std::optional<QJsonObject> BaseItemDto::imageBlurHashes() const { return m_imageBlurHashes; }
|
||||
QJsonObject BaseItemDto::imageBlurHashes() const { return m_imageBlurHashes; }
|
||||
|
||||
void BaseItemDto::setImageBlurHashes(std::optional<QJsonObject> newImageBlurHashes) {
|
||||
void BaseItemDto::setImageBlurHashes(QJsonObject newImageBlurHashes) {
|
||||
m_imageBlurHashes = newImageBlurHashes;
|
||||
}
|
||||
bool BaseItemDto::imageBlurHashesNull() const {
|
||||
return !m_imageBlurHashes.has_value();
|
||||
return m_imageBlurHashes.isEmpty();
|
||||
}
|
||||
|
||||
void BaseItemDto::setImageBlurHashesNull() {
|
||||
m_imageBlurHashes = std::nullopt;
|
||||
m_imageBlurHashes= QJsonObject();
|
||||
|
||||
}
|
||||
QString BaseItemDto::seriesStudio() const { return m_seriesStudio; }
|
||||
|
@ -2556,10 +2556,15 @@ namespace Support {
|
|||
using BaseItemDto = Jellyfin::DTO::BaseItemDto;
|
||||
|
||||
template <>
|
||||
BaseItemDto fromJsonValue<BaseItemDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
BaseItemDto fromJsonValue(const QJsonValue &source, convertType<BaseItemDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return BaseItemDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const BaseItemDto &source, convertType<BaseItemDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void BaseItemDtoQueryResult::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject BaseItemDtoQueryResult::toJson() {
|
||||
QJsonObject BaseItemDtoQueryResult::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Items"] = Jellyfin::Support::toJsonValue<QList<BaseItemDto>>(m_items);
|
||||
result["TotalRecordCount"] = Jellyfin::Support::toJsonValue<qint32>(m_totalRecordCount);
|
||||
|
@ -103,10 +103,15 @@ namespace Support {
|
|||
using BaseItemDtoQueryResult = Jellyfin::DTO::BaseItemDtoQueryResult;
|
||||
|
||||
template <>
|
||||
BaseItemDtoQueryResult fromJsonValue<BaseItemDtoQueryResult>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
BaseItemDtoQueryResult fromJsonValue(const QJsonValue &source, convertType<BaseItemDtoQueryResult>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return BaseItemDtoQueryResult::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const BaseItemDtoQueryResult &source, convertType<BaseItemDtoQueryResult>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -66,18 +66,18 @@ void BaseItemPerson::setFromJson(QJsonObject source) {
|
|||
m_role = Jellyfin::Support::fromJsonValue<QString>(source["Role"]);
|
||||
m_type = Jellyfin::Support::fromJsonValue<QString>(source["Type"]);
|
||||
m_primaryImageTag = Jellyfin::Support::fromJsonValue<QString>(source["PrimaryImageTag"]);
|
||||
m_imageBlurHashes = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["ImageBlurHashes"]);
|
||||
m_imageBlurHashes = Jellyfin::Support::fromJsonValue<QJsonObject>(source["ImageBlurHashes"]);
|
||||
|
||||
}
|
||||
|
||||
QJsonObject BaseItemPerson::toJson() {
|
||||
QJsonObject BaseItemPerson::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Id"] = Jellyfin::Support::toJsonValue<QString>(m_jellyfinId);
|
||||
result["Role"] = Jellyfin::Support::toJsonValue<QString>(m_role);
|
||||
result["Type"] = Jellyfin::Support::toJsonValue<QString>(m_type);
|
||||
result["PrimaryImageTag"] = Jellyfin::Support::toJsonValue<QString>(m_primaryImageTag);
|
||||
result["ImageBlurHashes"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_imageBlurHashes);
|
||||
result["ImageBlurHashes"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_imageBlurHashes);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -147,17 +147,17 @@ void BaseItemPerson::setPrimaryImageTagNull() {
|
|||
m_primaryImageTag.clear();
|
||||
|
||||
}
|
||||
std::optional<QJsonObject> BaseItemPerson::imageBlurHashes() const { return m_imageBlurHashes; }
|
||||
QJsonObject BaseItemPerson::imageBlurHashes() const { return m_imageBlurHashes; }
|
||||
|
||||
void BaseItemPerson::setImageBlurHashes(std::optional<QJsonObject> newImageBlurHashes) {
|
||||
void BaseItemPerson::setImageBlurHashes(QJsonObject newImageBlurHashes) {
|
||||
m_imageBlurHashes = newImageBlurHashes;
|
||||
}
|
||||
bool BaseItemPerson::imageBlurHashesNull() const {
|
||||
return !m_imageBlurHashes.has_value();
|
||||
return m_imageBlurHashes.isEmpty();
|
||||
}
|
||||
|
||||
void BaseItemPerson::setImageBlurHashesNull() {
|
||||
m_imageBlurHashes = std::nullopt;
|
||||
m_imageBlurHashes= QJsonObject();
|
||||
|
||||
}
|
||||
|
||||
|
@ -168,10 +168,15 @@ namespace Support {
|
|||
using BaseItemPerson = Jellyfin::DTO::BaseItemPerson;
|
||||
|
||||
template <>
|
||||
BaseItemPerson fromJsonValue<BaseItemPerson>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
BaseItemPerson fromJsonValue(const QJsonValue &source, convertType<BaseItemPerson>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return BaseItemPerson::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const BaseItemPerson &source, convertType<BaseItemPerson>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -75,7 +75,7 @@ void BookInfo::setFromJson(QJsonObject source) {
|
|||
m_path = Jellyfin::Support::fromJsonValue<QString>(source["Path"]);
|
||||
m_metadataLanguage = Jellyfin::Support::fromJsonValue<QString>(source["MetadataLanguage"]);
|
||||
m_metadataCountryCode = Jellyfin::Support::fromJsonValue<QString>(source["MetadataCountryCode"]);
|
||||
m_providerIds = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["ProviderIds"]);
|
||||
m_providerIds = Jellyfin::Support::fromJsonValue<QJsonObject>(source["ProviderIds"]);
|
||||
m_year = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["Year"]);
|
||||
m_indexNumber = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["IndexNumber"]);
|
||||
m_parentIndexNumber = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["ParentIndexNumber"]);
|
||||
|
@ -85,13 +85,13 @@ void BookInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject BookInfo::toJson() {
|
||||
QJsonObject BookInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Path"] = Jellyfin::Support::toJsonValue<QString>(m_path);
|
||||
result["MetadataLanguage"] = Jellyfin::Support::toJsonValue<QString>(m_metadataLanguage);
|
||||
result["MetadataCountryCode"] = Jellyfin::Support::toJsonValue<QString>(m_metadataCountryCode);
|
||||
result["ProviderIds"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_providerIds);
|
||||
result["ProviderIds"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_providerIds);
|
||||
result["Year"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_year);
|
||||
result["IndexNumber"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_indexNumber);
|
||||
result["ParentIndexNumber"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_parentIndexNumber);
|
||||
|
@ -154,17 +154,17 @@ void BookInfo::setMetadataCountryCodeNull() {
|
|||
m_metadataCountryCode.clear();
|
||||
|
||||
}
|
||||
std::optional<QJsonObject> BookInfo::providerIds() const { return m_providerIds; }
|
||||
QJsonObject BookInfo::providerIds() const { return m_providerIds; }
|
||||
|
||||
void BookInfo::setProviderIds(std::optional<QJsonObject> newProviderIds) {
|
||||
void BookInfo::setProviderIds(QJsonObject newProviderIds) {
|
||||
m_providerIds = newProviderIds;
|
||||
}
|
||||
bool BookInfo::providerIdsNull() const {
|
||||
return !m_providerIds.has_value();
|
||||
return m_providerIds.isEmpty();
|
||||
}
|
||||
|
||||
void BookInfo::setProviderIdsNull() {
|
||||
m_providerIds = std::nullopt;
|
||||
m_providerIds= QJsonObject();
|
||||
|
||||
}
|
||||
std::optional<qint32> BookInfo::year() const { return m_year; }
|
||||
|
@ -246,10 +246,15 @@ namespace Support {
|
|||
using BookInfo = Jellyfin::DTO::BookInfo;
|
||||
|
||||
template <>
|
||||
BookInfo fromJsonValue<BookInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
BookInfo fromJsonValue(const QJsonValue &source, convertType<BookInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return BookInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const BookInfo &source, convertType<BookInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void BookInfoRemoteSearchQuery::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject BookInfoRemoteSearchQuery::toJson() {
|
||||
QJsonObject BookInfoRemoteSearchQuery::toJson() const {
|
||||
QJsonObject result;
|
||||
result["SearchInfo"] = Jellyfin::Support::toJsonValue<QSharedPointer<BookInfo>>(m_searchInfo);
|
||||
result["ItemId"] = Jellyfin::Support::toJsonValue<QString>(m_itemId);
|
||||
|
@ -113,10 +113,15 @@ namespace Support {
|
|||
using BookInfoRemoteSearchQuery = Jellyfin::DTO::BookInfoRemoteSearchQuery;
|
||||
|
||||
template <>
|
||||
BookInfoRemoteSearchQuery fromJsonValue<BookInfoRemoteSearchQuery>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
BookInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source, convertType<BookInfoRemoteSearchQuery>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return BookInfoRemoteSearchQuery::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const BookInfoRemoteSearchQuery &source, convertType<BookInfoRemoteSearchQuery>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -73,7 +73,7 @@ void BoxSetInfo::setFromJson(QJsonObject source) {
|
|||
m_path = Jellyfin::Support::fromJsonValue<QString>(source["Path"]);
|
||||
m_metadataLanguage = Jellyfin::Support::fromJsonValue<QString>(source["MetadataLanguage"]);
|
||||
m_metadataCountryCode = Jellyfin::Support::fromJsonValue<QString>(source["MetadataCountryCode"]);
|
||||
m_providerIds = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["ProviderIds"]);
|
||||
m_providerIds = Jellyfin::Support::fromJsonValue<QJsonObject>(source["ProviderIds"]);
|
||||
m_year = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["Year"]);
|
||||
m_indexNumber = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["IndexNumber"]);
|
||||
m_parentIndexNumber = Jellyfin::Support::fromJsonValue<std::optional<qint32>>(source["ParentIndexNumber"]);
|
||||
|
@ -82,13 +82,13 @@ void BoxSetInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject BoxSetInfo::toJson() {
|
||||
QJsonObject BoxSetInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Path"] = Jellyfin::Support::toJsonValue<QString>(m_path);
|
||||
result["MetadataLanguage"] = Jellyfin::Support::toJsonValue<QString>(m_metadataLanguage);
|
||||
result["MetadataCountryCode"] = Jellyfin::Support::toJsonValue<QString>(m_metadataCountryCode);
|
||||
result["ProviderIds"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_providerIds);
|
||||
result["ProviderIds"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_providerIds);
|
||||
result["Year"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_year);
|
||||
result["IndexNumber"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_indexNumber);
|
||||
result["ParentIndexNumber"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_parentIndexNumber);
|
||||
|
@ -150,17 +150,17 @@ void BoxSetInfo::setMetadataCountryCodeNull() {
|
|||
m_metadataCountryCode.clear();
|
||||
|
||||
}
|
||||
std::optional<QJsonObject> BoxSetInfo::providerIds() const { return m_providerIds; }
|
||||
QJsonObject BoxSetInfo::providerIds() const { return m_providerIds; }
|
||||
|
||||
void BoxSetInfo::setProviderIds(std::optional<QJsonObject> newProviderIds) {
|
||||
void BoxSetInfo::setProviderIds(QJsonObject newProviderIds) {
|
||||
m_providerIds = newProviderIds;
|
||||
}
|
||||
bool BoxSetInfo::providerIdsNull() const {
|
||||
return !m_providerIds.has_value();
|
||||
return m_providerIds.isEmpty();
|
||||
}
|
||||
|
||||
void BoxSetInfo::setProviderIdsNull() {
|
||||
m_providerIds = std::nullopt;
|
||||
m_providerIds= QJsonObject();
|
||||
|
||||
}
|
||||
std::optional<qint32> BoxSetInfo::year() const { return m_year; }
|
||||
|
@ -229,10 +229,15 @@ namespace Support {
|
|||
using BoxSetInfo = Jellyfin::DTO::BoxSetInfo;
|
||||
|
||||
template <>
|
||||
BoxSetInfo fromJsonValue<BoxSetInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
BoxSetInfo fromJsonValue(const QJsonValue &source, convertType<BoxSetInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return BoxSetInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const BoxSetInfo &source, convertType<BoxSetInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void BoxSetInfoRemoteSearchQuery::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject BoxSetInfoRemoteSearchQuery::toJson() {
|
||||
QJsonObject BoxSetInfoRemoteSearchQuery::toJson() const {
|
||||
QJsonObject result;
|
||||
result["SearchInfo"] = Jellyfin::Support::toJsonValue<QSharedPointer<BoxSetInfo>>(m_searchInfo);
|
||||
result["ItemId"] = Jellyfin::Support::toJsonValue<QString>(m_itemId);
|
||||
|
@ -113,10 +113,15 @@ namespace Support {
|
|||
using BoxSetInfoRemoteSearchQuery = Jellyfin::DTO::BoxSetInfoRemoteSearchQuery;
|
||||
|
||||
template <>
|
||||
BoxSetInfoRemoteSearchQuery fromJsonValue<BoxSetInfoRemoteSearchQuery>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
BoxSetInfoRemoteSearchQuery fromJsonValue(const QJsonValue &source, convertType<BoxSetInfoRemoteSearchQuery>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return BoxSetInfoRemoteSearchQuery::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const BoxSetInfoRemoteSearchQuery &source, convertType<BoxSetInfoRemoteSearchQuery>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -58,7 +58,7 @@ void BrandingOptions::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject BrandingOptions::toJson() {
|
||||
QJsonObject BrandingOptions::toJson() const {
|
||||
QJsonObject result;
|
||||
result["LoginDisclaimer"] = Jellyfin::Support::toJsonValue<QString>(m_loginDisclaimer);
|
||||
result["CustomCss"] = Jellyfin::Support::toJsonValue<QString>(m_customCss);
|
||||
|
@ -100,10 +100,15 @@ namespace Support {
|
|||
using BrandingOptions = Jellyfin::DTO::BrandingOptions;
|
||||
|
||||
template <>
|
||||
BrandingOptions fromJsonValue<BrandingOptions>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
BrandingOptions fromJsonValue(const QJsonValue &source, convertType<BrandingOptions>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return BrandingOptions::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const BrandingOptions &source, convertType<BrandingOptions>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void BufferRequestDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject BufferRequestDto::toJson() {
|
||||
QJsonObject BufferRequestDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["When"] = Jellyfin::Support::toJsonValue<QDateTime>(m_when);
|
||||
result["PositionTicks"] = Jellyfin::Support::toJsonValue<qint64>(m_positionTicks);
|
||||
|
@ -106,10 +106,15 @@ namespace Support {
|
|||
using BufferRequestDto = Jellyfin::DTO::BufferRequestDto;
|
||||
|
||||
template <>
|
||||
BufferRequestDto fromJsonValue<BufferRequestDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
BufferRequestDto fromJsonValue(const QJsonValue &source, convertType<BufferRequestDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return BufferRequestDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const BufferRequestDto &source, convertType<BufferRequestDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -88,7 +88,7 @@ void ChannelFeatures::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ChannelFeatures::toJson() {
|
||||
QJsonObject ChannelFeatures::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Id"] = Jellyfin::Support::toJsonValue<QString>(m_jellyfinId);
|
||||
|
@ -235,10 +235,15 @@ namespace Support {
|
|||
using ChannelFeatures = Jellyfin::DTO::ChannelFeatures;
|
||||
|
||||
template <>
|
||||
ChannelFeatures fromJsonValue<ChannelFeatures>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ChannelFeatures fromJsonValue(const QJsonValue &source, convertType<ChannelFeatures>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ChannelFeatures::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ChannelFeatures &source, convertType<ChannelFeatures>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ChannelItemSortFieldClass::ChannelItemSortFieldClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ChannelItemSortField = Jellyfin::DTO::ChannelItemSortField;
|
||||
|
||||
template <>
|
||||
ChannelItemSortField fromJsonValue<ChannelItemSortField>(const QJsonValue &source) {
|
||||
ChannelItemSortField fromJsonValue(const QJsonValue &source, convertType<ChannelItemSortField>) {
|
||||
if (!source.isString()) return ChannelItemSortField::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -71,5 +70,29 @@ ChannelItemSortField fromJsonValue<ChannelItemSortField>(const QJsonValue &sourc
|
|||
return ChannelItemSortField::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ChannelItemSortField &source, convertType<ChannelItemSortField>) {
|
||||
switch(source) {
|
||||
case ChannelItemSortField::Name:
|
||||
return QStringLiteral("Name");
|
||||
case ChannelItemSortField::CommunityRating:
|
||||
return QStringLiteral("CommunityRating");
|
||||
case ChannelItemSortField::PremiereDate:
|
||||
return QStringLiteral("PremiereDate");
|
||||
case ChannelItemSortField::DateCreated:
|
||||
return QStringLiteral("DateCreated");
|
||||
case ChannelItemSortField::Runtime:
|
||||
return QStringLiteral("Runtime");
|
||||
case ChannelItemSortField::PlayCount:
|
||||
return QStringLiteral("PlayCount");
|
||||
case ChannelItemSortField::CommunityPlayCount:
|
||||
return QStringLiteral("CommunityPlayCount");
|
||||
|
||||
case ChannelItemSortField::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void ChannelMappingOptionsDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ChannelMappingOptionsDto::toJson() {
|
||||
QJsonObject ChannelMappingOptionsDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["TunerChannels"] = Jellyfin::Support::toJsonValue<QList<TunerChannelMapping>>(m_tunerChannels);
|
||||
result["ProviderChannels"] = Jellyfin::Support::toJsonValue<QList<NameIdPair>>(m_providerChannels);
|
||||
|
@ -134,10 +134,15 @@ namespace Support {
|
|||
using ChannelMappingOptionsDto = Jellyfin::DTO::ChannelMappingOptionsDto;
|
||||
|
||||
template <>
|
||||
ChannelMappingOptionsDto fromJsonValue<ChannelMappingOptionsDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ChannelMappingOptionsDto fromJsonValue(const QJsonValue &source, convertType<ChannelMappingOptionsDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ChannelMappingOptionsDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ChannelMappingOptionsDto &source, convertType<ChannelMappingOptionsDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ChannelMediaContentTypeClass::ChannelMediaContentTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ChannelMediaContentType = Jellyfin::DTO::ChannelMediaContentType;
|
||||
|
||||
template <>
|
||||
ChannelMediaContentType fromJsonValue<ChannelMediaContentType>(const QJsonValue &source) {
|
||||
ChannelMediaContentType fromJsonValue(const QJsonValue &source, convertType<ChannelMediaContentType>) {
|
||||
if (!source.isString()) return ChannelMediaContentType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -74,5 +73,31 @@ ChannelMediaContentType fromJsonValue<ChannelMediaContentType>(const QJsonValue
|
|||
return ChannelMediaContentType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ChannelMediaContentType &source, convertType<ChannelMediaContentType>) {
|
||||
switch(source) {
|
||||
case ChannelMediaContentType::Clip:
|
||||
return QStringLiteral("Clip");
|
||||
case ChannelMediaContentType::Podcast:
|
||||
return QStringLiteral("Podcast");
|
||||
case ChannelMediaContentType::Trailer:
|
||||
return QStringLiteral("Trailer");
|
||||
case ChannelMediaContentType::Movie:
|
||||
return QStringLiteral("Movie");
|
||||
case ChannelMediaContentType::Episode:
|
||||
return QStringLiteral("Episode");
|
||||
case ChannelMediaContentType::Song:
|
||||
return QStringLiteral("Song");
|
||||
case ChannelMediaContentType::MovieExtra:
|
||||
return QStringLiteral("MovieExtra");
|
||||
case ChannelMediaContentType::TvExtra:
|
||||
return QStringLiteral("TvExtra");
|
||||
|
||||
case ChannelMediaContentType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ChannelMediaTypeClass::ChannelMediaTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ChannelMediaType = Jellyfin::DTO::ChannelMediaType;
|
||||
|
||||
template <>
|
||||
ChannelMediaType fromJsonValue<ChannelMediaType>(const QJsonValue &source) {
|
||||
ChannelMediaType fromJsonValue(const QJsonValue &source, convertType<ChannelMediaType>) {
|
||||
if (!source.isString()) return ChannelMediaType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -59,5 +58,21 @@ ChannelMediaType fromJsonValue<ChannelMediaType>(const QJsonValue &source) {
|
|||
return ChannelMediaType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ChannelMediaType &source, convertType<ChannelMediaType>) {
|
||||
switch(source) {
|
||||
case ChannelMediaType::Audio:
|
||||
return QStringLiteral("Audio");
|
||||
case ChannelMediaType::Video:
|
||||
return QStringLiteral("Video");
|
||||
case ChannelMediaType::Photo:
|
||||
return QStringLiteral("Photo");
|
||||
|
||||
case ChannelMediaType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ChannelTypeClass::ChannelTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ChannelType = Jellyfin::DTO::ChannelType;
|
||||
|
||||
template <>
|
||||
ChannelType fromJsonValue<ChannelType>(const QJsonValue &source) {
|
||||
ChannelType fromJsonValue(const QJsonValue &source, convertType<ChannelType>) {
|
||||
if (!source.isString()) return ChannelType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -56,5 +55,19 @@ ChannelType fromJsonValue<ChannelType>(const QJsonValue &source) {
|
|||
return ChannelType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ChannelType &source, convertType<ChannelType>) {
|
||||
switch(source) {
|
||||
case ChannelType::TV:
|
||||
return QStringLiteral("TV");
|
||||
case ChannelType::Radio:
|
||||
return QStringLiteral("Radio");
|
||||
|
||||
case ChannelType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -67,7 +67,7 @@ void ChapterInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ChapterInfo::toJson() {
|
||||
QJsonObject ChapterInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["StartPositionTicks"] = Jellyfin::Support::toJsonValue<qint64>(m_startPositionTicks);
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
|
@ -137,10 +137,15 @@ namespace Support {
|
|||
using ChapterInfo = Jellyfin::DTO::ChapterInfo;
|
||||
|
||||
template <>
|
||||
ChapterInfo fromJsonValue<ChapterInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ChapterInfo fromJsonValue(const QJsonValue &source, convertType<ChapterInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ChapterInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ChapterInfo &source, convertType<ChapterInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -82,7 +82,7 @@ void ClientCapabilities::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ClientCapabilities::toJson() {
|
||||
QJsonObject ClientCapabilities::toJson() const {
|
||||
QJsonObject result;
|
||||
result["PlayableMediaTypes"] = Jellyfin::Support::toJsonValue<QStringList>(m_playableMediaTypes);
|
||||
result["SupportedCommands"] = Jellyfin::Support::toJsonValue<QList<GeneralCommandType>>(m_supportedCommands);
|
||||
|
@ -201,10 +201,15 @@ namespace Support {
|
|||
using ClientCapabilities = Jellyfin::DTO::ClientCapabilities;
|
||||
|
||||
template <>
|
||||
ClientCapabilities fromJsonValue<ClientCapabilities>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ClientCapabilities fromJsonValue(const QJsonValue &source, convertType<ClientCapabilities>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ClientCapabilities::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ClientCapabilities &source, convertType<ClientCapabilities>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -82,7 +82,7 @@ void ClientCapabilitiesDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ClientCapabilitiesDto::toJson() {
|
||||
QJsonObject ClientCapabilitiesDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["PlayableMediaTypes"] = Jellyfin::Support::toJsonValue<QStringList>(m_playableMediaTypes);
|
||||
result["SupportedCommands"] = Jellyfin::Support::toJsonValue<QList<GeneralCommandType>>(m_supportedCommands);
|
||||
|
@ -201,10 +201,15 @@ namespace Support {
|
|||
using ClientCapabilitiesDto = Jellyfin::DTO::ClientCapabilitiesDto;
|
||||
|
||||
template <>
|
||||
ClientCapabilitiesDto fromJsonValue<ClientCapabilitiesDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ClientCapabilitiesDto fromJsonValue(const QJsonValue &source, convertType<ClientCapabilitiesDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ClientCapabilitiesDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ClientCapabilitiesDto &source, convertType<ClientCapabilitiesDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -67,7 +67,7 @@ void CodecProfile::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject CodecProfile::toJson() {
|
||||
QJsonObject CodecProfile::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Type"] = Jellyfin::Support::toJsonValue<CodecType>(m_type);
|
||||
result["Conditions"] = Jellyfin::Support::toJsonValue<QList<ProfileCondition>>(m_conditions);
|
||||
|
@ -144,10 +144,15 @@ namespace Support {
|
|||
using CodecProfile = Jellyfin::DTO::CodecProfile;
|
||||
|
||||
template <>
|
||||
CodecProfile fromJsonValue<CodecProfile>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
CodecProfile fromJsonValue(const QJsonValue &source, convertType<CodecProfile>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return CodecProfile::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const CodecProfile &source, convertType<CodecProfile>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
CodecTypeClass::CodecTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using CodecType = Jellyfin::DTO::CodecType;
|
||||
|
||||
template <>
|
||||
CodecType fromJsonValue<CodecType>(const QJsonValue &source) {
|
||||
CodecType fromJsonValue(const QJsonValue &source, convertType<CodecType>) {
|
||||
if (!source.isString()) return CodecType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -59,5 +58,21 @@ CodecType fromJsonValue<CodecType>(const QJsonValue &source) {
|
|||
return CodecType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const CodecType &source, convertType<CodecType>) {
|
||||
switch(source) {
|
||||
case CodecType::Video:
|
||||
return QStringLiteral("Video");
|
||||
case CodecType::VideoAudio:
|
||||
return QStringLiteral("VideoAudio");
|
||||
case CodecType::Audio:
|
||||
return QStringLiteral("Audio");
|
||||
|
||||
case CodecType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -55,7 +55,7 @@ void CollectionCreationResult::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject CollectionCreationResult::toJson() {
|
||||
QJsonObject CollectionCreationResult::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Id"] = Jellyfin::Support::toJsonValue<QString>(m_jellyfinId);
|
||||
|
||||
|
@ -76,10 +76,15 @@ namespace Support {
|
|||
using CollectionCreationResult = Jellyfin::DTO::CollectionCreationResult;
|
||||
|
||||
template <>
|
||||
CollectionCreationResult fromJsonValue<CollectionCreationResult>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
CollectionCreationResult fromJsonValue(const QJsonValue &source, convertType<CollectionCreationResult>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return CollectionCreationResult::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const CollectionCreationResult &source, convertType<CollectionCreationResult>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -73,7 +73,7 @@ void ConfigurationPageInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ConfigurationPageInfo::toJson() {
|
||||
QJsonObject ConfigurationPageInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["EnableInMainMenu"] = Jellyfin::Support::toJsonValue<bool>(m_enableInMainMenu);
|
||||
|
@ -171,10 +171,15 @@ namespace Support {
|
|||
using ConfigurationPageInfo = Jellyfin::DTO::ConfigurationPageInfo;
|
||||
|
||||
template <>
|
||||
ConfigurationPageInfo fromJsonValue<ConfigurationPageInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ConfigurationPageInfo fromJsonValue(const QJsonValue &source, convertType<ConfigurationPageInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ConfigurationPageInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ConfigurationPageInfo &source, convertType<ConfigurationPageInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ConfigurationPageTypeClass::ConfigurationPageTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ConfigurationPageType = Jellyfin::DTO::ConfigurationPageType;
|
||||
|
||||
template <>
|
||||
ConfigurationPageType fromJsonValue<ConfigurationPageType>(const QJsonValue &source) {
|
||||
ConfigurationPageType fromJsonValue(const QJsonValue &source, convertType<ConfigurationPageType>) {
|
||||
if (!source.isString()) return ConfigurationPageType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -56,5 +55,19 @@ ConfigurationPageType fromJsonValue<ConfigurationPageType>(const QJsonValue &sou
|
|||
return ConfigurationPageType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ConfigurationPageType &source, convertType<ConfigurationPageType>) {
|
||||
switch(source) {
|
||||
case ConfigurationPageType::PluginConfiguration:
|
||||
return QStringLiteral("PluginConfiguration");
|
||||
case ConfigurationPageType::None:
|
||||
return QStringLiteral("None");
|
||||
|
||||
case ConfigurationPageType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void ContainerProfile::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ContainerProfile::toJson() {
|
||||
QJsonObject ContainerProfile::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Type"] = Jellyfin::Support::toJsonValue<DlnaProfileType>(m_type);
|
||||
result["Conditions"] = Jellyfin::Support::toJsonValue<QList<ProfileCondition>>(m_conditions);
|
||||
|
@ -110,10 +110,15 @@ namespace Support {
|
|||
using ContainerProfile = Jellyfin::DTO::ContainerProfile;
|
||||
|
||||
template <>
|
||||
ContainerProfile fromJsonValue<ContainerProfile>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ContainerProfile fromJsonValue(const QJsonValue &source, convertType<ContainerProfile>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ContainerProfile::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ContainerProfile &source, convertType<ContainerProfile>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -55,32 +55,32 @@ ControlResponse ControlResponse::fromJson(QJsonObject source) {
|
|||
|
||||
|
||||
void ControlResponse::setFromJson(QJsonObject source) {
|
||||
m_headers = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["Headers"]);
|
||||
m_headers = Jellyfin::Support::fromJsonValue<QJsonObject>(source["Headers"]);
|
||||
m_xml = Jellyfin::Support::fromJsonValue<QString>(source["Xml"]);
|
||||
m_isSuccessful = Jellyfin::Support::fromJsonValue<bool>(source["IsSuccessful"]);
|
||||
|
||||
}
|
||||
|
||||
QJsonObject ControlResponse::toJson() {
|
||||
QJsonObject ControlResponse::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Headers"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_headers);
|
||||
result["Headers"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_headers);
|
||||
result["Xml"] = Jellyfin::Support::toJsonValue<QString>(m_xml);
|
||||
result["IsSuccessful"] = Jellyfin::Support::toJsonValue<bool>(m_isSuccessful);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::optional<QJsonObject> ControlResponse::headers() const { return m_headers; }
|
||||
QJsonObject ControlResponse::headers() const { return m_headers; }
|
||||
|
||||
void ControlResponse::setHeaders(std::optional<QJsonObject> newHeaders) {
|
||||
void ControlResponse::setHeaders(QJsonObject newHeaders) {
|
||||
m_headers = newHeaders;
|
||||
}
|
||||
bool ControlResponse::headersNull() const {
|
||||
return !m_headers.has_value();
|
||||
return m_headers.isEmpty();
|
||||
}
|
||||
|
||||
void ControlResponse::setHeadersNull() {
|
||||
m_headers = std::nullopt;
|
||||
m_headers= QJsonObject();
|
||||
|
||||
}
|
||||
QString ControlResponse::xml() const { return m_xml; }
|
||||
|
@ -110,10 +110,15 @@ namespace Support {
|
|||
using ControlResponse = Jellyfin::DTO::ControlResponse;
|
||||
|
||||
template <>
|
||||
ControlResponse fromJsonValue<ControlResponse>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ControlResponse fromJsonValue(const QJsonValue &source, convertType<ControlResponse>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ControlResponse::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ControlResponse &source, convertType<ControlResponse>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void CountryInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject CountryInfo::toJson() {
|
||||
QJsonObject CountryInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["DisplayName"] = Jellyfin::Support::toJsonValue<QString>(m_displayName);
|
||||
|
@ -134,10 +134,15 @@ namespace Support {
|
|||
using CountryInfo = Jellyfin::DTO::CountryInfo;
|
||||
|
||||
template <>
|
||||
CountryInfo fromJsonValue<CountryInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
CountryInfo fromJsonValue(const QJsonValue &source, convertType<CountryInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return CountryInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const CountryInfo &source, convertType<CountryInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void CreatePlaylistDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject CreatePlaylistDto::toJson() {
|
||||
QJsonObject CreatePlaylistDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Ids"] = Jellyfin::Support::toJsonValue<QStringList>(m_ids);
|
||||
|
@ -134,10 +134,15 @@ namespace Support {
|
|||
using CreatePlaylistDto = Jellyfin::DTO::CreatePlaylistDto;
|
||||
|
||||
template <>
|
||||
CreatePlaylistDto fromJsonValue<CreatePlaylistDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
CreatePlaylistDto fromJsonValue(const QJsonValue &source, convertType<CreatePlaylistDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return CreatePlaylistDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const CreatePlaylistDto &source, convertType<CreatePlaylistDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -58,7 +58,7 @@ void CreateUserByName::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject CreateUserByName::toJson() {
|
||||
QJsonObject CreateUserByName::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Password"] = Jellyfin::Support::toJsonValue<QString>(m_password);
|
||||
|
@ -100,10 +100,15 @@ namespace Support {
|
|||
using CreateUserByName = Jellyfin::DTO::CreateUserByName;
|
||||
|
||||
template <>
|
||||
CreateUserByName fromJsonValue<CreateUserByName>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
CreateUserByName fromJsonValue(const QJsonValue &source, convertType<CreateUserByName>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return CreateUserByName::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const CreateUserByName &source, convertType<CreateUserByName>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -67,7 +67,7 @@ void CultureDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject CultureDto::toJson() {
|
||||
QJsonObject CultureDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["DisplayName"] = Jellyfin::Support::toJsonValue<QString>(m_displayName);
|
||||
|
@ -151,10 +151,15 @@ namespace Support {
|
|||
using CultureDto = Jellyfin::DTO::CultureDto;
|
||||
|
||||
template <>
|
||||
CultureDto fromJsonValue<CultureDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
CultureDto fromJsonValue(const QJsonValue &source, convertType<CultureDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return CultureDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const CultureDto &source, convertType<CultureDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
DayOfWeekClass::DayOfWeekClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using DayOfWeek = Jellyfin::DTO::DayOfWeek;
|
||||
|
||||
template <>
|
||||
DayOfWeek fromJsonValue<DayOfWeek>(const QJsonValue &source) {
|
||||
DayOfWeek fromJsonValue(const QJsonValue &source, convertType<DayOfWeek>) {
|
||||
if (!source.isString()) return DayOfWeek::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -71,5 +70,29 @@ DayOfWeek fromJsonValue<DayOfWeek>(const QJsonValue &source) {
|
|||
return DayOfWeek::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const DayOfWeek &source, convertType<DayOfWeek>) {
|
||||
switch(source) {
|
||||
case DayOfWeek::Sunday:
|
||||
return QStringLiteral("Sunday");
|
||||
case DayOfWeek::Monday:
|
||||
return QStringLiteral("Monday");
|
||||
case DayOfWeek::Tuesday:
|
||||
return QStringLiteral("Tuesday");
|
||||
case DayOfWeek::Wednesday:
|
||||
return QStringLiteral("Wednesday");
|
||||
case DayOfWeek::Thursday:
|
||||
return QStringLiteral("Thursday");
|
||||
case DayOfWeek::Friday:
|
||||
return QStringLiteral("Friday");
|
||||
case DayOfWeek::Saturday:
|
||||
return QStringLiteral("Saturday");
|
||||
|
||||
case DayOfWeek::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
DayPatternClass::DayPatternClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using DayPattern = Jellyfin::DTO::DayPattern;
|
||||
|
||||
template <>
|
||||
DayPattern fromJsonValue<DayPattern>(const QJsonValue &source) {
|
||||
DayPattern fromJsonValue(const QJsonValue &source, convertType<DayPattern>) {
|
||||
if (!source.isString()) return DayPattern::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -59,5 +58,21 @@ DayPattern fromJsonValue<DayPattern>(const QJsonValue &source) {
|
|||
return DayPattern::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const DayPattern &source, convertType<DayPattern>) {
|
||||
switch(source) {
|
||||
case DayPattern::Daily:
|
||||
return QStringLiteral("Daily");
|
||||
case DayPattern::Weekdays:
|
||||
return QStringLiteral("Weekdays");
|
||||
case DayPattern::Weekends:
|
||||
return QStringLiteral("Weekends");
|
||||
|
||||
case DayPattern::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -55,7 +55,7 @@ void DefaultDirectoryBrowserInfoDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject DefaultDirectoryBrowserInfoDto::toJson() {
|
||||
QJsonObject DefaultDirectoryBrowserInfoDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Path"] = Jellyfin::Support::toJsonValue<QString>(m_path);
|
||||
|
||||
|
@ -83,10 +83,15 @@ namespace Support {
|
|||
using DefaultDirectoryBrowserInfoDto = Jellyfin::DTO::DefaultDirectoryBrowserInfoDto;
|
||||
|
||||
template <>
|
||||
DefaultDirectoryBrowserInfoDto fromJsonValue<DefaultDirectoryBrowserInfoDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
DefaultDirectoryBrowserInfoDto fromJsonValue(const QJsonValue &source, convertType<DefaultDirectoryBrowserInfoDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return DefaultDirectoryBrowserInfoDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const DefaultDirectoryBrowserInfoDto &source, convertType<DefaultDirectoryBrowserInfoDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -79,7 +79,7 @@ void DeviceIdentification::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject DeviceIdentification::toJson() {
|
||||
QJsonObject DeviceIdentification::toJson() const {
|
||||
QJsonObject result;
|
||||
result["FriendlyName"] = Jellyfin::Support::toJsonValue<QString>(m_friendlyName);
|
||||
result["ModelNumber"] = Jellyfin::Support::toJsonValue<QString>(m_modelNumber);
|
||||
|
@ -219,10 +219,15 @@ namespace Support {
|
|||
using DeviceIdentification = Jellyfin::DTO::DeviceIdentification;
|
||||
|
||||
template <>
|
||||
DeviceIdentification fromJsonValue<DeviceIdentification>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
DeviceIdentification fromJsonValue(const QJsonValue &source, convertType<DeviceIdentification>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return DeviceIdentification::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const DeviceIdentification &source, convertType<DeviceIdentification>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -79,7 +79,7 @@ void DeviceInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject DeviceInfo::toJson() {
|
||||
QJsonObject DeviceInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Id"] = Jellyfin::Support::toJsonValue<QString>(m_jellyfinId);
|
||||
|
@ -198,10 +198,15 @@ namespace Support {
|
|||
using DeviceInfo = Jellyfin::DTO::DeviceInfo;
|
||||
|
||||
template <>
|
||||
DeviceInfo fromJsonValue<DeviceInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
DeviceInfo fromJsonValue(const QJsonValue &source, convertType<DeviceInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return DeviceInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const DeviceInfo &source, convertType<DeviceInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void DeviceInfoQueryResult::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject DeviceInfoQueryResult::toJson() {
|
||||
QJsonObject DeviceInfoQueryResult::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Items"] = Jellyfin::Support::toJsonValue<QList<DeviceInfo>>(m_items);
|
||||
result["TotalRecordCount"] = Jellyfin::Support::toJsonValue<qint32>(m_totalRecordCount);
|
||||
|
@ -103,10 +103,15 @@ namespace Support {
|
|||
using DeviceInfoQueryResult = Jellyfin::DTO::DeviceInfoQueryResult;
|
||||
|
||||
template <>
|
||||
DeviceInfoQueryResult fromJsonValue<DeviceInfoQueryResult>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
DeviceInfoQueryResult fromJsonValue(const QJsonValue &source, convertType<DeviceInfoQueryResult>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return DeviceInfoQueryResult::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const DeviceInfoQueryResult &source, convertType<DeviceInfoQueryResult>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -55,7 +55,7 @@ void DeviceOptions::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject DeviceOptions::toJson() {
|
||||
QJsonObject DeviceOptions::toJson() const {
|
||||
QJsonObject result;
|
||||
result["CustomName"] = Jellyfin::Support::toJsonValue<QString>(m_customName);
|
||||
|
||||
|
@ -83,10 +83,15 @@ namespace Support {
|
|||
using DeviceOptions = Jellyfin::DTO::DeviceOptions;
|
||||
|
||||
template <>
|
||||
DeviceOptions fromJsonValue<DeviceOptions>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
DeviceOptions fromJsonValue(const QJsonValue &source, convertType<DeviceOptions>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return DeviceOptions::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const DeviceOptions &source, convertType<DeviceOptions>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -169,7 +169,7 @@ void DeviceProfile::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject DeviceProfile::toJson() {
|
||||
QJsonObject DeviceProfile::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Id"] = Jellyfin::Support::toJsonValue<QString>(m_jellyfinId);
|
||||
|
@ -652,10 +652,15 @@ namespace Support {
|
|||
using DeviceProfile = Jellyfin::DTO::DeviceProfile;
|
||||
|
||||
template <>
|
||||
DeviceProfile fromJsonValue<DeviceProfile>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
DeviceProfile fromJsonValue(const QJsonValue &source, convertType<DeviceProfile>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return DeviceProfile::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const DeviceProfile &source, convertType<DeviceProfile>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void DeviceProfileInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject DeviceProfileInfo::toJson() {
|
||||
QJsonObject DeviceProfileInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Id"] = Jellyfin::Support::toJsonValue<QString>(m_jellyfinId);
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
|
@ -110,10 +110,15 @@ namespace Support {
|
|||
using DeviceProfileInfo = Jellyfin::DTO::DeviceProfileInfo;
|
||||
|
||||
template <>
|
||||
DeviceProfileInfo fromJsonValue<DeviceProfileInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
DeviceProfileInfo fromJsonValue(const QJsonValue &source, convertType<DeviceProfileInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return DeviceProfileInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const DeviceProfileInfo &source, convertType<DeviceProfileInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
DeviceProfileTypeClass::DeviceProfileTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using DeviceProfileType = Jellyfin::DTO::DeviceProfileType;
|
||||
|
||||
template <>
|
||||
DeviceProfileType fromJsonValue<DeviceProfileType>(const QJsonValue &source) {
|
||||
DeviceProfileType fromJsonValue(const QJsonValue &source, convertType<DeviceProfileType>) {
|
||||
if (!source.isString()) return DeviceProfileType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -56,5 +55,19 @@ DeviceProfileType fromJsonValue<DeviceProfileType>(const QJsonValue &source) {
|
|||
return DeviceProfileType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const DeviceProfileType &source, convertType<DeviceProfileType>) {
|
||||
switch(source) {
|
||||
case DeviceProfileType::System:
|
||||
return QStringLiteral("System");
|
||||
case DeviceProfileType::User:
|
||||
return QStringLiteral("User");
|
||||
|
||||
case DeviceProfileType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void DirectPlayProfile::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject DirectPlayProfile::toJson() {
|
||||
QJsonObject DirectPlayProfile::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Container"] = Jellyfin::Support::toJsonValue<QString>(m_container);
|
||||
result["AudioCodec"] = Jellyfin::Support::toJsonValue<QString>(m_audioCodec);
|
||||
|
@ -127,10 +127,15 @@ namespace Support {
|
|||
using DirectPlayProfile = Jellyfin::DTO::DirectPlayProfile;
|
||||
|
||||
template <>
|
||||
DirectPlayProfile fromJsonValue<DirectPlayProfile>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
DirectPlayProfile fromJsonValue(const QJsonValue &source, convertType<DirectPlayProfile>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return DirectPlayProfile::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const DirectPlayProfile &source, convertType<DirectPlayProfile>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -84,7 +84,7 @@ void DisplayPreferencesDto::setFromJson(QJsonObject source) {
|
|||
m_rememberIndexing = Jellyfin::Support::fromJsonValue<bool>(source["RememberIndexing"]);
|
||||
m_primaryImageHeight = Jellyfin::Support::fromJsonValue<qint32>(source["PrimaryImageHeight"]);
|
||||
m_primaryImageWidth = Jellyfin::Support::fromJsonValue<qint32>(source["PrimaryImageWidth"]);
|
||||
m_customPrefs = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["CustomPrefs"]);
|
||||
m_customPrefs = Jellyfin::Support::fromJsonValue<QJsonObject>(source["CustomPrefs"]);
|
||||
m_scrollDirection = Jellyfin::Support::fromJsonValue<ScrollDirection>(source["ScrollDirection"]);
|
||||
m_showBackdrop = Jellyfin::Support::fromJsonValue<bool>(source["ShowBackdrop"]);
|
||||
m_rememberSorting = Jellyfin::Support::fromJsonValue<bool>(source["RememberSorting"]);
|
||||
|
@ -94,7 +94,7 @@ void DisplayPreferencesDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject DisplayPreferencesDto::toJson() {
|
||||
QJsonObject DisplayPreferencesDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Id"] = Jellyfin::Support::toJsonValue<QString>(m_jellyfinId);
|
||||
result["ViewType"] = Jellyfin::Support::toJsonValue<QString>(m_viewType);
|
||||
|
@ -103,7 +103,7 @@ QJsonObject DisplayPreferencesDto::toJson() {
|
|||
result["RememberIndexing"] = Jellyfin::Support::toJsonValue<bool>(m_rememberIndexing);
|
||||
result["PrimaryImageHeight"] = Jellyfin::Support::toJsonValue<qint32>(m_primaryImageHeight);
|
||||
result["PrimaryImageWidth"] = Jellyfin::Support::toJsonValue<qint32>(m_primaryImageWidth);
|
||||
result["CustomPrefs"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_customPrefs);
|
||||
result["CustomPrefs"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_customPrefs);
|
||||
result["ScrollDirection"] = Jellyfin::Support::toJsonValue<ScrollDirection>(m_scrollDirection);
|
||||
result["ShowBackdrop"] = Jellyfin::Support::toJsonValue<bool>(m_showBackdrop);
|
||||
result["RememberSorting"] = Jellyfin::Support::toJsonValue<bool>(m_rememberSorting);
|
||||
|
@ -184,17 +184,17 @@ void DisplayPreferencesDto::setPrimaryImageWidth(qint32 newPrimaryImageWidth) {
|
|||
m_primaryImageWidth = newPrimaryImageWidth;
|
||||
}
|
||||
|
||||
std::optional<QJsonObject> DisplayPreferencesDto::customPrefs() const { return m_customPrefs; }
|
||||
QJsonObject DisplayPreferencesDto::customPrefs() const { return m_customPrefs; }
|
||||
|
||||
void DisplayPreferencesDto::setCustomPrefs(std::optional<QJsonObject> newCustomPrefs) {
|
||||
void DisplayPreferencesDto::setCustomPrefs(QJsonObject newCustomPrefs) {
|
||||
m_customPrefs = newCustomPrefs;
|
||||
}
|
||||
bool DisplayPreferencesDto::customPrefsNull() const {
|
||||
return !m_customPrefs.has_value();
|
||||
return m_customPrefs.isEmpty();
|
||||
}
|
||||
|
||||
void DisplayPreferencesDto::setCustomPrefsNull() {
|
||||
m_customPrefs = std::nullopt;
|
||||
m_customPrefs= QJsonObject();
|
||||
|
||||
}
|
||||
ScrollDirection DisplayPreferencesDto::scrollDirection() const { return m_scrollDirection; }
|
||||
|
@ -248,10 +248,15 @@ namespace Support {
|
|||
using DisplayPreferencesDto = Jellyfin::DTO::DisplayPreferencesDto;
|
||||
|
||||
template <>
|
||||
DisplayPreferencesDto fromJsonValue<DisplayPreferencesDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
DisplayPreferencesDto fromJsonValue(const QJsonValue &source, convertType<DisplayPreferencesDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return DisplayPreferencesDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const DisplayPreferencesDto &source, convertType<DisplayPreferencesDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
DlnaProfileTypeClass::DlnaProfileTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using DlnaProfileType = Jellyfin::DTO::DlnaProfileType;
|
||||
|
||||
template <>
|
||||
DlnaProfileType fromJsonValue<DlnaProfileType>(const QJsonValue &source) {
|
||||
DlnaProfileType fromJsonValue(const QJsonValue &source, convertType<DlnaProfileType>) {
|
||||
if (!source.isString()) return DlnaProfileType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -59,5 +58,21 @@ DlnaProfileType fromJsonValue<DlnaProfileType>(const QJsonValue &source) {
|
|||
return DlnaProfileType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const DlnaProfileType &source, convertType<DlnaProfileType>) {
|
||||
switch(source) {
|
||||
case DlnaProfileType::Audio:
|
||||
return QStringLiteral("Audio");
|
||||
case DlnaProfileType::Video:
|
||||
return QStringLiteral("Video");
|
||||
case DlnaProfileType::Photo:
|
||||
return QStringLiteral("Photo");
|
||||
|
||||
case DlnaProfileType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
DynamicDayOfWeekClass::DynamicDayOfWeekClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using DynamicDayOfWeek = Jellyfin::DTO::DynamicDayOfWeek;
|
||||
|
||||
template <>
|
||||
DynamicDayOfWeek fromJsonValue<DynamicDayOfWeek>(const QJsonValue &source) {
|
||||
DynamicDayOfWeek fromJsonValue(const QJsonValue &source, convertType<DynamicDayOfWeek>) {
|
||||
if (!source.isString()) return DynamicDayOfWeek::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -80,5 +79,35 @@ DynamicDayOfWeek fromJsonValue<DynamicDayOfWeek>(const QJsonValue &source) {
|
|||
return DynamicDayOfWeek::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const DynamicDayOfWeek &source, convertType<DynamicDayOfWeek>) {
|
||||
switch(source) {
|
||||
case DynamicDayOfWeek::Sunday:
|
||||
return QStringLiteral("Sunday");
|
||||
case DynamicDayOfWeek::Monday:
|
||||
return QStringLiteral("Monday");
|
||||
case DynamicDayOfWeek::Tuesday:
|
||||
return QStringLiteral("Tuesday");
|
||||
case DynamicDayOfWeek::Wednesday:
|
||||
return QStringLiteral("Wednesday");
|
||||
case DynamicDayOfWeek::Thursday:
|
||||
return QStringLiteral("Thursday");
|
||||
case DynamicDayOfWeek::Friday:
|
||||
return QStringLiteral("Friday");
|
||||
case DynamicDayOfWeek::Saturday:
|
||||
return QStringLiteral("Saturday");
|
||||
case DynamicDayOfWeek::Everyday:
|
||||
return QStringLiteral("Everyday");
|
||||
case DynamicDayOfWeek::Weekday:
|
||||
return QStringLiteral("Weekday");
|
||||
case DynamicDayOfWeek::Weekend:
|
||||
return QStringLiteral("Weekend");
|
||||
|
||||
case DynamicDayOfWeek::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
EncodingContextClass::EncodingContextClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using EncodingContext = Jellyfin::DTO::EncodingContext;
|
||||
|
||||
template <>
|
||||
EncodingContext fromJsonValue<EncodingContext>(const QJsonValue &source) {
|
||||
EncodingContext fromJsonValue(const QJsonValue &source, convertType<EncodingContext>) {
|
||||
if (!source.isString()) return EncodingContext::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -56,5 +55,19 @@ EncodingContext fromJsonValue<EncodingContext>(const QJsonValue &source) {
|
|||
return EncodingContext::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const EncodingContext &source, convertType<EncodingContext>) {
|
||||
switch(source) {
|
||||
case EncodingContext::Streaming:
|
||||
return QStringLiteral("Streaming");
|
||||
case EncodingContext::Static:
|
||||
return QStringLiteral("Static");
|
||||
|
||||
case EncodingContext::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -58,7 +58,7 @@ void EndPointInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject EndPointInfo::toJson() {
|
||||
QJsonObject EndPointInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["IsLocal"] = Jellyfin::Support::toJsonValue<bool>(m_isLocal);
|
||||
result["IsInNetwork"] = Jellyfin::Support::toJsonValue<bool>(m_isInNetwork);
|
||||
|
@ -86,10 +86,15 @@ namespace Support {
|
|||
using EndPointInfo = Jellyfin::DTO::EndPointInfo;
|
||||
|
||||
template <>
|
||||
EndPointInfo fromJsonValue<EndPointInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
EndPointInfo fromJsonValue(const QJsonValue &source, convertType<EndPointInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return EndPointInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const EndPointInfo &source, convertType<EndPointInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void ExternalIdInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ExternalIdInfo::toJson() {
|
||||
QJsonObject ExternalIdInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Key"] = Jellyfin::Support::toJsonValue<QString>(m_key);
|
||||
|
@ -127,10 +127,15 @@ namespace Support {
|
|||
using ExternalIdInfo = Jellyfin::DTO::ExternalIdInfo;
|
||||
|
||||
template <>
|
||||
ExternalIdInfo fromJsonValue<ExternalIdInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ExternalIdInfo fromJsonValue(const QJsonValue &source, convertType<ExternalIdInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ExternalIdInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ExternalIdInfo &source, convertType<ExternalIdInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ExternalIdMediaTypeClass::ExternalIdMediaTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ExternalIdMediaType = Jellyfin::DTO::ExternalIdMediaType;
|
||||
|
||||
template <>
|
||||
ExternalIdMediaType fromJsonValue<ExternalIdMediaType>(const QJsonValue &source) {
|
||||
ExternalIdMediaType fromJsonValue(const QJsonValue &source, convertType<ExternalIdMediaType>) {
|
||||
if (!source.isString()) return ExternalIdMediaType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -86,5 +85,39 @@ ExternalIdMediaType fromJsonValue<ExternalIdMediaType>(const QJsonValue &source)
|
|||
return ExternalIdMediaType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ExternalIdMediaType &source, convertType<ExternalIdMediaType>) {
|
||||
switch(source) {
|
||||
case ExternalIdMediaType::Album:
|
||||
return QStringLiteral("Album");
|
||||
case ExternalIdMediaType::AlbumArtist:
|
||||
return QStringLiteral("AlbumArtist");
|
||||
case ExternalIdMediaType::Artist:
|
||||
return QStringLiteral("Artist");
|
||||
case ExternalIdMediaType::BoxSet:
|
||||
return QStringLiteral("BoxSet");
|
||||
case ExternalIdMediaType::Episode:
|
||||
return QStringLiteral("Episode");
|
||||
case ExternalIdMediaType::Movie:
|
||||
return QStringLiteral("Movie");
|
||||
case ExternalIdMediaType::OtherArtist:
|
||||
return QStringLiteral("OtherArtist");
|
||||
case ExternalIdMediaType::Person:
|
||||
return QStringLiteral("Person");
|
||||
case ExternalIdMediaType::ReleaseGroup:
|
||||
return QStringLiteral("ReleaseGroup");
|
||||
case ExternalIdMediaType::Season:
|
||||
return QStringLiteral("Season");
|
||||
case ExternalIdMediaType::Series:
|
||||
return QStringLiteral("Series");
|
||||
case ExternalIdMediaType::Track:
|
||||
return QStringLiteral("Track");
|
||||
|
||||
case ExternalIdMediaType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -58,7 +58,7 @@ void ExternalUrl::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ExternalUrl::toJson() {
|
||||
QJsonObject ExternalUrl::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Url"] = Jellyfin::Support::toJsonValue<QString>(m_url);
|
||||
|
@ -100,10 +100,15 @@ namespace Support {
|
|||
using ExternalUrl = Jellyfin::DTO::ExternalUrl;
|
||||
|
||||
template <>
|
||||
ExternalUrl fromJsonValue<ExternalUrl>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ExternalUrl fromJsonValue(const QJsonValue &source, convertType<ExternalUrl>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ExternalUrl::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ExternalUrl &source, convertType<ExternalUrl>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
FFmpegLocationClass::FFmpegLocationClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using FFmpegLocation = Jellyfin::DTO::FFmpegLocation;
|
||||
|
||||
template <>
|
||||
FFmpegLocation fromJsonValue<FFmpegLocation>(const QJsonValue &source) {
|
||||
FFmpegLocation fromJsonValue(const QJsonValue &source, convertType<FFmpegLocation>) {
|
||||
if (!source.isString()) return FFmpegLocation::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -62,5 +61,23 @@ FFmpegLocation fromJsonValue<FFmpegLocation>(const QJsonValue &source) {
|
|||
return FFmpegLocation::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const FFmpegLocation &source, convertType<FFmpegLocation>) {
|
||||
switch(source) {
|
||||
case FFmpegLocation::NotFound:
|
||||
return QStringLiteral("NotFound");
|
||||
case FFmpegLocation::SetByArgument:
|
||||
return QStringLiteral("SetByArgument");
|
||||
case FFmpegLocation::Custom:
|
||||
return QStringLiteral("Custom");
|
||||
case FFmpegLocation::System:
|
||||
return QStringLiteral("System");
|
||||
|
||||
case FFmpegLocation::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void FileSystemEntryInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject FileSystemEntryInfo::toJson() {
|
||||
QJsonObject FileSystemEntryInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Path"] = Jellyfin::Support::toJsonValue<QString>(m_path);
|
||||
|
@ -110,10 +110,15 @@ namespace Support {
|
|||
using FileSystemEntryInfo = Jellyfin::DTO::FileSystemEntryInfo;
|
||||
|
||||
template <>
|
||||
FileSystemEntryInfo fromJsonValue<FileSystemEntryInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
FileSystemEntryInfo fromJsonValue(const QJsonValue &source, convertType<FileSystemEntryInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return FileSystemEntryInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const FileSystemEntryInfo &source, convertType<FileSystemEntryInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
FileSystemEntryTypeClass::FileSystemEntryTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using FileSystemEntryType = Jellyfin::DTO::FileSystemEntryType;
|
||||
|
||||
template <>
|
||||
FileSystemEntryType fromJsonValue<FileSystemEntryType>(const QJsonValue &source) {
|
||||
FileSystemEntryType fromJsonValue(const QJsonValue &source, convertType<FileSystemEntryType>) {
|
||||
if (!source.isString()) return FileSystemEntryType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -62,5 +61,23 @@ FileSystemEntryType fromJsonValue<FileSystemEntryType>(const QJsonValue &source)
|
|||
return FileSystemEntryType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const FileSystemEntryType &source, convertType<FileSystemEntryType>) {
|
||||
switch(source) {
|
||||
case FileSystemEntryType::File:
|
||||
return QStringLiteral("File");
|
||||
case FileSystemEntryType::Directory:
|
||||
return QStringLiteral("Directory");
|
||||
case FileSystemEntryType::NetworkComputer:
|
||||
return QStringLiteral("NetworkComputer");
|
||||
case FileSystemEntryType::NetworkShare:
|
||||
return QStringLiteral("NetworkShare");
|
||||
|
||||
case FileSystemEntryType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -64,7 +64,7 @@ void FontFile::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject FontFile::toJson() {
|
||||
QJsonObject FontFile::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Size"] = Jellyfin::Support::toJsonValue<qint64>(m_size);
|
||||
|
@ -113,10 +113,15 @@ namespace Support {
|
|||
using FontFile = Jellyfin::DTO::FontFile;
|
||||
|
||||
template <>
|
||||
FontFile fromJsonValue<FontFile>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
FontFile fromJsonValue(const QJsonValue &source, convertType<FontFile>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return FontFile::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const FontFile &source, convertType<FontFile>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ForgotPasswordActionClass::ForgotPasswordActionClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ForgotPasswordAction = Jellyfin::DTO::ForgotPasswordAction;
|
||||
|
||||
template <>
|
||||
ForgotPasswordAction fromJsonValue<ForgotPasswordAction>(const QJsonValue &source) {
|
||||
ForgotPasswordAction fromJsonValue(const QJsonValue &source, convertType<ForgotPasswordAction>) {
|
||||
if (!source.isString()) return ForgotPasswordAction::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -59,5 +58,21 @@ ForgotPasswordAction fromJsonValue<ForgotPasswordAction>(const QJsonValue &sourc
|
|||
return ForgotPasswordAction::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ForgotPasswordAction &source, convertType<ForgotPasswordAction>) {
|
||||
switch(source) {
|
||||
case ForgotPasswordAction::ContactAdmin:
|
||||
return QStringLiteral("ContactAdmin");
|
||||
case ForgotPasswordAction::PinCode:
|
||||
return QStringLiteral("PinCode");
|
||||
case ForgotPasswordAction::InNetworkRequired:
|
||||
return QStringLiteral("InNetworkRequired");
|
||||
|
||||
case ForgotPasswordAction::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -55,7 +55,7 @@ void ForgotPasswordDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ForgotPasswordDto::toJson() {
|
||||
QJsonObject ForgotPasswordDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["EnteredUsername"] = Jellyfin::Support::toJsonValue<QString>(m_enteredUsername);
|
||||
|
||||
|
@ -76,10 +76,15 @@ namespace Support {
|
|||
using ForgotPasswordDto = Jellyfin::DTO::ForgotPasswordDto;
|
||||
|
||||
template <>
|
||||
ForgotPasswordDto fromJsonValue<ForgotPasswordDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ForgotPasswordDto fromJsonValue(const QJsonValue &source, convertType<ForgotPasswordDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ForgotPasswordDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ForgotPasswordDto &source, convertType<ForgotPasswordDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void ForgotPasswordResult::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ForgotPasswordResult::toJson() {
|
||||
QJsonObject ForgotPasswordResult::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Action"] = Jellyfin::Support::toJsonValue<ForgotPasswordAction>(m_action);
|
||||
result["PinFile"] = Jellyfin::Support::toJsonValue<QString>(m_pinFile);
|
||||
|
@ -110,10 +110,15 @@ namespace Support {
|
|||
using ForgotPasswordResult = Jellyfin::DTO::ForgotPasswordResult;
|
||||
|
||||
template <>
|
||||
ForgotPasswordResult fromJsonValue<ForgotPasswordResult>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ForgotPasswordResult fromJsonValue(const QJsonValue &source, convertType<ForgotPasswordResult>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ForgotPasswordResult::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ForgotPasswordResult &source, convertType<ForgotPasswordResult>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -57,15 +57,15 @@ GeneralCommand GeneralCommand::fromJson(QJsonObject source) {
|
|||
void GeneralCommand::setFromJson(QJsonObject source) {
|
||||
m_name = Jellyfin::Support::fromJsonValue<GeneralCommandType>(source["Name"]);
|
||||
m_controllingUserId = Jellyfin::Support::fromJsonValue<QString>(source["ControllingUserId"]);
|
||||
m_arguments = Jellyfin::Support::fromJsonValue<std::optional<QJsonObject>>(source["Arguments"]);
|
||||
m_arguments = Jellyfin::Support::fromJsonValue<QJsonObject>(source["Arguments"]);
|
||||
|
||||
}
|
||||
|
||||
QJsonObject GeneralCommand::toJson() {
|
||||
QJsonObject GeneralCommand::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<GeneralCommandType>(m_name);
|
||||
result["ControllingUserId"] = Jellyfin::Support::toJsonValue<QString>(m_controllingUserId);
|
||||
result["Arguments"] = Jellyfin::Support::toJsonValue<std::optional<QJsonObject>>(m_arguments);
|
||||
result["Arguments"] = Jellyfin::Support::toJsonValue<QJsonObject>(m_arguments);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -82,17 +82,17 @@ void GeneralCommand::setControllingUserId(QString newControllingUserId) {
|
|||
m_controllingUserId = newControllingUserId;
|
||||
}
|
||||
|
||||
std::optional<QJsonObject> GeneralCommand::arguments() const { return m_arguments; }
|
||||
QJsonObject GeneralCommand::arguments() const { return m_arguments; }
|
||||
|
||||
void GeneralCommand::setArguments(std::optional<QJsonObject> newArguments) {
|
||||
void GeneralCommand::setArguments(QJsonObject newArguments) {
|
||||
m_arguments = newArguments;
|
||||
}
|
||||
bool GeneralCommand::argumentsNull() const {
|
||||
return !m_arguments.has_value();
|
||||
return m_arguments.isEmpty();
|
||||
}
|
||||
|
||||
void GeneralCommand::setArgumentsNull() {
|
||||
m_arguments = std::nullopt;
|
||||
m_arguments= QJsonObject();
|
||||
|
||||
}
|
||||
|
||||
|
@ -103,10 +103,15 @@ namespace Support {
|
|||
using GeneralCommand = Jellyfin::DTO::GeneralCommand;
|
||||
|
||||
template <>
|
||||
GeneralCommand fromJsonValue<GeneralCommand>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
GeneralCommand fromJsonValue(const QJsonValue &source, convertType<GeneralCommand>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return GeneralCommand::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const GeneralCommand &source, convertType<GeneralCommand>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
GeneralCommandTypeClass::GeneralCommandTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using GeneralCommandType = Jellyfin::DTO::GeneralCommandType;
|
||||
|
||||
template <>
|
||||
GeneralCommandType fromJsonValue<GeneralCommandType>(const QJsonValue &source) {
|
||||
GeneralCommandType fromJsonValue(const QJsonValue &source, convertType<GeneralCommandType>) {
|
||||
if (!source.isString()) return GeneralCommandType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -173,5 +172,97 @@ GeneralCommandType fromJsonValue<GeneralCommandType>(const QJsonValue &source) {
|
|||
return GeneralCommandType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const GeneralCommandType &source, convertType<GeneralCommandType>) {
|
||||
switch(source) {
|
||||
case GeneralCommandType::MoveUp:
|
||||
return QStringLiteral("MoveUp");
|
||||
case GeneralCommandType::MoveDown:
|
||||
return QStringLiteral("MoveDown");
|
||||
case GeneralCommandType::MoveLeft:
|
||||
return QStringLiteral("MoveLeft");
|
||||
case GeneralCommandType::MoveRight:
|
||||
return QStringLiteral("MoveRight");
|
||||
case GeneralCommandType::PageUp:
|
||||
return QStringLiteral("PageUp");
|
||||
case GeneralCommandType::PageDown:
|
||||
return QStringLiteral("PageDown");
|
||||
case GeneralCommandType::PreviousLetter:
|
||||
return QStringLiteral("PreviousLetter");
|
||||
case GeneralCommandType::NextLetter:
|
||||
return QStringLiteral("NextLetter");
|
||||
case GeneralCommandType::ToggleOsd:
|
||||
return QStringLiteral("ToggleOsd");
|
||||
case GeneralCommandType::ToggleContextMenu:
|
||||
return QStringLiteral("ToggleContextMenu");
|
||||
case GeneralCommandType::Select:
|
||||
return QStringLiteral("Select");
|
||||
case GeneralCommandType::Back:
|
||||
return QStringLiteral("Back");
|
||||
case GeneralCommandType::TakeScreenshot:
|
||||
return QStringLiteral("TakeScreenshot");
|
||||
case GeneralCommandType::SendKey:
|
||||
return QStringLiteral("SendKey");
|
||||
case GeneralCommandType::SendString:
|
||||
return QStringLiteral("SendString");
|
||||
case GeneralCommandType::GoHome:
|
||||
return QStringLiteral("GoHome");
|
||||
case GeneralCommandType::GoToSettings:
|
||||
return QStringLiteral("GoToSettings");
|
||||
case GeneralCommandType::VolumeUp:
|
||||
return QStringLiteral("VolumeUp");
|
||||
case GeneralCommandType::VolumeDown:
|
||||
return QStringLiteral("VolumeDown");
|
||||
case GeneralCommandType::Mute:
|
||||
return QStringLiteral("Mute");
|
||||
case GeneralCommandType::Unmute:
|
||||
return QStringLiteral("Unmute");
|
||||
case GeneralCommandType::ToggleMute:
|
||||
return QStringLiteral("ToggleMute");
|
||||
case GeneralCommandType::SetVolume:
|
||||
return QStringLiteral("SetVolume");
|
||||
case GeneralCommandType::SetAudioStreamIndex:
|
||||
return QStringLiteral("SetAudioStreamIndex");
|
||||
case GeneralCommandType::SetSubtitleStreamIndex:
|
||||
return QStringLiteral("SetSubtitleStreamIndex");
|
||||
case GeneralCommandType::ToggleFullscreen:
|
||||
return QStringLiteral("ToggleFullscreen");
|
||||
case GeneralCommandType::DisplayContent:
|
||||
return QStringLiteral("DisplayContent");
|
||||
case GeneralCommandType::GoToSearch:
|
||||
return QStringLiteral("GoToSearch");
|
||||
case GeneralCommandType::DisplayMessage:
|
||||
return QStringLiteral("DisplayMessage");
|
||||
case GeneralCommandType::SetRepeatMode:
|
||||
return QStringLiteral("SetRepeatMode");
|
||||
case GeneralCommandType::ChannelUp:
|
||||
return QStringLiteral("ChannelUp");
|
||||
case GeneralCommandType::ChannelDown:
|
||||
return QStringLiteral("ChannelDown");
|
||||
case GeneralCommandType::Guide:
|
||||
return QStringLiteral("Guide");
|
||||
case GeneralCommandType::ToggleStats:
|
||||
return QStringLiteral("ToggleStats");
|
||||
case GeneralCommandType::PlayMediaSource:
|
||||
return QStringLiteral("PlayMediaSource");
|
||||
case GeneralCommandType::PlayTrailers:
|
||||
return QStringLiteral("PlayTrailers");
|
||||
case GeneralCommandType::SetShuffleQueue:
|
||||
return QStringLiteral("SetShuffleQueue");
|
||||
case GeneralCommandType::PlayState:
|
||||
return QStringLiteral("PlayState");
|
||||
case GeneralCommandType::PlayNext:
|
||||
return QStringLiteral("PlayNext");
|
||||
case GeneralCommandType::ToggleOsdMenu:
|
||||
return QStringLiteral("ToggleOsdMenu");
|
||||
case GeneralCommandType::Play:
|
||||
return QStringLiteral("Play");
|
||||
|
||||
case GeneralCommandType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -133,7 +133,7 @@ void GetProgramsDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject GetProgramsDto::toJson() {
|
||||
QJsonObject GetProgramsDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["ChannelIds"] = Jellyfin::Support::toJsonValue<QStringList>(m_channelIds);
|
||||
result["UserId"] = Jellyfin::Support::toJsonValue<QString>(m_userId);
|
||||
|
@ -504,10 +504,15 @@ namespace Support {
|
|||
using GetProgramsDto = Jellyfin::DTO::GetProgramsDto;
|
||||
|
||||
template <>
|
||||
GetProgramsDto fromJsonValue<GetProgramsDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
GetProgramsDto fromJsonValue(const QJsonValue &source, convertType<GetProgramsDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return GetProgramsDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const GetProgramsDto &source, convertType<GetProgramsDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -67,7 +67,7 @@ void GroupInfoDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject GroupInfoDto::toJson() {
|
||||
QJsonObject GroupInfoDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["GroupId"] = Jellyfin::Support::toJsonValue<QString>(m_groupId);
|
||||
result["GroupName"] = Jellyfin::Support::toJsonValue<QString>(m_groupName);
|
||||
|
@ -130,10 +130,15 @@ namespace Support {
|
|||
using GroupInfoDto = Jellyfin::DTO::GroupInfoDto;
|
||||
|
||||
template <>
|
||||
GroupInfoDto fromJsonValue<GroupInfoDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
GroupInfoDto fromJsonValue(const QJsonValue &source, convertType<GroupInfoDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return GroupInfoDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const GroupInfoDto &source, convertType<GroupInfoDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
GroupQueueModeClass::GroupQueueModeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using GroupQueueMode = Jellyfin::DTO::GroupQueueMode;
|
||||
|
||||
template <>
|
||||
GroupQueueMode fromJsonValue<GroupQueueMode>(const QJsonValue &source) {
|
||||
GroupQueueMode fromJsonValue(const QJsonValue &source, convertType<GroupQueueMode>) {
|
||||
if (!source.isString()) return GroupQueueMode::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -56,5 +55,19 @@ GroupQueueMode fromJsonValue<GroupQueueMode>(const QJsonValue &source) {
|
|||
return GroupQueueMode::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const GroupQueueMode &source, convertType<GroupQueueMode>) {
|
||||
switch(source) {
|
||||
case GroupQueueMode::Queue:
|
||||
return QStringLiteral("Queue");
|
||||
case GroupQueueMode::QueueNext:
|
||||
return QStringLiteral("QueueNext");
|
||||
|
||||
case GroupQueueMode::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
GroupRepeatModeClass::GroupRepeatModeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using GroupRepeatMode = Jellyfin::DTO::GroupRepeatMode;
|
||||
|
||||
template <>
|
||||
GroupRepeatMode fromJsonValue<GroupRepeatMode>(const QJsonValue &source) {
|
||||
GroupRepeatMode fromJsonValue(const QJsonValue &source, convertType<GroupRepeatMode>) {
|
||||
if (!source.isString()) return GroupRepeatMode::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -59,5 +58,21 @@ GroupRepeatMode fromJsonValue<GroupRepeatMode>(const QJsonValue &source) {
|
|||
return GroupRepeatMode::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const GroupRepeatMode &source, convertType<GroupRepeatMode>) {
|
||||
switch(source) {
|
||||
case GroupRepeatMode::RepeatOne:
|
||||
return QStringLiteral("RepeatOne");
|
||||
case GroupRepeatMode::RepeatAll:
|
||||
return QStringLiteral("RepeatAll");
|
||||
case GroupRepeatMode::RepeatNone:
|
||||
return QStringLiteral("RepeatNone");
|
||||
|
||||
case GroupRepeatMode::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
GroupShuffleModeClass::GroupShuffleModeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using GroupShuffleMode = Jellyfin::DTO::GroupShuffleMode;
|
||||
|
||||
template <>
|
||||
GroupShuffleMode fromJsonValue<GroupShuffleMode>(const QJsonValue &source) {
|
||||
GroupShuffleMode fromJsonValue(const QJsonValue &source, convertType<GroupShuffleMode>) {
|
||||
if (!source.isString()) return GroupShuffleMode::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -56,5 +55,19 @@ GroupShuffleMode fromJsonValue<GroupShuffleMode>(const QJsonValue &source) {
|
|||
return GroupShuffleMode::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const GroupShuffleMode &source, convertType<GroupShuffleMode>) {
|
||||
switch(source) {
|
||||
case GroupShuffleMode::Sorted:
|
||||
return QStringLiteral("Sorted");
|
||||
case GroupShuffleMode::Shuffle:
|
||||
return QStringLiteral("Shuffle");
|
||||
|
||||
case GroupShuffleMode::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
GroupStateTypeClass::GroupStateTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using GroupStateType = Jellyfin::DTO::GroupStateType;
|
||||
|
||||
template <>
|
||||
GroupStateType fromJsonValue<GroupStateType>(const QJsonValue &source) {
|
||||
GroupStateType fromJsonValue(const QJsonValue &source, convertType<GroupStateType>) {
|
||||
if (!source.isString()) return GroupStateType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -62,5 +61,23 @@ GroupStateType fromJsonValue<GroupStateType>(const QJsonValue &source) {
|
|||
return GroupStateType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const GroupStateType &source, convertType<GroupStateType>) {
|
||||
switch(source) {
|
||||
case GroupStateType::Idle:
|
||||
return QStringLiteral("Idle");
|
||||
case GroupStateType::Waiting:
|
||||
return QStringLiteral("Waiting");
|
||||
case GroupStateType::Paused:
|
||||
return QStringLiteral("Paused");
|
||||
case GroupStateType::Playing:
|
||||
return QStringLiteral("Playing");
|
||||
|
||||
case GroupStateType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
GroupUpdateTypeClass::GroupUpdateTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using GroupUpdateType = Jellyfin::DTO::GroupUpdateType;
|
||||
|
||||
template <>
|
||||
GroupUpdateType fromJsonValue<GroupUpdateType>(const QJsonValue &source) {
|
||||
GroupUpdateType fromJsonValue(const QJsonValue &source, convertType<GroupUpdateType>) {
|
||||
if (!source.isString()) return GroupUpdateType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -83,5 +82,37 @@ GroupUpdateType fromJsonValue<GroupUpdateType>(const QJsonValue &source) {
|
|||
return GroupUpdateType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const GroupUpdateType &source, convertType<GroupUpdateType>) {
|
||||
switch(source) {
|
||||
case GroupUpdateType::UserJoined:
|
||||
return QStringLiteral("UserJoined");
|
||||
case GroupUpdateType::UserLeft:
|
||||
return QStringLiteral("UserLeft");
|
||||
case GroupUpdateType::GroupJoined:
|
||||
return QStringLiteral("GroupJoined");
|
||||
case GroupUpdateType::GroupLeft:
|
||||
return QStringLiteral("GroupLeft");
|
||||
case GroupUpdateType::StateUpdate:
|
||||
return QStringLiteral("StateUpdate");
|
||||
case GroupUpdateType::PlayQueue:
|
||||
return QStringLiteral("PlayQueue");
|
||||
case GroupUpdateType::NotInGroup:
|
||||
return QStringLiteral("NotInGroup");
|
||||
case GroupUpdateType::GroupDoesNotExist:
|
||||
return QStringLiteral("GroupDoesNotExist");
|
||||
case GroupUpdateType::CreateGroupDenied:
|
||||
return QStringLiteral("CreateGroupDenied");
|
||||
case GroupUpdateType::JoinGroupDenied:
|
||||
return QStringLiteral("JoinGroupDenied");
|
||||
case GroupUpdateType::LibraryAccessDenied:
|
||||
return QStringLiteral("LibraryAccessDenied");
|
||||
|
||||
case GroupUpdateType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -58,7 +58,7 @@ void GuideInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject GuideInfo::toJson() {
|
||||
QJsonObject GuideInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["StartDate"] = Jellyfin::Support::toJsonValue<QDateTime>(m_startDate);
|
||||
result["EndDate"] = Jellyfin::Support::toJsonValue<QDateTime>(m_endDate);
|
||||
|
@ -86,10 +86,15 @@ namespace Support {
|
|||
using GuideInfo = Jellyfin::DTO::GuideInfo;
|
||||
|
||||
template <>
|
||||
GuideInfo fromJsonValue<GuideInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
GuideInfo fromJsonValue(const QJsonValue &source, convertType<GuideInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return GuideInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const GuideInfo &source, convertType<GuideInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
HeaderMatchTypeClass::HeaderMatchTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using HeaderMatchType = Jellyfin::DTO::HeaderMatchType;
|
||||
|
||||
template <>
|
||||
HeaderMatchType fromJsonValue<HeaderMatchType>(const QJsonValue &source) {
|
||||
HeaderMatchType fromJsonValue(const QJsonValue &source, convertType<HeaderMatchType>) {
|
||||
if (!source.isString()) return HeaderMatchType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -59,5 +58,21 @@ HeaderMatchType fromJsonValue<HeaderMatchType>(const QJsonValue &source) {
|
|||
return HeaderMatchType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const HeaderMatchType &source, convertType<HeaderMatchType>) {
|
||||
switch(source) {
|
||||
case HeaderMatchType::Equals:
|
||||
return QStringLiteral("Equals");
|
||||
case HeaderMatchType::Regex:
|
||||
return QStringLiteral("Regex");
|
||||
case HeaderMatchType::Substring:
|
||||
return QStringLiteral("Substring");
|
||||
|
||||
case HeaderMatchType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void HttpHeaderInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject HttpHeaderInfo::toJson() {
|
||||
QJsonObject HttpHeaderInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Value"] = Jellyfin::Support::toJsonValue<QString>(m_value);
|
||||
|
@ -110,10 +110,15 @@ namespace Support {
|
|||
using HttpHeaderInfo = Jellyfin::DTO::HttpHeaderInfo;
|
||||
|
||||
template <>
|
||||
HttpHeaderInfo fromJsonValue<HttpHeaderInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
HttpHeaderInfo fromJsonValue(const QJsonValue &source, convertType<HttpHeaderInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return HttpHeaderInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const HttpHeaderInfo &source, convertType<HttpHeaderInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -55,7 +55,7 @@ void IgnoreWaitRequestDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject IgnoreWaitRequestDto::toJson() {
|
||||
QJsonObject IgnoreWaitRequestDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["IgnoreWait"] = Jellyfin::Support::toJsonValue<bool>(m_ignoreWait);
|
||||
|
||||
|
@ -76,10 +76,15 @@ namespace Support {
|
|||
using IgnoreWaitRequestDto = Jellyfin::DTO::IgnoreWaitRequestDto;
|
||||
|
||||
template <>
|
||||
IgnoreWaitRequestDto fromJsonValue<IgnoreWaitRequestDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
IgnoreWaitRequestDto fromJsonValue(const QJsonValue &source, convertType<IgnoreWaitRequestDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return IgnoreWaitRequestDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const IgnoreWaitRequestDto &source, convertType<IgnoreWaitRequestDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -67,7 +67,7 @@ void ImageByNameInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ImageByNameInfo::toJson() {
|
||||
QJsonObject ImageByNameInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Theme"] = Jellyfin::Support::toJsonValue<QString>(m_theme);
|
||||
|
@ -144,10 +144,15 @@ namespace Support {
|
|||
using ImageByNameInfo = Jellyfin::DTO::ImageByNameInfo;
|
||||
|
||||
template <>
|
||||
ImageByNameInfo fromJsonValue<ImageByNameInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ImageByNameInfo fromJsonValue(const QJsonValue &source, convertType<ImageByNameInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ImageByNameInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ImageByNameInfo &source, convertType<ImageByNameInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ImageFormatClass::ImageFormatClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ImageFormat = Jellyfin::DTO::ImageFormat;
|
||||
|
||||
template <>
|
||||
ImageFormat fromJsonValue<ImageFormat>(const QJsonValue &source) {
|
||||
ImageFormat fromJsonValue(const QJsonValue &source, convertType<ImageFormat>) {
|
||||
if (!source.isString()) return ImageFormat::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -65,5 +64,25 @@ ImageFormat fromJsonValue<ImageFormat>(const QJsonValue &source) {
|
|||
return ImageFormat::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ImageFormat &source, convertType<ImageFormat>) {
|
||||
switch(source) {
|
||||
case ImageFormat::Bmp:
|
||||
return QStringLiteral("Bmp");
|
||||
case ImageFormat::Gif:
|
||||
return QStringLiteral("Gif");
|
||||
case ImageFormat::Jpg:
|
||||
return QStringLiteral("Jpg");
|
||||
case ImageFormat::Png:
|
||||
return QStringLiteral("Png");
|
||||
case ImageFormat::Webp:
|
||||
return QStringLiteral("Webp");
|
||||
|
||||
case ImageFormat::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -76,7 +76,7 @@ void ImageInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ImageInfo::toJson() {
|
||||
QJsonObject ImageInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["ImageType"] = Jellyfin::Support::toJsonValue<ImageType>(m_imageType);
|
||||
result["ImageIndex"] = Jellyfin::Support::toJsonValue<std::optional<qint32>>(m_imageIndex);
|
||||
|
@ -188,10 +188,15 @@ namespace Support {
|
|||
using ImageInfo = Jellyfin::DTO::ImageInfo;
|
||||
|
||||
template <>
|
||||
ImageInfo fromJsonValue<ImageInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ImageInfo fromJsonValue(const QJsonValue &source, convertType<ImageInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ImageInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ImageInfo &source, convertType<ImageInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -61,7 +61,7 @@ void ImageOption::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ImageOption::toJson() {
|
||||
QJsonObject ImageOption::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Type"] = Jellyfin::Support::toJsonValue<ImageType>(m_type);
|
||||
result["Limit"] = Jellyfin::Support::toJsonValue<qint32>(m_limit);
|
||||
|
@ -96,10 +96,15 @@ namespace Support {
|
|||
using ImageOption = Jellyfin::DTO::ImageOption;
|
||||
|
||||
template <>
|
||||
ImageOption fromJsonValue<ImageOption>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ImageOption fromJsonValue(const QJsonValue &source, convertType<ImageOption>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ImageOption::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ImageOption &source, convertType<ImageOption>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ImageOrientationClass::ImageOrientationClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ImageOrientation = Jellyfin::DTO::ImageOrientation;
|
||||
|
||||
template <>
|
||||
ImageOrientation fromJsonValue<ImageOrientation>(const QJsonValue &source) {
|
||||
ImageOrientation fromJsonValue(const QJsonValue &source, convertType<ImageOrientation>) {
|
||||
if (!source.isString()) return ImageOrientation::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -74,5 +73,31 @@ ImageOrientation fromJsonValue<ImageOrientation>(const QJsonValue &source) {
|
|||
return ImageOrientation::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ImageOrientation &source, convertType<ImageOrientation>) {
|
||||
switch(source) {
|
||||
case ImageOrientation::TopLeft:
|
||||
return QStringLiteral("TopLeft");
|
||||
case ImageOrientation::TopRight:
|
||||
return QStringLiteral("TopRight");
|
||||
case ImageOrientation::BottomRight:
|
||||
return QStringLiteral("BottomRight");
|
||||
case ImageOrientation::BottomLeft:
|
||||
return QStringLiteral("BottomLeft");
|
||||
case ImageOrientation::LeftTop:
|
||||
return QStringLiteral("LeftTop");
|
||||
case ImageOrientation::RightTop:
|
||||
return QStringLiteral("RightTop");
|
||||
case ImageOrientation::RightBottom:
|
||||
return QStringLiteral("RightBottom");
|
||||
case ImageOrientation::LeftBottom:
|
||||
return QStringLiteral("LeftBottom");
|
||||
|
||||
case ImageOrientation::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -58,7 +58,7 @@ void ImageProviderInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ImageProviderInfo::toJson() {
|
||||
QJsonObject ImageProviderInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["SupportedImages"] = Jellyfin::Support::toJsonValue<QList<ImageType>>(m_supportedImages);
|
||||
|
@ -100,10 +100,15 @@ namespace Support {
|
|||
using ImageProviderInfo = Jellyfin::DTO::ImageProviderInfo;
|
||||
|
||||
template <>
|
||||
ImageProviderInfo fromJsonValue<ImageProviderInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ImageProviderInfo fromJsonValue(const QJsonValue &source, convertType<ImageProviderInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ImageProviderInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ImageProviderInfo &source, convertType<ImageProviderInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ImageSavingConventionClass::ImageSavingConventionClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ImageSavingConvention = Jellyfin::DTO::ImageSavingConvention;
|
||||
|
||||
template <>
|
||||
ImageSavingConvention fromJsonValue<ImageSavingConvention>(const QJsonValue &source) {
|
||||
ImageSavingConvention fromJsonValue(const QJsonValue &source, convertType<ImageSavingConvention>) {
|
||||
if (!source.isString()) return ImageSavingConvention::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -56,5 +55,19 @@ ImageSavingConvention fromJsonValue<ImageSavingConvention>(const QJsonValue &sou
|
|||
return ImageSavingConvention::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ImageSavingConvention &source, convertType<ImageSavingConvention>) {
|
||||
switch(source) {
|
||||
case ImageSavingConvention::Legacy:
|
||||
return QStringLiteral("Legacy");
|
||||
case ImageSavingConvention::Compatible:
|
||||
return QStringLiteral("Compatible");
|
||||
|
||||
case ImageSavingConvention::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ImageTypeClass::ImageTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ImageType = Jellyfin::DTO::ImageType;
|
||||
|
||||
template <>
|
||||
ImageType fromJsonValue<ImageType>(const QJsonValue &source) {
|
||||
ImageType fromJsonValue(const QJsonValue &source, convertType<ImageType>) {
|
||||
if (!source.isString()) return ImageType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -89,5 +88,41 @@ ImageType fromJsonValue<ImageType>(const QJsonValue &source) {
|
|||
return ImageType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ImageType &source, convertType<ImageType>) {
|
||||
switch(source) {
|
||||
case ImageType::Primary:
|
||||
return QStringLiteral("Primary");
|
||||
case ImageType::Art:
|
||||
return QStringLiteral("Art");
|
||||
case ImageType::Backdrop:
|
||||
return QStringLiteral("Backdrop");
|
||||
case ImageType::Banner:
|
||||
return QStringLiteral("Banner");
|
||||
case ImageType::Logo:
|
||||
return QStringLiteral("Logo");
|
||||
case ImageType::Thumb:
|
||||
return QStringLiteral("Thumb");
|
||||
case ImageType::Disc:
|
||||
return QStringLiteral("Disc");
|
||||
case ImageType::Box:
|
||||
return QStringLiteral("Box");
|
||||
case ImageType::Screenshot:
|
||||
return QStringLiteral("Screenshot");
|
||||
case ImageType::Menu:
|
||||
return QStringLiteral("Menu");
|
||||
case ImageType::Chapter:
|
||||
return QStringLiteral("Chapter");
|
||||
case ImageType::BoxRear:
|
||||
return QStringLiteral("BoxRear");
|
||||
case ImageType::Profile:
|
||||
return QStringLiteral("Profile");
|
||||
|
||||
case ImageType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -70,7 +70,7 @@ void InstallationInfo::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject InstallationInfo::toJson() {
|
||||
QJsonObject InstallationInfo::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Guid"] = Jellyfin::Support::toJsonValue<QString>(m_guid);
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
|
@ -154,10 +154,15 @@ namespace Support {
|
|||
using InstallationInfo = Jellyfin::DTO::InstallationInfo;
|
||||
|
||||
template <>
|
||||
InstallationInfo fromJsonValue<InstallationInfo>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
InstallationInfo fromJsonValue(const QJsonValue &source, convertType<InstallationInfo>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return InstallationInfo::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const InstallationInfo &source, convertType<InstallationInfo>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -73,7 +73,7 @@ void IPlugin::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject IPlugin::toJson() {
|
||||
QJsonObject IPlugin::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["Description"] = Jellyfin::Support::toJsonValue<QString>(m_description);
|
||||
|
@ -164,10 +164,15 @@ namespace Support {
|
|||
using IPlugin = Jellyfin::DTO::IPlugin;
|
||||
|
||||
template <>
|
||||
IPlugin fromJsonValue<IPlugin>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
IPlugin fromJsonValue(const QJsonValue &source, convertType<IPlugin>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return IPlugin::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const IPlugin &source, convertType<IPlugin>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
IsoTypeClass::IsoTypeClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using IsoType = Jellyfin::DTO::IsoType;
|
||||
|
||||
template <>
|
||||
IsoType fromJsonValue<IsoType>(const QJsonValue &source) {
|
||||
IsoType fromJsonValue(const QJsonValue &source, convertType<IsoType>) {
|
||||
if (!source.isString()) return IsoType::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -56,5 +55,19 @@ IsoType fromJsonValue<IsoType>(const QJsonValue &source) {
|
|||
return IsoType::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const IsoType &source, convertType<IsoType>) {
|
||||
switch(source) {
|
||||
case IsoType::Dvd:
|
||||
return QStringLiteral("Dvd");
|
||||
case IsoType::BluRay:
|
||||
return QStringLiteral("BluRay");
|
||||
|
||||
case IsoType::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -88,7 +88,7 @@ void ItemCounts::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject ItemCounts::toJson() {
|
||||
QJsonObject ItemCounts::toJson() const {
|
||||
QJsonObject result;
|
||||
result["MovieCount"] = Jellyfin::Support::toJsonValue<qint32>(m_movieCount);
|
||||
result["SeriesCount"] = Jellyfin::Support::toJsonValue<qint32>(m_seriesCount);
|
||||
|
@ -186,10 +186,15 @@ namespace Support {
|
|||
using ItemCounts = Jellyfin::DTO::ItemCounts;
|
||||
|
||||
template <>
|
||||
ItemCounts fromJsonValue<ItemCounts>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
ItemCounts fromJsonValue(const QJsonValue &source, convertType<ItemCounts>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return ItemCounts::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const ItemCounts &source, convertType<ItemCounts>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ItemFieldsClass::ItemFieldsClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ItemFields = Jellyfin::DTO::ItemFields;
|
||||
|
||||
template <>
|
||||
ItemFields fromJsonValue<ItemFields>(const QJsonValue &source) {
|
||||
ItemFields fromJsonValue(const QJsonValue &source, convertType<ItemFields>) {
|
||||
if (!source.isString()) return ItemFields::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -233,5 +232,137 @@ ItemFields fromJsonValue<ItemFields>(const QJsonValue &source) {
|
|||
return ItemFields::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ItemFields &source, convertType<ItemFields>) {
|
||||
switch(source) {
|
||||
case ItemFields::AirTime:
|
||||
return QStringLiteral("AirTime");
|
||||
case ItemFields::CanDelete:
|
||||
return QStringLiteral("CanDelete");
|
||||
case ItemFields::CanDownload:
|
||||
return QStringLiteral("CanDownload");
|
||||
case ItemFields::ChannelInfo:
|
||||
return QStringLiteral("ChannelInfo");
|
||||
case ItemFields::Chapters:
|
||||
return QStringLiteral("Chapters");
|
||||
case ItemFields::ChildCount:
|
||||
return QStringLiteral("ChildCount");
|
||||
case ItemFields::CumulativeRunTimeTicks:
|
||||
return QStringLiteral("CumulativeRunTimeTicks");
|
||||
case ItemFields::CustomRating:
|
||||
return QStringLiteral("CustomRating");
|
||||
case ItemFields::DateCreated:
|
||||
return QStringLiteral("DateCreated");
|
||||
case ItemFields::DateLastMediaAdded:
|
||||
return QStringLiteral("DateLastMediaAdded");
|
||||
case ItemFields::DisplayPreferencesId:
|
||||
return QStringLiteral("DisplayPreferencesId");
|
||||
case ItemFields::Etag:
|
||||
return QStringLiteral("Etag");
|
||||
case ItemFields::ExternalUrls:
|
||||
return QStringLiteral("ExternalUrls");
|
||||
case ItemFields::Genres:
|
||||
return QStringLiteral("Genres");
|
||||
case ItemFields::HomePageUrl:
|
||||
return QStringLiteral("HomePageUrl");
|
||||
case ItemFields::ItemCounts:
|
||||
return QStringLiteral("ItemCounts");
|
||||
case ItemFields::MediaSourceCount:
|
||||
return QStringLiteral("MediaSourceCount");
|
||||
case ItemFields::MediaSources:
|
||||
return QStringLiteral("MediaSources");
|
||||
case ItemFields::OriginalTitle:
|
||||
return QStringLiteral("OriginalTitle");
|
||||
case ItemFields::Overview:
|
||||
return QStringLiteral("Overview");
|
||||
case ItemFields::ParentId:
|
||||
return QStringLiteral("ParentId");
|
||||
case ItemFields::Path:
|
||||
return QStringLiteral("Path");
|
||||
case ItemFields::People:
|
||||
return QStringLiteral("People");
|
||||
case ItemFields::PlayAccess:
|
||||
return QStringLiteral("PlayAccess");
|
||||
case ItemFields::ProductionLocations:
|
||||
return QStringLiteral("ProductionLocations");
|
||||
case ItemFields::ProviderIds:
|
||||
return QStringLiteral("ProviderIds");
|
||||
case ItemFields::PrimaryImageAspectRatio:
|
||||
return QStringLiteral("PrimaryImageAspectRatio");
|
||||
case ItemFields::RecursiveItemCount:
|
||||
return QStringLiteral("RecursiveItemCount");
|
||||
case ItemFields::Settings:
|
||||
return QStringLiteral("Settings");
|
||||
case ItemFields::ScreenshotImageTags:
|
||||
return QStringLiteral("ScreenshotImageTags");
|
||||
case ItemFields::SeriesPrimaryImage:
|
||||
return QStringLiteral("SeriesPrimaryImage");
|
||||
case ItemFields::SeriesStudio:
|
||||
return QStringLiteral("SeriesStudio");
|
||||
case ItemFields::SortName:
|
||||
return QStringLiteral("SortName");
|
||||
case ItemFields::SpecialEpisodeNumbers:
|
||||
return QStringLiteral("SpecialEpisodeNumbers");
|
||||
case ItemFields::Studios:
|
||||
return QStringLiteral("Studios");
|
||||
case ItemFields::BasicSyncInfo:
|
||||
return QStringLiteral("BasicSyncInfo");
|
||||
case ItemFields::SyncInfo:
|
||||
return QStringLiteral("SyncInfo");
|
||||
case ItemFields::Taglines:
|
||||
return QStringLiteral("Taglines");
|
||||
case ItemFields::Tags:
|
||||
return QStringLiteral("Tags");
|
||||
case ItemFields::RemoteTrailers:
|
||||
return QStringLiteral("RemoteTrailers");
|
||||
case ItemFields::MediaStreams:
|
||||
return QStringLiteral("MediaStreams");
|
||||
case ItemFields::SeasonUserData:
|
||||
return QStringLiteral("SeasonUserData");
|
||||
case ItemFields::ServiceName:
|
||||
return QStringLiteral("ServiceName");
|
||||
case ItemFields::ThemeSongIds:
|
||||
return QStringLiteral("ThemeSongIds");
|
||||
case ItemFields::ThemeVideoIds:
|
||||
return QStringLiteral("ThemeVideoIds");
|
||||
case ItemFields::ExternalEtag:
|
||||
return QStringLiteral("ExternalEtag");
|
||||
case ItemFields::PresentationUniqueKey:
|
||||
return QStringLiteral("PresentationUniqueKey");
|
||||
case ItemFields::InheritedParentalRatingValue:
|
||||
return QStringLiteral("InheritedParentalRatingValue");
|
||||
case ItemFields::ExternalSeriesId:
|
||||
return QStringLiteral("ExternalSeriesId");
|
||||
case ItemFields::SeriesPresentationUniqueKey:
|
||||
return QStringLiteral("SeriesPresentationUniqueKey");
|
||||
case ItemFields::DateLastRefreshed:
|
||||
return QStringLiteral("DateLastRefreshed");
|
||||
case ItemFields::DateLastSaved:
|
||||
return QStringLiteral("DateLastSaved");
|
||||
case ItemFields::RefreshState:
|
||||
return QStringLiteral("RefreshState");
|
||||
case ItemFields::ChannelImage:
|
||||
return QStringLiteral("ChannelImage");
|
||||
case ItemFields::EnableMediaSourceDisplay:
|
||||
return QStringLiteral("EnableMediaSourceDisplay");
|
||||
case ItemFields::Width:
|
||||
return QStringLiteral("Width");
|
||||
case ItemFields::Height:
|
||||
return QStringLiteral("Height");
|
||||
case ItemFields::ExtraIds:
|
||||
return QStringLiteral("ExtraIds");
|
||||
case ItemFields::LocalTrailerCount:
|
||||
return QStringLiteral("LocalTrailerCount");
|
||||
case ItemFields::IsHD:
|
||||
return QStringLiteral("IsHD");
|
||||
case ItemFields::SpecialFeatureCount:
|
||||
return QStringLiteral("SpecialFeatureCount");
|
||||
|
||||
case ItemFields::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
ItemFilterClass::ItemFilterClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using ItemFilter = Jellyfin::DTO::ItemFilter;
|
||||
|
||||
template <>
|
||||
ItemFilter fromJsonValue<ItemFilter>(const QJsonValue &source) {
|
||||
ItemFilter fromJsonValue(const QJsonValue &source, convertType<ItemFilter>) {
|
||||
if (!source.isString()) return ItemFilter::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -77,5 +76,33 @@ ItemFilter fromJsonValue<ItemFilter>(const QJsonValue &source) {
|
|||
return ItemFilter::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const ItemFilter &source, convertType<ItemFilter>) {
|
||||
switch(source) {
|
||||
case ItemFilter::IsFolder:
|
||||
return QStringLiteral("IsFolder");
|
||||
case ItemFilter::IsNotFolder:
|
||||
return QStringLiteral("IsNotFolder");
|
||||
case ItemFilter::IsUnplayed:
|
||||
return QStringLiteral("IsUnplayed");
|
||||
case ItemFilter::IsPlayed:
|
||||
return QStringLiteral("IsPlayed");
|
||||
case ItemFilter::IsFavorite:
|
||||
return QStringLiteral("IsFavorite");
|
||||
case ItemFilter::IsResumable:
|
||||
return QStringLiteral("IsResumable");
|
||||
case ItemFilter::Likes:
|
||||
return QStringLiteral("Likes");
|
||||
case ItemFilter::Dislikes:
|
||||
return QStringLiteral("Dislikes");
|
||||
case ItemFilter::IsFavoriteOrLikes:
|
||||
return QStringLiteral("IsFavoriteOrLikes");
|
||||
|
||||
case ItemFilter::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -55,7 +55,7 @@ void JoinGroupRequestDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject JoinGroupRequestDto::toJson() {
|
||||
QJsonObject JoinGroupRequestDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["GroupId"] = Jellyfin::Support::toJsonValue<QString>(m_groupId);
|
||||
|
||||
|
@ -76,10 +76,15 @@ namespace Support {
|
|||
using JoinGroupRequestDto = Jellyfin::DTO::JoinGroupRequestDto;
|
||||
|
||||
template <>
|
||||
JoinGroupRequestDto fromJsonValue<JoinGroupRequestDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
JoinGroupRequestDto fromJsonValue(const QJsonValue &source, convertType<JoinGroupRequestDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return JoinGroupRequestDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const JoinGroupRequestDto &source, convertType<JoinGroupRequestDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace DTO {
|
|||
|
||||
KeepUntilClass::KeepUntilClass() {}
|
||||
|
||||
|
||||
} // NS DTO
|
||||
|
||||
namespace Support {
|
||||
|
@ -42,7 +41,7 @@ namespace Support {
|
|||
using KeepUntil = Jellyfin::DTO::KeepUntil;
|
||||
|
||||
template <>
|
||||
KeepUntil fromJsonValue<KeepUntil>(const QJsonValue &source) {
|
||||
KeepUntil fromJsonValue(const QJsonValue &source, convertType<KeepUntil>) {
|
||||
if (!source.isString()) return KeepUntil::EnumNotSet;
|
||||
|
||||
QString str = source.toString();
|
||||
|
@ -62,5 +61,23 @@ KeepUntil fromJsonValue<KeepUntil>(const QJsonValue &source) {
|
|||
return KeepUntil::EnumNotSet;
|
||||
}
|
||||
|
||||
template <>
|
||||
QJsonValue toJsonValue(const KeepUntil &source, convertType<KeepUntil>) {
|
||||
switch(source) {
|
||||
case KeepUntil::UntilDeleted:
|
||||
return QStringLiteral("UntilDeleted");
|
||||
case KeepUntil::UntilSpaceNeeded:
|
||||
return QStringLiteral("UntilSpaceNeeded");
|
||||
case KeepUntil::UntilWatched:
|
||||
return QStringLiteral("UntilWatched");
|
||||
case KeepUntil::UntilDate:
|
||||
return QStringLiteral("UntilDate");
|
||||
|
||||
case KeepUntil::EnumNotSet: // Fallthrough
|
||||
default:
|
||||
return QJsonValue();
|
||||
}
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
|
@ -58,7 +58,7 @@ void LibraryOptionInfoDto::setFromJson(QJsonObject source) {
|
|||
|
||||
}
|
||||
|
||||
QJsonObject LibraryOptionInfoDto::toJson() {
|
||||
QJsonObject LibraryOptionInfoDto::toJson() const {
|
||||
QJsonObject result;
|
||||
result["Name"] = Jellyfin::Support::toJsonValue<QString>(m_name);
|
||||
result["DefaultEnabled"] = Jellyfin::Support::toJsonValue<bool>(m_defaultEnabled);
|
||||
|
@ -93,10 +93,15 @@ namespace Support {
|
|||
using LibraryOptionInfoDto = Jellyfin::DTO::LibraryOptionInfoDto;
|
||||
|
||||
template <>
|
||||
LibraryOptionInfoDto fromJsonValue<LibraryOptionInfoDto>(const QJsonValue &source) {
|
||||
if (!source.isObject()) throw new ParseException("Expected JSON Object");
|
||||
LibraryOptionInfoDto fromJsonValue(const QJsonValue &source, convertType<LibraryOptionInfoDto>) {
|
||||
if (!source.isObject()) throw ParseException("Expected JSON Object");
|
||||
return LibraryOptionInfoDto::fromJson(source.toObject());
|
||||
}
|
||||
|
||||
template<>
|
||||
QJsonValue toJsonValue(const LibraryOptionInfoDto &source, convertType<LibraryOptionInfoDto>) {
|
||||
return source.toJson();
|
||||
}
|
||||
|
||||
} // NS DTO
|
||||
} // NS Jellyfin
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue