2
* Copyright (C) 2011 Tuomo Penttinen, all rights reserved.
4
* Author: Tuomo Penttinen <tp@herqq.org>
6
* This file is part of Herqq UPnP Av (HUPnPAv) library.
8
* Herqq UPnP Av is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
13
* Herqq UPnP Av is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with Herqq UPnP Av. If not, see <http://www.gnu.org/licenses/>.
22
#include "hvideoitem.h"
23
#include "hvideoitem_p.h"
25
#include "../hgenre.h"
26
#include "../hpersonwithrole.h"
27
#include "../hcontentduration.h"
29
#include "../../common/hrating.h"
30
#include "../model_mgmt/hcdsproperties.h"
32
#include <QtCore/QUrl>
33
#include <QtCore/QDateTime>
44
/*******************************************************************************
46
******************************************************************************/
47
HVideoItemPrivate::HVideoItemPrivate(
48
const QString& clazz, HObject::CdsType cdsType) :
49
HItemPrivate(clazz, cdsType)
51
const HCdsProperties& inst = HCdsProperties::instance();
52
insert(inst.get(HCdsProperties::upnp_genre));
53
insert(inst.get(HCdsProperties::upnp_longDescription));
54
insert(inst.get(HCdsProperties::upnp_producer));
55
insert(inst.get(HCdsProperties::upnp_rating));
56
insert(inst.get(HCdsProperties::upnp_actor));
57
insert(inst.get(HCdsProperties::upnp_director));
58
insert(inst.get(HCdsProperties::dc_description));
59
insert(inst.get(HCdsProperties::dc_publisher));
60
insert(inst.get(HCdsProperties::dc_language));
61
insert(inst.get(HCdsProperties::dc_relation));
62
insert(inst.get(HCdsProperties::upnp_playbackCount));
63
insert(inst.get(HCdsProperties::upnp_lastPlaybackTime));
64
insert(inst.get(HCdsProperties::upnp_lastPlaybackPosition));
65
insert(inst.get(HCdsProperties::upnp_recordedDayOfWeek));
66
insert(inst.get(HCdsProperties::upnp_srsRecordScheduleID));
69
/*******************************************************************************
71
******************************************************************************/
72
HVideoItem::HVideoItem(const QString& clazz, CdsType cdsType) :
73
HItem(*new HVideoItemPrivate(clazz, cdsType))
77
HVideoItem::HVideoItem(HVideoItemPrivate& dd) :
82
HVideoItem::HVideoItem(
83
const QString& title, const QString& parentId, const QString& id) :
84
HItem(*new HVideoItemPrivate(sClass(), sType()))
86
init(title, parentId, id);
89
HVideoItem::~HVideoItem()
93
HVideoItem* HVideoItem::newInstance() const
95
return new HVideoItem();
98
void HVideoItem::setGenres(const QList<HGenre>& arg)
100
setCdsProperty(HCdsProperties::upnp_genre, toList(arg));
103
void HVideoItem::setLongDescription(const QString& arg)
105
setCdsProperty(HCdsProperties::upnp_longDescription, arg);
108
void HVideoItem::setProducers(const QStringList& arg)
110
setCdsProperty(HCdsProperties::upnp_producer, arg);
113
void HVideoItem::setRatings(const QList<HRating>& arg)
115
setCdsProperty(HCdsProperties::upnp_rating, toList(arg));
118
void HVideoItem::setActors(const QList<HPersonWithRole>& arg)
120
setCdsProperty(HCdsProperties::upnp_actor, toList(arg));
123
void HVideoItem::setDirectors(const QStringList& arg)
125
setCdsProperty(HCdsProperties::upnp_director, arg);
128
void HVideoItem::setDescription(const QString& arg)
130
setCdsProperty(HCdsProperties::dc_description, arg);
133
void HVideoItem::setPublishers(const QStringList& arg)
135
setCdsProperty(HCdsProperties::dc_publisher, arg);
138
void HVideoItem::setLanguages(const QStringList& arg)
140
setCdsProperty(HCdsProperties::dc_language, arg);
143
void HVideoItem::setRelations(const QList<QUrl>& arg)
145
setCdsProperty(HCdsProperties::dc_relation, toList(arg));
148
void HVideoItem::setPlaybackCount(qint32 arg)
150
setCdsProperty(HCdsProperties::upnp_playbackCount, arg);
153
void HVideoItem::setLastPlaybackTime(const QDateTime& arg)
155
setCdsProperty(HCdsProperties::upnp_lastPlaybackTime, arg);
158
void HVideoItem::setLastPlaybackPosition(const HContentDuration& arg)
160
setCdsProperty(HCdsProperties::upnp_lastPlaybackPosition, QVariant::fromValue(arg));
163
void HVideoItem::setRecordedDayOfWeek(HDayOfWeek arg)
165
setCdsProperty(HCdsProperties::upnp_recordedDayOfWeek, QVariant::fromValue(arg));
168
void HVideoItem::setSrsRecordScheduleId(const QString& arg)
170
setCdsProperty(HCdsProperties::upnp_srsRecordScheduleID, arg);
173
QList<HGenre> HVideoItem::genres() const
176
getCdsProperty(HCdsProperties::upnp_genre, &value);
177
return toList<HGenre>(value.toList());
180
QString HVideoItem::longDescription() const
183
getCdsProperty(HCdsProperties::upnp_longDescription, &value);
184
return value.toString();
187
QStringList HVideoItem::producers() const
190
getCdsProperty(HCdsProperties::upnp_producer, &value);
191
return value.toStringList();
194
QList<HRating> HVideoItem::ratings() const
197
getCdsProperty(HCdsProperties::upnp_rating, &value);
198
return toList<HRating>(value.toList());
201
QList<HPersonWithRole> HVideoItem::actors() const
204
getCdsProperty(HCdsProperties::upnp_actor, &value);
205
return toList<HPersonWithRole>(value.toList());
208
QStringList HVideoItem::directors() const
211
getCdsProperty(HCdsProperties::upnp_director, &value);
212
return value.toStringList();
215
QString HVideoItem::description() const
218
getCdsProperty(HCdsProperties::dc_description, &value);
219
return value.toString();
222
QStringList HVideoItem::publishers() const
225
getCdsProperty(HCdsProperties::dc_publisher, &value);
226
return value.toStringList();
229
QStringList HVideoItem::languages() const
232
getCdsProperty(HCdsProperties::dc_language, &value);
233
return value.toStringList();
236
QList<QUrl> HVideoItem::relations() const
239
getCdsProperty(HCdsProperties::dc_relation, &value);
240
return toList<QUrl>(value.toList());
243
qint32 HVideoItem::playbackCount() const
246
getCdsProperty(HCdsProperties::upnp_playbackCount, &value);
247
return value.toInt();
250
QDateTime HVideoItem::lastPlaybackTime() const
253
getCdsProperty(HCdsProperties::upnp_lastPlaybackTime, &value);
254
return value.toDateTime();
257
HContentDuration HVideoItem::lastPlaybackPosition() const
260
getCdsProperty(HCdsProperties::upnp_lastPlaybackPosition, &value);
261
return value.value<HContentDuration>();
264
HDayOfWeek HVideoItem::recordedDayOfWeek() const
267
getCdsProperty(HCdsProperties::upnp_recordedDayOfWeek, &value);
268
return value.value<HDayOfWeek>();
271
QString HVideoItem::srsRecordScheduleId() const
274
getCdsProperty(HCdsProperties::upnp_srsRecordScheduleID, &value);
275
return value.toString();