Music Hub ..
A session-wide music playback service
Loading...
Searching...
No Matches
track_metadata.cpp
Go to the documentation of this file.
1/*
2 * Copyright © 2016 Canonical Ltd.
3 * Copyright © 2022 UBports Foundation.
4 *
5 * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License version 3,
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Authored by: Jim Hodapp <jim.hodapp@canonical.com>
20 */
21
22#include "track.h"
23#include "xesam.h"
24
26
28{
29 insert(xesam::Album::name, album);
30}
31
33{
34 insert(xesam::Artist::name, artist);
35}
36
38{
39 insert(xesam::Title::name, title);
40}
41
43{
45}
46
48{
50 QVariant(qint64(length)));
51}
52
54{
55 insert(media::Track::MetaData::TrackArtlUrlKey, url.toString());
56}
57
58void media::Track::MetaData::setLastUsed(const QString &datetime)
59{
60 insert(xesam::LastUsed::name, datetime);
61}
62
64{
65 return value(xesam::Album::name).toString();
66}
67
69{
70 return value(xesam::Artist::name).toString();
71}
72
74{
75 return value(xesam::Title::name).toString();
76}
77
79{
80 return value(media::Track::MetaData::TrackIdKey).toString();
81}
82
84{
85 return value(media::Track::MetaData::TrackLengthKey).value<int64_t>();
86}
87
89{
90 return value(media::Track::MetaData::TrackArtlUrlKey).toUrl();
91}
92
94{
95 return value(xesam::LastUsed::name).toString();
96}
static constexpr const char * TrackLengthKey
Definition track.h:42
void setLastUsed(const QString &datetime)
static constexpr const char * TrackIdKey
Definition track.h:43
void setArtist(const QString &artist)
static constexpr const char * TrackArtlUrlKey
Definition track.h:41