1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2025-09-05 18:22:46 +00:00

WIP: Add playlists/queues and add support for Sailfish back

This commit is contained in:
Chris Josten 2021-07-31 15:06:17 +02:00
parent fbc154fb56
commit 86672be051
89 changed files with 1637 additions and 849 deletions

View file

@ -16,25 +16,14 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "JellyfinQt/support/jsonconv.h"
#include "JellyfinQt/support/jsonconvimpl.h"
#include "JellyfinQt/support/parseexception.h"
#include <QDebug>
namespace Jellyfin {
namespace Support {
const char * ParseException::what() const noexcept {
return m_message.c_str();
}
QException *ParseException::clone() const {
return new ParseException(*this);
}
void ParseException::raise() const {
throw *this;
}
QString uuidToString(const QUuid &source) {
QString str = source.toString();
// Convert {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} (length: 38)
@ -195,7 +184,8 @@ QDateTime fromJsonValue<QDateTime>(const QJsonValue &source, convertType<QDateTi
case QJsonValue::Null:
return QDateTime();
case QJsonValue::String:
return QDateTime::fromString(source.toString(), Qt::ISODateWithMs);
// 2005-02-21T00:00:00.0000000Z
return QDateTime::fromString(source.toString(), Qt::ISODate);
default:
throw ParseException("Error while trying to parse JSON value as DateTime: not a string");
}
@ -203,7 +193,18 @@ QDateTime fromJsonValue<QDateTime>(const QJsonValue &source, convertType<QDateTi
template <>
QJsonValue toJsonValue<QDateTime>(const QDateTime &source, convertType<QDateTime>) {
return QJsonValue(source.toString(Qt::ISODateWithMs));
return QJsonValue(source.toString(Qt::ISODate));
}
// QVariant
template <>
QVariant fromJsonValue<QVariant>(const QJsonValue &source, convertType<QVariant>) {
return source.toVariant();
}
template<>
QJsonValue toJsonValue<QVariant>(const QVariant &source, convertType<QVariant>) {
return QJsonValue::fromVariant(source);
}
// QUuid

View file

@ -0,0 +1,38 @@
/*
* Sailfin: a Jellyfin client written using Qt
* Copyright (C) 2021 Chris Josten and the Sailfin Contributors.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "JellyfinQt/support/parseexception.h"
namespace Jellyfin {
namespace Support {
const char * ParseException::what() const noexcept {
return m_message.c_str();
}
QException *ParseException::clone() const {
return new ParseException(*this);
}
void ParseException::raise() const {
throw *this;
}
} // NS Support
} // NS Jellyfin