2 * SomePlayer - An alternate music player for Maemo 5
3 * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "trackmetainformation.h"
22 using namespace SomePlayer::DataObjects;
24 TrackMetadata::TrackMetadata() {
27 TrackMetadata::TrackMetadata(QString title = "", QString artist = "", QString album = "", int length = 0) {
28 _metadata["TITLE"] = title == "" ? _UNKNOWN_TRACK_ : title.trimmed();
29 _metadata["ARTIST"] = artist == "" ? _UNKNOWN_ARTIST_ : artist.trimmed();
30 _metadata["ALBUM"] = album == "" ? _UNKNOWN_ALBUM_ : album.trimmed();
34 TrackMetadata::TrackMetadata(const TrackMetadata &metadata) {
35 this->_metadata = metadata._metadata;
36 this->_length = metadata._length;
39 QString TrackMetadata::title() {
40 if (_metadata.contains("TITLE")) {
41 return _metadata["TITLE"];
43 return _UNKNOWN_TRACK_;
47 QString TrackMetadata::artist() {
48 if (_metadata.contains("ARTIST")) {
49 return _metadata["ARTIST"];
51 return _UNKNOWN_ARTIST_;
55 QString TrackMetadata::album() {
56 if (_metadata.contains("ALBUM")) {
57 return _metadata["ALBUM"];
59 return _UNKNOWN_ALBUM_;
63 int TrackMetadata::length() {
67 void TrackMetadata::setTitle(QString title) {
68 _metadata["TITLE"] = title;
71 void TrackMetadata::setArtist(QString artist) {
72 _metadata["ARTIST"] = artist;
75 void TrackMetadata::setAlbum(QString album) {
76 _metadata["ALBUM"] = album;
79 void TrackMetadata::setLength(int length) {