2010-03-24 00:11:46 +01:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-03-24 00:11:46 +01:00
|
|
|
|
|
|
|
Clementine is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine 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 General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
#include "song.h"
|
2010-08-03 21:29:49 +02:00
|
|
|
|
|
|
|
#include <algorithm>
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2013-09-29 10:43:34 +02:00
|
|
|
#include <QCoreApplication>
|
2013-10-03 17:08:42 +02:00
|
|
|
#include <QDir>
|
2009-12-24 20:16:07 +01:00
|
|
|
#include <QFile>
|
|
|
|
#include <QFileInfo>
|
2011-11-27 16:01:10 +01:00
|
|
|
#include <QLatin1Literal>
|
2011-11-28 14:51:35 +01:00
|
|
|
#include <QSharedData>
|
2009-12-24 20:16:07 +01:00
|
|
|
#include <QSqlQuery>
|
2010-05-10 15:46:06 +02:00
|
|
|
#include <QTextCodec>
|
2010-08-03 21:29:49 +02:00
|
|
|
#include <QTime>
|
2009-12-24 20:16:07 +01:00
|
|
|
#include <QVariant>
|
2011-11-28 14:51:35 +01:00
|
|
|
#include <QtConcurrentRun>
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2012-12-06 14:23:27 +01:00
|
|
|
#ifdef HAVE_LIBLASTFM
|
|
|
|
#include "internet/fixlastfm.h"
|
|
|
|
#ifdef HAVE_LIBLASTFM1
|
|
|
|
#include <lastfm/Track.h>
|
|
|
|
#else
|
|
|
|
#include <lastfm/Track>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2012-01-02 18:21:07 +01:00
|
|
|
#include <id3v1genres.h>
|
|
|
|
|
2011-11-28 14:51:35 +01:00
|
|
|
#ifdef HAVE_LIBGPOD
|
|
|
|
# include <gpod/itdb.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBMTP
|
|
|
|
# include <libmtp.h>
|
|
|
|
#endif
|
|
|
|
|
2013-10-03 17:08:42 +02:00
|
|
|
#include "core/application.h"
|
2012-12-06 14:23:27 +01:00
|
|
|
#include "core/logging.h"
|
|
|
|
#include "core/messagehandler.h"
|
|
|
|
#include "core/mpris_common.h"
|
|
|
|
#include "core/timeconstants.h"
|
|
|
|
#include "core/utilities.h"
|
2011-04-02 15:34:06 +02:00
|
|
|
#include "covers/albumcoverloader.h"
|
2010-05-10 23:50:31 +02:00
|
|
|
#include "engines/enginebase.h"
|
2010-08-03 20:57:17 +02:00
|
|
|
#include "library/sqlrow.h"
|
2012-12-06 14:23:27 +01:00
|
|
|
#include "tagreadermessages.pb.h"
|
2010-05-10 23:50:31 +02:00
|
|
|
#include "widgets/trackslider.h"
|
2010-01-15 22:57:22 +01:00
|
|
|
|
2011-09-28 01:16:02 +02:00
|
|
|
|
2010-04-14 23:03:00 +02:00
|
|
|
const QStringList Song::kColumns = QStringList()
|
|
|
|
<< "title" << "album" << "artist" << "albumartist" << "composer" << "track"
|
|
|
|
<< "disc" << "bpm" << "year" << "genre" << "comment" << "compilation"
|
2011-01-04 18:12:29 +01:00
|
|
|
<< "bitrate" << "samplerate" << "directory" << "filename"
|
2010-04-14 23:03:00 +02:00
|
|
|
<< "mtime" << "ctime" << "filesize" << "sampler" << "art_automatic"
|
|
|
|
<< "art_manual" << "filetype" << "playcount" << "lastplayed" << "rating"
|
|
|
|
<< "forced_compilation_on" << "forced_compilation_off"
|
2011-01-15 19:46:23 +01:00
|
|
|
<< "effective_compilation" << "skipcount" << "score" << "beginning" << "length"
|
2013-03-03 13:00:24 +01:00
|
|
|
<< "cue_path" << "unavailable" << "effective_albumartist" << "etag"
|
|
|
|
<< "performer" << "grouping";
|
2010-04-14 23:03:00 +02:00
|
|
|
|
|
|
|
const QString Song::kColumnSpec = Song::kColumns.join(", ");
|
2012-03-04 21:47:58 +01:00
|
|
|
const QString Song::kBindSpec = Utilities::Prepend(":", Song::kColumns).join(", ");
|
|
|
|
const QString Song::kUpdateSpec = Utilities::Updateify(Song::kColumns).join(", ");
|
2010-04-14 23:03:00 +02:00
|
|
|
|
2010-06-20 18:30:10 +02:00
|
|
|
|
|
|
|
const QStringList Song::kFtsColumns = QStringList()
|
|
|
|
<< "ftstitle" << "ftsalbum" << "ftsartist" << "ftsalbumartist"
|
2013-03-03 13:00:24 +01:00
|
|
|
<< "ftscomposer" << "ftsperformer" << "ftsgrouping" << "ftsgenre" << "ftscomment";
|
2010-06-20 18:30:10 +02:00
|
|
|
|
|
|
|
const QString Song::kFtsColumnSpec = Song::kFtsColumns.join(", ");
|
2012-03-04 21:47:58 +01:00
|
|
|
const QString Song::kFtsBindSpec = Utilities::Prepend(":", Song::kFtsColumns).join(", ");
|
|
|
|
const QString Song::kFtsUpdateSpec = Utilities::Updateify(Song::kFtsColumns).join(", ");
|
2010-06-20 18:30:10 +02:00
|
|
|
|
2011-02-02 22:01:08 +01:00
|
|
|
const QString Song::kManuallyUnsetCover = "(unset)";
|
|
|
|
const QString Song::kEmbeddedCover = "(embedded)";
|
|
|
|
|
2011-11-28 14:51:35 +01:00
|
|
|
|
|
|
|
struct Song::Private : public QSharedData {
|
|
|
|
Private();
|
|
|
|
|
|
|
|
bool valid_;
|
|
|
|
int id_;
|
|
|
|
|
|
|
|
QString title_;
|
|
|
|
QString album_;
|
|
|
|
QString artist_;
|
|
|
|
QString albumartist_;
|
|
|
|
QString composer_;
|
2013-03-03 13:00:24 +01:00
|
|
|
QString performer_;
|
|
|
|
QString grouping_;
|
2011-11-28 14:51:35 +01:00
|
|
|
int track_;
|
|
|
|
int disc_;
|
|
|
|
float bpm_;
|
|
|
|
int year_;
|
|
|
|
QString genre_;
|
|
|
|
QString comment_;
|
|
|
|
bool compilation_; // From the file tag
|
|
|
|
bool sampler_; // From the library scanner
|
|
|
|
bool forced_compilation_on_; // Set by the user
|
|
|
|
bool forced_compilation_off_; // Set by the user
|
|
|
|
|
2013-02-02 10:22:08 +01:00
|
|
|
// A unique album ID
|
|
|
|
// Used to distinguish between albums from providers that have multiple
|
|
|
|
// versions of a given album with the same title (e.g. Spotify).
|
|
|
|
// This is never persisted, it is only stored temporarily for global search
|
|
|
|
// results.
|
|
|
|
int album_id_;
|
|
|
|
|
2011-11-28 14:51:35 +01:00
|
|
|
float rating_;
|
|
|
|
int playcount_;
|
|
|
|
int skipcount_;
|
|
|
|
int lastplayed_;
|
|
|
|
int score_;
|
|
|
|
|
|
|
|
// The beginning of the song in seconds. In case of single-part media
|
|
|
|
// streams, this will equal to 0. In case of multi-part streams on the
|
|
|
|
// other hand, this will mark the beginning of a section represented by
|
|
|
|
// this Song object. This is always greater than 0.
|
|
|
|
qint64 beginning_;
|
|
|
|
// The end of the song in seconds. In case of single-part media
|
|
|
|
// streams, this will equal to the song's length. In case of multi-part
|
|
|
|
// streams on the other hand, this will mark the end of a section
|
|
|
|
// represented by this Song object.
|
|
|
|
// This may be negative indicating that the length of this song is
|
|
|
|
// unknown.
|
|
|
|
qint64 end_;
|
|
|
|
|
|
|
|
int bitrate_;
|
|
|
|
int samplerate_;
|
|
|
|
|
|
|
|
int directory_id_;
|
|
|
|
QUrl url_;
|
|
|
|
QString basefilename_;
|
|
|
|
int mtime_;
|
|
|
|
int ctime_;
|
|
|
|
int filesize_;
|
|
|
|
FileType filetype_;
|
|
|
|
|
|
|
|
// If the song has a CUE, this contains it's path.
|
|
|
|
QString cue_path_;
|
|
|
|
|
|
|
|
// Filenames to album art for this song.
|
|
|
|
QString art_automatic_; // Guessed by LibraryWatcher
|
|
|
|
QString art_manual_; // Set by the user - should take priority
|
|
|
|
|
|
|
|
QImage image_;
|
|
|
|
|
|
|
|
// Whether this song was loaded from a file using taglib.
|
|
|
|
bool init_from_file_;
|
|
|
|
// Whether our encoding guesser thinks these tags might be incorrectly encoded.
|
|
|
|
bool suspicious_tags_;
|
|
|
|
|
|
|
|
// Whether the song does not exist on the file system anymore, but is still
|
|
|
|
// stored in the database so as to remember the user's metadata.
|
|
|
|
bool unavailable_;
|
2012-07-27 16:04:12 +02:00
|
|
|
|
|
|
|
QString etag_;
|
2011-11-28 14:51:35 +01:00
|
|
|
};
|
2010-08-08 14:35:23 +02:00
|
|
|
|
2010-06-02 14:31:40 +02:00
|
|
|
|
2010-03-07 23:46:41 +01:00
|
|
|
Song::Private::Private()
|
2009-12-24 20:16:07 +01:00
|
|
|
: valid_(false),
|
|
|
|
id_(-1),
|
|
|
|
track_(-1),
|
|
|
|
disc_(-1),
|
|
|
|
bpm_(-1),
|
|
|
|
year_(-1),
|
|
|
|
compilation_(false),
|
2010-02-27 21:12:22 +01:00
|
|
|
sampler_(false),
|
2010-03-21 00:59:39 +01:00
|
|
|
forced_compilation_on_(false),
|
|
|
|
forced_compilation_off_(false),
|
2013-02-02 10:22:08 +01:00
|
|
|
album_id_(-1),
|
2010-10-17 18:03:49 +02:00
|
|
|
rating_(-1.0),
|
|
|
|
playcount_(0),
|
2010-10-17 19:50:20 +02:00
|
|
|
skipcount_(0),
|
|
|
|
lastplayed_(-1),
|
2010-11-01 22:15:52 +01:00
|
|
|
score_(0),
|
2010-12-23 22:13:43 +01:00
|
|
|
beginning_(0),
|
|
|
|
end_(-1),
|
2009-12-24 20:16:07 +01:00
|
|
|
bitrate_(-1),
|
|
|
|
samplerate_(-1),
|
|
|
|
directory_id_(-1),
|
|
|
|
mtime_(-1),
|
|
|
|
ctime_(-1),
|
2010-03-07 23:46:41 +01:00
|
|
|
filesize_(-1),
|
2010-10-12 13:55:45 +02:00
|
|
|
filetype_(Type_Unknown),
|
2011-03-06 17:39:36 +01:00
|
|
|
init_from_file_(false),
|
2011-05-14 15:43:57 +02:00
|
|
|
suspicious_tags_(false),
|
|
|
|
unavailable_(false)
|
2009-12-24 20:16:07 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-03-06 21:08:01 +01:00
|
|
|
|
2010-01-15 22:57:22 +01:00
|
|
|
Song::Song()
|
2012-01-02 18:21:07 +01:00
|
|
|
: d(new Private)
|
2010-01-15 22:57:22 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Song::Song(const Song &other)
|
2012-01-02 18:21:07 +01:00
|
|
|
: d(other.d)
|
2010-01-15 22:57:22 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-11-28 14:51:35 +01:00
|
|
|
Song::~Song() {
|
|
|
|
}
|
|
|
|
|
|
|
|
Song& Song::operator =(const Song& other) {
|
|
|
|
d = other.d;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Song::is_valid() const { return d->valid_; }
|
|
|
|
bool Song::is_unavailable() const { return d->unavailable_; }
|
|
|
|
int Song::id() const { return d->id_; }
|
|
|
|
const QString& Song::title() const { return d->title_; }
|
|
|
|
const QString& Song::album() const { return d->album_; }
|
|
|
|
const QString& Song::artist() const { return d->artist_; }
|
|
|
|
const QString& Song::albumartist() const { return d->albumartist_; }
|
|
|
|
const QString& Song::effective_albumartist() const { return d->albumartist_.isEmpty() ? d->artist_ : d->albumartist_; }
|
|
|
|
const QString& Song::playlist_albumartist() const { return is_compilation() ? d->albumartist_ : effective_albumartist(); }
|
|
|
|
const QString& Song::composer() const { return d->composer_; }
|
2013-03-03 13:00:24 +01:00
|
|
|
const QString& Song::performer() const { return d->performer_; }
|
|
|
|
const QString& Song::grouping() const { return d->grouping_; }
|
2011-11-28 14:51:35 +01:00
|
|
|
int Song::track() const { return d->track_; }
|
|
|
|
int Song::disc() const { return d->disc_; }
|
|
|
|
float Song::bpm() const { return d->bpm_; }
|
|
|
|
int Song::year() const { return d->year_; }
|
|
|
|
const QString& Song::genre() const { return d->genre_; }
|
|
|
|
const QString& Song::comment() const { return d->comment_; }
|
|
|
|
bool Song::is_compilation() const {
|
|
|
|
return (d->compilation_ || d->sampler_ || d->forced_compilation_on_)
|
|
|
|
&& ! d->forced_compilation_off_;
|
|
|
|
}
|
|
|
|
float Song::rating() const { return d->rating_; }
|
|
|
|
int Song::playcount() const { return d->playcount_; }
|
|
|
|
int Song::skipcount() const { return d->skipcount_; }
|
|
|
|
int Song::lastplayed() const { return d->lastplayed_; }
|
|
|
|
int Song::score() const { return d->score_; }
|
|
|
|
const QString& Song::cue_path() const { return d->cue_path_; }
|
|
|
|
bool Song::has_cue() const { return !d->cue_path_.isEmpty(); }
|
2013-02-02 10:22:08 +01:00
|
|
|
int Song::album_id() const { return d->album_id_; }
|
2011-11-28 14:51:35 +01:00
|
|
|
qint64 Song::beginning_nanosec() const { return d->beginning_; }
|
|
|
|
qint64 Song::end_nanosec() const { return d->end_; }
|
|
|
|
qint64 Song::length_nanosec() const { return d->end_ - d->beginning_; }
|
|
|
|
int Song::bitrate() const { return d->bitrate_; }
|
|
|
|
int Song::samplerate() const { return d->samplerate_; }
|
|
|
|
int Song::directory_id() const { return d->directory_id_; }
|
2013-10-03 17:08:42 +02:00
|
|
|
const QUrl& Song::url() const { return d->url_; }
|
|
|
|
const QString& Song::basefilename() const { return d->basefilename_; }
|
2011-11-28 14:51:35 +01:00
|
|
|
uint Song::mtime() const { return d->mtime_; }
|
|
|
|
uint Song::ctime() const { return d->ctime_; }
|
|
|
|
int Song::filesize() const { return d->filesize_; }
|
|
|
|
Song::FileType Song::filetype() const { return d->filetype_; }
|
|
|
|
bool Song::is_stream() const { return d->filetype_ == Type_Stream; }
|
|
|
|
bool Song::is_cdda() const { return d->filetype_ == Type_Cdda; }
|
|
|
|
const QString& Song::art_automatic() const { return d->art_automatic_; }
|
|
|
|
const QString& Song::art_manual() const { return d->art_manual_; }
|
2012-07-27 16:04:12 +02:00
|
|
|
const QString& Song::etag() const { return d->etag_; }
|
2011-11-28 14:51:35 +01:00
|
|
|
bool Song::has_manually_unset_cover() const { return d->art_manual_ == kManuallyUnsetCover; }
|
|
|
|
void Song::manually_unset_cover() { d->art_manual_ = kManuallyUnsetCover; }
|
|
|
|
bool Song::has_embedded_cover() const { return d->art_automatic_ == kEmbeddedCover; }
|
|
|
|
void Song::set_embedded_cover() { d->art_automatic_ = kEmbeddedCover; }
|
|
|
|
const QImage& Song::image() const { return d->image_; }
|
|
|
|
void Song::set_id(int id) { d->id_ = id; }
|
|
|
|
void Song::set_valid(bool v) { d->valid_ = v; }
|
|
|
|
void Song::set_title(const QString& v) { d->title_ = v; }
|
|
|
|
void Song::set_album(const QString& v) { d->album_ = v; }
|
|
|
|
void Song::set_artist(const QString& v) { d->artist_ = v; }
|
|
|
|
void Song::set_albumartist(const QString& v) { d->albumartist_ = v; }
|
|
|
|
void Song::set_composer(const QString& v) { d->composer_ = v; }
|
2013-03-03 13:00:24 +01:00
|
|
|
void Song::set_performer(const QString& v) { d->performer_ = v; }
|
|
|
|
void Song::set_grouping(const QString& v) { d->grouping_ = v; }
|
2011-11-28 14:51:35 +01:00
|
|
|
void Song::set_track(int v) { d->track_ = v; }
|
|
|
|
void Song::set_disc(int v) { d->disc_ = v; }
|
|
|
|
void Song::set_bpm(float v) { d->bpm_ = v; }
|
|
|
|
void Song::set_year(int v) { d->year_ = v; }
|
|
|
|
void Song::set_genre(const QString& v) { d->genre_ = v; }
|
|
|
|
void Song::set_comment(const QString& v) { d->comment_ = v; }
|
|
|
|
void Song::set_compilation(bool v) { d->compilation_ = v; }
|
|
|
|
void Song::set_sampler(bool v) { d->sampler_ = v; }
|
2013-02-02 10:22:08 +01:00
|
|
|
void Song::set_album_id(int v) { d->album_id_ = v; }
|
2011-11-28 14:51:35 +01:00
|
|
|
void Song::set_beginning_nanosec(qint64 v) { d->beginning_ = qMax(0ll, v); }
|
|
|
|
void Song::set_end_nanosec(qint64 v) { d->end_ = v; }
|
|
|
|
void Song::set_length_nanosec(qint64 v) { d->end_ = d->beginning_ + v; }
|
|
|
|
void Song::set_bitrate(int v) { d->bitrate_ = v; }
|
|
|
|
void Song::set_samplerate(int v) { d->samplerate_ = v; }
|
|
|
|
void Song::set_mtime(int v) { d->mtime_ = v; }
|
|
|
|
void Song::set_ctime(int v) { d->ctime_ = v; }
|
|
|
|
void Song::set_filesize(int v) { d->filesize_ = v; }
|
|
|
|
void Song::set_filetype(FileType v) { d->filetype_ = v; }
|
|
|
|
void Song::set_art_automatic(const QString& v) { d->art_automatic_ = v; }
|
|
|
|
void Song::set_art_manual(const QString& v) { d->art_manual_ = v; }
|
|
|
|
void Song::set_image(const QImage& i) { d->image_ = i; }
|
|
|
|
void Song::set_forced_compilation_on(bool v) { d->forced_compilation_on_ = v; }
|
|
|
|
void Song::set_forced_compilation_off(bool v) { d->forced_compilation_off_ = v; }
|
|
|
|
void Song::set_rating(float v) { d->rating_ = v; }
|
|
|
|
void Song::set_playcount(int v) { d->playcount_ = v; }
|
|
|
|
void Song::set_skipcount(int v) { d->skipcount_ = v; }
|
|
|
|
void Song::set_lastplayed(int v) { d->lastplayed_ = v; }
|
|
|
|
void Song::set_score(int v) { d->score_ = qBound(0, v, 100); }
|
|
|
|
void Song::set_cue_path(const QString& v) { d->cue_path_ = v; }
|
|
|
|
void Song::set_unavailable(bool v) { d->unavailable_ = v; }
|
2012-07-27 16:04:12 +02:00
|
|
|
void Song::set_etag(const QString& etag) { d->etag_ = etag; }
|
2013-10-03 17:08:42 +02:00
|
|
|
|
|
|
|
void Song::set_url(const QUrl& v) {
|
|
|
|
if (Application::kIsPortable) {
|
|
|
|
QUrl base = QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + "/");
|
|
|
|
d->url_ = base.resolved(v);
|
|
|
|
} else {
|
|
|
|
d->url_ = v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-28 14:51:35 +01:00
|
|
|
void Song::set_basefilename(const QString& v) { d->basefilename_ = v; }
|
|
|
|
void Song::set_directory_id(int v) { d->directory_id_ = v; }
|
|
|
|
|
|
|
|
QString Song::JoinSpec(const QString& table) {
|
2012-03-04 21:47:58 +01:00
|
|
|
return Utilities::Prepend(table + ".", kColumns).join(", ");
|
2011-11-28 14:51:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Song::TextForFiletype(FileType type) {
|
|
|
|
switch (type) {
|
|
|
|
case Song::Type_Asf: return QObject::tr("Windows Media audio");
|
|
|
|
case Song::Type_Flac: return QObject::tr("Flac");
|
|
|
|
case Song::Type_Mp4: return QObject::tr("MP4 AAC");
|
|
|
|
case Song::Type_Mpc: return QObject::tr("MPC");
|
|
|
|
case Song::Type_Mpeg: return QObject::tr("MP3"); // Not technically correct
|
|
|
|
case Song::Type_OggFlac: return QObject::tr("Ogg Flac");
|
|
|
|
case Song::Type_OggSpeex: return QObject::tr("Ogg Speex");
|
|
|
|
case Song::Type_OggVorbis: return QObject::tr("Ogg Vorbis");
|
2013-01-26 12:18:24 +01:00
|
|
|
case Song::Type_OggOpus: return QObject::tr("Ogg Opus");
|
2011-11-28 14:51:35 +01:00
|
|
|
case Song::Type_Aiff: return QObject::tr("AIFF");
|
|
|
|
case Song::Type_Wav: return QObject::tr("Wav");
|
|
|
|
case Song::Type_TrueAudio: return QObject::tr("TrueAudio");
|
|
|
|
case Song::Type_Cdda: return QObject::tr("CDDA");
|
|
|
|
|
|
|
|
case Song::Type_Stream: return QObject::tr("Stream");
|
|
|
|
|
|
|
|
case Song::Type_Unknown:
|
|
|
|
default:
|
|
|
|
return QObject::tr("Unknown");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-27 01:55:51 +02:00
|
|
|
int CompareSongsName(const Song& song1, const Song& song2) {
|
|
|
|
return song1.PrettyTitleWithArtist().localeAwareCompare(song2.PrettyTitleWithArtist()) < 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Song::SortSongsListAlphabetically(SongList* songs) {
|
|
|
|
Q_ASSERT(songs);
|
|
|
|
qSort(songs->begin(), songs->end(), CompareSongsName);
|
|
|
|
}
|
|
|
|
|
2011-02-13 19:34:30 +01:00
|
|
|
void Song::Init(const QString& title, const QString& artist,
|
2011-02-27 18:16:22 +01:00
|
|
|
const QString& album, qint64 length_nanosec) {
|
2010-03-07 16:26:54 +01:00
|
|
|
d->valid_ = true;
|
2010-12-23 22:13:43 +01:00
|
|
|
|
2010-03-07 16:26:54 +01:00
|
|
|
d->title_ = title;
|
|
|
|
d->artist_ = artist;
|
2010-03-09 18:17:32 +01:00
|
|
|
d->album_ = album;
|
2010-12-23 22:13:43 +01:00
|
|
|
|
2011-02-27 18:16:22 +01:00
|
|
|
set_length_nanosec(length_nanosec);
|
2010-12-23 22:13:43 +01:00
|
|
|
}
|
|
|
|
|
2011-02-13 19:34:30 +01:00
|
|
|
void Song::Init(const QString& title, const QString& artist,
|
|
|
|
const QString& album, qint64 beginning, qint64 end) {
|
2010-12-23 22:13:43 +01:00
|
|
|
d->valid_ = true;
|
|
|
|
|
|
|
|
d->title_ = title;
|
|
|
|
d->artist_ = artist;
|
|
|
|
d->album_ = album;
|
|
|
|
|
|
|
|
d->beginning_ = beginning;
|
|
|
|
d->end_ = end;
|
2010-03-07 16:26:54 +01:00
|
|
|
}
|
|
|
|
|
2011-02-27 18:16:22 +01:00
|
|
|
void Song::set_genre_id3(int id) {
|
2010-11-23 18:38:39 +01:00
|
|
|
set_genre(TStringToQString(TagLib::ID3v1::genre(id)));
|
|
|
|
}
|
|
|
|
|
2010-08-09 15:12:54 +02:00
|
|
|
QString Song::Decode(const QString& tag, const QTextCodec* codec) {
|
|
|
|
if (!codec) {
|
|
|
|
return tag;
|
|
|
|
}
|
|
|
|
|
|
|
|
return codec->toUnicode(tag.toUtf8());
|
|
|
|
}
|
|
|
|
|
2012-01-02 18:21:07 +01:00
|
|
|
void Song::InitFromProtobuf(const pb::tagreader::SongMetadata& pb) {
|
2011-03-10 19:01:35 +01:00
|
|
|
d->init_from_file_ = true;
|
2012-01-02 18:21:07 +01:00
|
|
|
d->valid_ = pb.valid();
|
|
|
|
d->title_ = QStringFromStdString(pb.title());
|
|
|
|
d->album_ = QStringFromStdString(pb.album());
|
|
|
|
d->artist_ = QStringFromStdString(pb.artist());
|
|
|
|
d->albumartist_ = QStringFromStdString(pb.albumartist());
|
|
|
|
d->composer_ = QStringFromStdString(pb.composer());
|
2013-03-03 13:00:24 +01:00
|
|
|
d->performer_ = QStringFromStdString(pb.performer());
|
|
|
|
d->grouping_ = QStringFromStdString(pb.grouping());
|
2012-01-02 18:21:07 +01:00
|
|
|
d->track_ = pb.track();
|
|
|
|
d->disc_ = pb.disc();
|
|
|
|
d->bpm_ = pb.bpm();
|
|
|
|
d->year_ = pb.year();
|
|
|
|
d->genre_ = QStringFromStdString(pb.genre());
|
|
|
|
d->comment_ = QStringFromStdString(pb.comment());
|
|
|
|
d->compilation_ = pb.compilation();
|
|
|
|
d->playcount_ = pb.playcount();
|
|
|
|
d->skipcount_ = pb.skipcount();
|
|
|
|
d->lastplayed_ = pb.lastplayed();
|
|
|
|
d->score_ = pb.score();
|
|
|
|
set_length_nanosec(pb.length_nanosec());
|
|
|
|
d->bitrate_ = pb.bitrate();
|
|
|
|
d->samplerate_ = pb.samplerate();
|
2013-10-03 17:08:42 +02:00
|
|
|
set_url(QUrl::fromEncoded(QByteArray(pb.url().data(), pb.url().size())));
|
2012-01-02 18:21:07 +01:00
|
|
|
d->basefilename_ = QStringFromStdString(pb.basefilename());
|
|
|
|
d->mtime_ = pb.mtime();
|
|
|
|
d->ctime_ = pb.ctime();
|
|
|
|
d->filesize_ = pb.filesize();
|
|
|
|
d->suspicious_tags_ = pb.suspicious_tags();
|
|
|
|
d->filetype_ = static_cast<FileType>(pb.type());
|
2012-12-06 14:23:27 +01:00
|
|
|
d->etag_ = QStringFromStdString(pb.etag());
|
2012-03-04 14:34:49 +01:00
|
|
|
|
2012-06-17 17:55:19 +02:00
|
|
|
if (pb.has_art_automatic()) {
|
|
|
|
d->art_automatic_ = QStringFromStdString(pb.art_automatic());
|
|
|
|
}
|
|
|
|
|
2012-03-04 14:34:49 +01:00
|
|
|
if (pb.has_rating()) {
|
|
|
|
d->rating_ = pb.rating();
|
|
|
|
}
|
2013-12-31 15:21:50 +01:00
|
|
|
|
|
|
|
InitArtManual();
|
2010-03-07 23:46:41 +01:00
|
|
|
}
|
|
|
|
|
2012-01-02 18:21:07 +01:00
|
|
|
void Song::ToProtobuf(pb::tagreader::SongMetadata* pb) const {
|
|
|
|
const QByteArray url(d->url_.toEncoded());
|
|
|
|
|
|
|
|
pb->set_valid(d->valid_);
|
|
|
|
pb->set_title(DataCommaSizeFromQString(d->title_));
|
|
|
|
pb->set_album(DataCommaSizeFromQString(d->album_));
|
|
|
|
pb->set_artist(DataCommaSizeFromQString(d->artist_));
|
|
|
|
pb->set_albumartist(DataCommaSizeFromQString(d->albumartist_));
|
|
|
|
pb->set_composer(DataCommaSizeFromQString(d->composer_));
|
2013-03-03 13:00:24 +01:00
|
|
|
pb->set_performer(DataCommaSizeFromQString(d->performer_));
|
|
|
|
pb->set_grouping(DataCommaSizeFromQString(d->grouping_));
|
2012-01-02 18:21:07 +01:00
|
|
|
pb->set_track(d->track_);
|
|
|
|
pb->set_disc(d->disc_);
|
|
|
|
pb->set_bpm(d->bpm_);
|
|
|
|
pb->set_year(d->year_);
|
|
|
|
pb->set_genre(DataCommaSizeFromQString(d->genre_));
|
|
|
|
pb->set_comment(DataCommaSizeFromQString(d->comment_));
|
|
|
|
pb->set_compilation(d->compilation_);
|
|
|
|
pb->set_rating(d->rating_);
|
|
|
|
pb->set_playcount(d->playcount_);
|
|
|
|
pb->set_skipcount(d->skipcount_);
|
|
|
|
pb->set_lastplayed(d->lastplayed_);
|
|
|
|
pb->set_score(d->score_);
|
|
|
|
pb->set_length_nanosec(length_nanosec());
|
|
|
|
pb->set_bitrate(d->bitrate_);
|
|
|
|
pb->set_samplerate(d->samplerate_);
|
|
|
|
pb->set_url(url.constData(), url.size());
|
|
|
|
pb->set_basefilename(DataCommaSizeFromQString(d->basefilename_));
|
|
|
|
pb->set_mtime(d->mtime_);
|
|
|
|
pb->set_ctime(d->ctime_);
|
|
|
|
pb->set_filesize(d->filesize_);
|
|
|
|
pb->set_suspicious_tags(d->suspicious_tags_);
|
|
|
|
pb->set_art_automatic(DataCommaSizeFromQString(d->art_automatic_));
|
|
|
|
pb->set_type(static_cast< ::pb::tagreader::SongMetadata_Type>(d->filetype_));
|
2009-12-24 20:16:07 +01:00
|
|
|
}
|
|
|
|
|
2011-06-17 22:00:10 +02:00
|
|
|
void Song::InitFromQuery(const SqlRow& q, bool reliable_metadata, int col) {
|
2010-01-15 22:57:22 +01:00
|
|
|
d->valid_ = true;
|
2011-06-17 22:00:10 +02:00
|
|
|
d->init_from_file_ = reliable_metadata;
|
2010-10-12 13:55:45 +02:00
|
|
|
|
2011-02-13 19:34:30 +01:00
|
|
|
#define tostr(n) (q.value(n).isNull() ? QString::null : q.value(n).toString())
|
|
|
|
#define toint(n) (q.value(n).isNull() ? -1 : q.value(n).toInt())
|
|
|
|
#define tolonglong(n) (q.value(n).isNull() ? -1 : q.value(n).toLongLong())
|
|
|
|
#define tofloat(n) (q.value(n).isNull() ? -1 : q.value(n).toDouble())
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2010-05-10 16:19:43 +02:00
|
|
|
d->id_ = toint(col + 0);
|
|
|
|
d->title_ = tostr(col + 1);
|
|
|
|
d->album_ = tostr(col + 2);
|
|
|
|
d->artist_ = tostr(col + 3);
|
|
|
|
d->albumartist_ = tostr(col + 4);
|
|
|
|
d->composer_ = tostr(col + 5);
|
|
|
|
d->track_ = toint(col + 6);
|
|
|
|
d->disc_ = toint(col + 7);
|
|
|
|
d->bpm_ = tofloat(col + 8);
|
|
|
|
d->year_ = toint(col + 9);
|
|
|
|
d->genre_ = tostr(col + 10);
|
|
|
|
d->comment_ = tostr(col + 11);
|
|
|
|
d->compilation_ = q.value(col + 12).toBool();
|
|
|
|
|
2011-01-04 18:12:29 +01:00
|
|
|
d->bitrate_ = toint(col + 13);
|
|
|
|
d->samplerate_ = toint(col + 14);
|
2010-05-10 16:19:43 +02:00
|
|
|
|
2011-01-04 18:12:29 +01:00
|
|
|
d->directory_id_ = toint(col + 15);
|
2013-12-11 11:04:54 +01:00
|
|
|
set_url(QUrl::fromEncoded(tostr(col + 16).toUtf8()));
|
2011-04-28 14:27:53 +02:00
|
|
|
d->basefilename_ = QFileInfo(d->url_.toLocalFile()).fileName();
|
2011-01-04 18:12:29 +01:00
|
|
|
d->mtime_ = toint(col + 17);
|
|
|
|
d->ctime_ = toint(col + 18);
|
|
|
|
d->filesize_ = toint(col + 19);
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2011-01-04 18:12:29 +01:00
|
|
|
d->sampler_ = q.value(col + 20).toBool();
|
2010-02-27 21:12:22 +01:00
|
|
|
|
2011-01-04 18:12:29 +01:00
|
|
|
d->art_automatic_ = q.value(col + 21).toString();
|
|
|
|
d->art_manual_ = q.value(col + 22).toString();
|
2010-02-28 01:35:20 +01:00
|
|
|
|
2011-01-04 18:12:29 +01:00
|
|
|
d->filetype_ = FileType(q.value(col + 23).toInt());
|
|
|
|
d->playcount_ = q.value(col + 24).isNull() ? 0 : q.value(col + 24).toInt();
|
|
|
|
d->lastplayed_ = toint(col + 25);
|
|
|
|
d->rating_ = tofloat(col + 26);
|
2010-03-07 23:46:41 +01:00
|
|
|
|
2011-01-04 18:12:29 +01:00
|
|
|
d->forced_compilation_on_ = q.value(col + 27).toBool();
|
|
|
|
d->forced_compilation_off_ = q.value(col + 28).toBool();
|
2010-03-21 00:59:39 +01:00
|
|
|
|
2011-01-04 18:12:29 +01:00
|
|
|
// effective_compilation = 29
|
2010-03-21 22:17:01 +01:00
|
|
|
|
2011-01-04 18:12:29 +01:00
|
|
|
d->skipcount_ = q.value(col + 30).isNull() ? 0 : q.value(col + 30).toInt();
|
|
|
|
d->score_ = q.value(col + 31).isNull() ? 0 : q.value(col + 31).toInt();
|
2010-11-01 22:15:52 +01:00
|
|
|
|
2011-01-04 18:12:29 +01:00
|
|
|
// do not move those statements - beginning must be initialized before
|
|
|
|
// length is!
|
2011-02-13 19:34:30 +01:00
|
|
|
d->beginning_ = q.value(col + 32).isNull() ? 0 : q.value(col + 32).toLongLong();
|
|
|
|
set_length_nanosec(tolonglong(col + 33));
|
2010-12-28 16:36:01 +01:00
|
|
|
|
2011-01-15 19:46:23 +01:00
|
|
|
d->cue_path_ = tostr(col + 34);
|
2011-05-14 15:43:57 +02:00
|
|
|
d->unavailable_ = q.value(col + 35).toBool();
|
2011-01-15 19:46:23 +01:00
|
|
|
|
2011-11-28 06:58:27 +01:00
|
|
|
// effective_albumartist = 36
|
2013-03-03 13:00:24 +01:00
|
|
|
// etag = 37
|
|
|
|
|
|
|
|
d->performer_ = tostr(col + 38);
|
|
|
|
d->grouping_ = tostr(col + 39);
|
2011-11-28 06:58:27 +01:00
|
|
|
|
2013-12-31 15:21:50 +01:00
|
|
|
InitArtManual();
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
#undef tostr
|
|
|
|
#undef toint
|
2011-02-13 19:34:30 +01:00
|
|
|
#undef tolonglong
|
2009-12-24 20:16:07 +01:00
|
|
|
#undef tofloat
|
|
|
|
}
|
|
|
|
|
2011-04-16 16:04:15 +02:00
|
|
|
void Song::InitFromFilePartial(const QString& filename) {
|
2013-10-03 17:08:42 +02:00
|
|
|
set_url(QUrl::fromLocalFile(filename));
|
2011-04-16 16:04:15 +02:00
|
|
|
// We currently rely on filename suffix to know if it's a music file or not.
|
|
|
|
// TODO: I know this is not satisfying, but currently, we rely on TagLib
|
|
|
|
// which seems to have the behavior (filename checks). Someday, it would be
|
|
|
|
// nice to perform some magic tests everywhere.
|
|
|
|
QFileInfo info(filename);
|
|
|
|
d->basefilename_ = info.fileName();
|
|
|
|
QString suffix = info.suffix().toLower();
|
|
|
|
if (suffix == "mp3" || suffix == "ogg" || suffix == "flac" || suffix == "mpc"
|
|
|
|
|| suffix == "m4a" || suffix == "aac" || suffix == "wma" || suffix == "mp4"
|
2013-01-28 14:08:34 +01:00
|
|
|
|| suffix == "spx" || suffix == "wav" || suffix == "opus") {
|
2011-04-16 16:04:15 +02:00
|
|
|
d->valid_ = true;
|
|
|
|
} else {
|
|
|
|
d->valid_ = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-31 15:21:50 +01:00
|
|
|
void Song::InitArtManual() {
|
|
|
|
// If we don't have an art, check if we have one in the cache
|
|
|
|
if (d->art_manual_.isEmpty() && d->art_automatic_.isEmpty()) {
|
|
|
|
QString filename(Utilities::Sha1CoverHash(d->artist_, d->album_).toHex() + ".jpg");
|
|
|
|
QString path(AlbumCoverLoader::ImageCacheDir() + "/" + filename);
|
|
|
|
if (QFile::exists(path)) {
|
|
|
|
d->art_manual_ = path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-18 18:28:02 +01:00
|
|
|
#ifdef HAVE_LIBLASTFM
|
2009-12-26 23:15:57 +01:00
|
|
|
void Song::InitFromLastFM(const lastfm::Track& track) {
|
2010-01-15 22:57:22 +01:00
|
|
|
d->valid_ = true;
|
2010-03-07 23:46:41 +01:00
|
|
|
d->filetype_ = Type_Stream;
|
2009-12-26 23:15:57 +01:00
|
|
|
|
2010-01-15 22:57:22 +01:00
|
|
|
d->title_ = track.title();
|
|
|
|
d->album_ = track.album();
|
|
|
|
d->artist_ = track.artist();
|
|
|
|
d->track_ = track.trackNumber();
|
2010-12-23 22:13:43 +01:00
|
|
|
|
2011-02-14 20:34:37 +01:00
|
|
|
set_length_nanosec(track.duration() * kNsecPerSec);
|
2009-12-26 23:15:57 +01:00
|
|
|
}
|
2010-12-18 18:28:02 +01:00
|
|
|
#endif // HAVE_LIBLASTFM
|
2009-12-26 23:15:57 +01:00
|
|
|
|
2010-07-04 22:52:45 +02:00
|
|
|
#ifdef HAVE_LIBGPOD
|
2011-04-28 14:27:53 +02:00
|
|
|
void Song::InitFromItdb(const Itdb_Track* track, const QString& prefix) {
|
2010-07-04 22:52:45 +02:00
|
|
|
d->valid_ = true;
|
|
|
|
|
|
|
|
d->title_ = QString::fromUtf8(track->title);
|
|
|
|
d->album_ = QString::fromUtf8(track->album);
|
|
|
|
d->artist_ = QString::fromUtf8(track->artist);
|
|
|
|
d->albumartist_ = QString::fromUtf8(track->albumartist);
|
|
|
|
d->composer_ = QString::fromUtf8(track->composer);
|
2013-03-03 13:00:24 +01:00
|
|
|
d->grouping_ = QString::fromUtf8(track->grouping);
|
2010-07-04 22:52:45 +02:00
|
|
|
d->track_ = track->track_nr;
|
|
|
|
d->disc_ = track->cd_nr;
|
|
|
|
d->bpm_ = track->BPM;
|
|
|
|
d->year_ = track->year;
|
|
|
|
d->genre_ = QString::fromUtf8(track->genre);
|
|
|
|
d->comment_ = QString::fromUtf8(track->comment);
|
|
|
|
d->compilation_ = track->compilation;
|
2011-02-14 20:34:37 +01:00
|
|
|
set_length_nanosec(track->tracklen * kNsecPerMsec);
|
2010-07-04 22:52:45 +02:00
|
|
|
d->bitrate_ = track->bitrate;
|
|
|
|
d->samplerate_ = track->samplerate;
|
|
|
|
d->mtime_ = track->time_modified;
|
|
|
|
d->ctime_ = track->time_added;
|
|
|
|
d->filesize_ = track->size;
|
|
|
|
d->filetype_ = track->type2 ? Type_Mpeg : Type_Mp4;
|
2010-10-17 18:03:49 +02:00
|
|
|
d->rating_ = float(track->rating) / 100; // 100 = 20 * 5 stars
|
|
|
|
d->playcount_ = track->playcount;
|
2010-10-17 19:50:20 +02:00
|
|
|
d->skipcount_ = track->skipcount;
|
|
|
|
d->lastplayed_ = track->time_played;
|
2010-07-04 22:52:45 +02:00
|
|
|
|
2011-04-28 14:27:53 +02:00
|
|
|
QString filename = QString::fromLocal8Bit(track->ipod_path);
|
|
|
|
filename.replace(':', '/');
|
|
|
|
|
2012-01-04 23:10:41 +01:00
|
|
|
if (prefix.contains("://")) {
|
2013-10-03 17:08:42 +02:00
|
|
|
set_url(QUrl(prefix + filename));
|
2012-01-04 23:10:41 +01:00
|
|
|
} else {
|
2013-10-03 17:08:42 +02:00
|
|
|
set_url(QUrl::fromLocalFile(prefix + filename));
|
2012-01-04 23:10:41 +01:00
|
|
|
}
|
|
|
|
|
2011-04-28 14:27:53 +02:00
|
|
|
d->basefilename_ = QFileInfo(filename).fileName();
|
2010-07-04 22:52:45 +02:00
|
|
|
}
|
2010-07-24 18:58:14 +02:00
|
|
|
|
|
|
|
void Song::ToItdb(Itdb_Track *track) const {
|
2010-08-08 19:45:57 +02:00
|
|
|
track->title = strdup(d->title_.toUtf8().constData());
|
|
|
|
track->album = strdup(d->album_.toUtf8().constData());
|
|
|
|
track->artist = strdup(d->artist_.toUtf8().constData());
|
|
|
|
track->albumartist = strdup(d->albumartist_.toUtf8().constData());
|
|
|
|
track->composer = strdup(d->composer_.toUtf8().constData());
|
2013-03-03 13:00:24 +01:00
|
|
|
track->grouping = strdup(d->grouping_.toUtf8().constData());
|
2010-07-24 18:58:14 +02:00
|
|
|
track->track_nr = d->track_;
|
|
|
|
track->cd_nr = d->disc_;
|
|
|
|
track->BPM = d->bpm_;
|
|
|
|
track->year = d->year_;
|
2010-08-08 19:45:57 +02:00
|
|
|
track->genre = strdup(d->genre_.toUtf8().constData());
|
|
|
|
track->comment = strdup(d->comment_.toUtf8().constData());
|
2010-07-24 18:58:14 +02:00
|
|
|
track->compilation = d->compilation_;
|
2011-02-14 20:34:37 +01:00
|
|
|
track->tracklen = length_nanosec() / kNsecPerMsec;
|
2010-07-24 18:58:14 +02:00
|
|
|
track->bitrate = d->bitrate_;
|
|
|
|
track->samplerate = d->samplerate_;
|
|
|
|
track->time_modified = d->mtime_;
|
|
|
|
track->time_added = d->ctime_;
|
|
|
|
track->size = d->filesize_;
|
2010-08-08 19:41:06 +02:00
|
|
|
track->type1 = 0;
|
2010-07-24 18:58:14 +02:00
|
|
|
track->type2 = d->filetype_ == Type_Mp4 ? 0 : 1;
|
2010-08-08 19:41:06 +02:00
|
|
|
track->mediatype = 1; // Audio
|
2010-10-17 18:03:49 +02:00
|
|
|
track->rating = d->rating_ * 100; // 100 = 20 * 5 stars
|
|
|
|
track->playcount = d->playcount_;
|
2010-10-17 19:50:20 +02:00
|
|
|
track->skipcount = d->skipcount_;
|
|
|
|
track->time_played = d->lastplayed_;
|
2010-07-24 18:58:14 +02:00
|
|
|
}
|
2010-07-04 22:52:45 +02:00
|
|
|
#endif
|
|
|
|
|
2010-08-14 17:57:05 +02:00
|
|
|
#ifdef HAVE_LIBMTP
|
2011-04-28 14:27:53 +02:00
|
|
|
void Song::InitFromMTP(const LIBMTP_track_t* track, const QString& host) {
|
2010-08-14 17:57:05 +02:00
|
|
|
d->valid_ = true;
|
|
|
|
|
|
|
|
d->title_ = QString::fromUtf8(track->title);
|
|
|
|
d->artist_ = QString::fromUtf8(track->artist);
|
|
|
|
d->album_ = QString::fromUtf8(track->album);
|
|
|
|
d->composer_ = QString::fromUtf8(track->composer);
|
|
|
|
d->genre_ = QString::fromUtf8(track->genre);
|
2011-04-28 14:27:53 +02:00
|
|
|
d->url_ = QUrl(QString("mtp://%1/%2").arg(host, track->item_id));
|
|
|
|
d->basefilename_ = QString::number(track->item_id);
|
2010-08-14 17:57:05 +02:00
|
|
|
|
|
|
|
d->track_ = track->tracknumber;
|
2011-02-14 20:34:37 +01:00
|
|
|
set_length_nanosec(track->duration * kNsecPerMsec);
|
2010-08-14 17:57:05 +02:00
|
|
|
d->samplerate_ = track->samplerate;
|
|
|
|
d->bitrate_ = track->bitrate;
|
|
|
|
d->filesize_ = track->filesize;
|
|
|
|
d->mtime_ = track->modificationdate;
|
|
|
|
d->ctime_ = track->modificationdate;
|
|
|
|
|
2010-10-17 18:03:49 +02:00
|
|
|
d->rating_ = float(track->rating) / 100;
|
|
|
|
d->playcount_ = track->usecount;
|
|
|
|
|
2010-08-14 17:57:05 +02:00
|
|
|
switch (track->filetype) {
|
|
|
|
case LIBMTP_FILETYPE_WAV: d->filetype_ = Type_Wav; break;
|
|
|
|
case LIBMTP_FILETYPE_MP3: d->filetype_ = Type_Mpeg; break;
|
|
|
|
case LIBMTP_FILETYPE_WMA: d->filetype_ = Type_Asf; break;
|
|
|
|
case LIBMTP_FILETYPE_OGG: d->filetype_ = Type_OggVorbis; break;
|
|
|
|
case LIBMTP_FILETYPE_MP4: d->filetype_ = Type_Mp4; break;
|
|
|
|
case LIBMTP_FILETYPE_AAC: d->filetype_ = Type_Mp4; break;
|
|
|
|
case LIBMTP_FILETYPE_FLAC: d->filetype_ = Type_OggFlac; break;
|
|
|
|
case LIBMTP_FILETYPE_MP2: d->filetype_ = Type_Mpeg; break;
|
|
|
|
case LIBMTP_FILETYPE_M4A: d->filetype_ = Type_Mp4; break;
|
|
|
|
default: d->filetype_ = Type_Unknown; break;
|
|
|
|
}
|
|
|
|
}
|
2010-08-14 18:39:45 +02:00
|
|
|
|
|
|
|
void Song::ToMTP(LIBMTP_track_t* track) const {
|
|
|
|
track->item_id = 0;
|
|
|
|
track->parent_id = 0;
|
|
|
|
track->storage_id = 0;
|
|
|
|
|
|
|
|
track->title = strdup(d->title_.toUtf8().constData());
|
|
|
|
track->artist = strdup(d->artist_.toUtf8().constData());
|
|
|
|
track->album = strdup(d->album_.toUtf8().constData());
|
|
|
|
track->composer = strdup(d->composer_.toUtf8().constData());
|
|
|
|
track->genre = strdup(d->genre_.toUtf8().constData());
|
|
|
|
track->title = strdup(d->title_.toUtf8().constData());
|
|
|
|
track->date = NULL;
|
|
|
|
|
2010-08-22 19:54:49 +02:00
|
|
|
track->filename = strdup(d->basefilename_.toUtf8().constData());
|
|
|
|
|
2010-08-14 18:39:45 +02:00
|
|
|
track->tracknumber = d->track_;
|
2011-02-14 20:34:37 +01:00
|
|
|
track->duration = length_nanosec() / kNsecPerMsec;
|
2010-08-14 18:39:45 +02:00
|
|
|
track->samplerate = d->samplerate_;
|
|
|
|
track->nochannels = 0;
|
|
|
|
track->wavecodec = 0;
|
|
|
|
track->bitrate = d->bitrate_;
|
|
|
|
track->bitratetype = 0;
|
2010-10-17 18:03:49 +02:00
|
|
|
track->rating = d->rating_ * 100;
|
|
|
|
track->usecount = d->playcount_;
|
2010-08-14 18:39:45 +02:00
|
|
|
track->filesize = d->filesize_;
|
|
|
|
track->modificationdate = d->mtime_;
|
|
|
|
|
|
|
|
switch (d->filetype_) {
|
|
|
|
case Type_Asf: track->filetype = LIBMTP_FILETYPE_ASF; break;
|
|
|
|
case Type_Mp4: track->filetype = LIBMTP_FILETYPE_MP4; break;
|
|
|
|
case Type_Mpeg: track->filetype = LIBMTP_FILETYPE_MP3; break;
|
|
|
|
case Type_Flac:
|
|
|
|
case Type_OggFlac: track->filetype = LIBMTP_FILETYPE_FLAC; break;
|
|
|
|
case Type_OggSpeex:
|
|
|
|
case Type_OggVorbis: track->filetype = LIBMTP_FILETYPE_OGG; break;
|
|
|
|
case Type_Wav: track->filetype = LIBMTP_FILETYPE_WAV; break;
|
|
|
|
default: track->filetype = LIBMTP_FILETYPE_UNDEF_AUDIO; break;
|
|
|
|
}
|
|
|
|
}
|
2010-08-14 17:57:05 +02:00
|
|
|
#endif
|
|
|
|
|
2010-04-21 16:04:40 +02:00
|
|
|
void Song::MergeFromSimpleMetaBundle(const Engine::SimpleMetaBundle &bundle) {
|
2012-12-25 14:26:48 +01:00
|
|
|
if (d->init_from_file_ || d->url_.scheme() == "file") {
|
|
|
|
// This Song was already loaded using taglib. Our tags are probably better
|
|
|
|
// than the engine's. Note: init_from_file_ is used for non-file:// URLs
|
|
|
|
// when the metadata is known to be good, like from Jamendo.
|
2010-10-12 13:55:45 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-03-10 19:01:35 +01:00
|
|
|
d->valid_ = true;
|
2012-11-29 13:41:20 +01:00
|
|
|
if (!bundle.title.isEmpty()) d->title_ = bundle.title;
|
|
|
|
if (!bundle.artist.isEmpty()) d->artist_ = bundle.artist;
|
|
|
|
if (!bundle.album.isEmpty()) d->album_ = bundle.album;
|
|
|
|
if (!bundle.comment.isEmpty()) d->comment_ = bundle.comment;
|
|
|
|
if (!bundle.genre.isEmpty()) d->genre_ = bundle.genre;
|
2010-04-21 16:04:40 +02:00
|
|
|
if (!bundle.bitrate.isEmpty()) d->bitrate_ = bundle.bitrate.toInt();
|
|
|
|
if (!bundle.samplerate.isEmpty()) d->samplerate_ = bundle.samplerate.toInt();
|
2011-02-13 19:34:30 +01:00
|
|
|
if (!bundle.length.isEmpty()) set_length_nanosec(bundle.length.toLongLong());
|
2010-04-21 16:04:40 +02:00
|
|
|
if (!bundle.year.isEmpty()) d->year_ = bundle.year.toInt();
|
|
|
|
if (!bundle.tracknr.isEmpty()) d->track_ = bundle.tracknr.toInt();
|
2010-02-03 23:20:31 +01:00
|
|
|
}
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
void Song::BindToQuery(QSqlQuery *query) const {
|
2010-07-24 17:13:09 +02:00
|
|
|
#define strval(x) (x.isNull() ? "" : x)
|
|
|
|
#define intval(x) (x <= 0 ? -1 : x)
|
2010-06-18 02:11:15 +02:00
|
|
|
#define notnullintval(x) (x == -1 ? QVariant() : x)
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2010-02-28 01:35:20 +01:00
|
|
|
// Remember to bind these in the same order as kBindSpec
|
|
|
|
|
2010-07-24 17:13:09 +02:00
|
|
|
query->bindValue(":title", strval(d->title_));
|
|
|
|
query->bindValue(":album", strval(d->album_));
|
|
|
|
query->bindValue(":artist", strval(d->artist_));
|
|
|
|
query->bindValue(":albumartist", strval(d->albumartist_));
|
|
|
|
query->bindValue(":composer", strval(d->composer_));
|
2010-01-15 22:57:22 +01:00
|
|
|
query->bindValue(":track", intval(d->track_));
|
|
|
|
query->bindValue(":disc", intval(d->disc_));
|
|
|
|
query->bindValue(":bpm", intval(d->bpm_));
|
|
|
|
query->bindValue(":year", intval(d->year_));
|
2010-07-24 17:13:09 +02:00
|
|
|
query->bindValue(":genre", strval(d->genre_));
|
|
|
|
query->bindValue(":comment", strval(d->comment_));
|
2010-01-15 22:57:22 +01:00
|
|
|
query->bindValue(":compilation", d->compilation_ ? 1 : 0);
|
|
|
|
|
|
|
|
query->bindValue(":bitrate", intval(d->bitrate_));
|
|
|
|
query->bindValue(":samplerate", intval(d->samplerate_));
|
|
|
|
|
2010-11-23 18:38:39 +01:00
|
|
|
query->bindValue(":directory", notnullintval(d->directory_id_));
|
2013-10-03 17:08:42 +02:00
|
|
|
|
|
|
|
if (Application::kIsPortable
|
|
|
|
&& Utilities::UrlOnSameDriveAsClementine(d->url_)) {
|
|
|
|
query->bindValue(":filename", Utilities::GetRelativePathToClementineBin(d->url_));
|
|
|
|
} else {
|
2014-01-20 11:39:18 +01:00
|
|
|
query->bindValue(":filename", d->url_.toEncoded());
|
2013-10-03 17:08:42 +02:00
|
|
|
}
|
|
|
|
|
2010-06-18 02:11:15 +02:00
|
|
|
query->bindValue(":mtime", notnullintval(d->mtime_));
|
|
|
|
query->bindValue(":ctime", notnullintval(d->ctime_));
|
|
|
|
query->bindValue(":filesize", notnullintval(d->filesize_));
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2010-02-27 21:12:22 +01:00
|
|
|
query->bindValue(":sampler", d->sampler_ ? 1 : 0);
|
2010-02-28 01:35:20 +01:00
|
|
|
query->bindValue(":art_automatic", d->art_automatic_);
|
|
|
|
query->bindValue(":art_manual", d->art_manual_);
|
2010-02-27 21:12:22 +01:00
|
|
|
|
2010-03-07 23:46:41 +01:00
|
|
|
query->bindValue(":filetype", d->filetype_);
|
2010-10-17 18:03:49 +02:00
|
|
|
query->bindValue(":playcount", d->playcount_);
|
2010-10-17 19:50:20 +02:00
|
|
|
query->bindValue(":lastplayed", intval(d->lastplayed_));
|
2010-10-17 18:03:49 +02:00
|
|
|
query->bindValue(":rating", intval(d->rating_));
|
2010-03-07 23:46:41 +01:00
|
|
|
|
2010-03-21 14:50:00 +01:00
|
|
|
query->bindValue(":forced_compilation_on", d->forced_compilation_on_ ? 1 : 0);
|
|
|
|
query->bindValue(":forced_compilation_off", d->forced_compilation_off_ ? 1 : 0);
|
2010-03-21 00:59:39 +01:00
|
|
|
|
2010-03-21 22:17:01 +01:00
|
|
|
query->bindValue(":effective_compilation", is_compilation() ? 1 : 0);
|
|
|
|
|
2010-10-17 19:50:20 +02:00
|
|
|
query->bindValue(":skipcount", d->skipcount_);
|
2010-11-01 22:15:52 +01:00
|
|
|
query->bindValue(":score", d->score_);
|
|
|
|
|
2010-12-28 16:36:01 +01:00
|
|
|
query->bindValue(":beginning", d->beginning_);
|
2011-02-13 19:34:30 +01:00
|
|
|
query->bindValue(":length", intval(length_nanosec()));
|
2010-12-28 16:36:01 +01:00
|
|
|
|
2011-01-15 19:46:23 +01:00
|
|
|
query->bindValue(":cue_path", d->cue_path_);
|
2011-05-14 15:43:57 +02:00
|
|
|
query->bindValue(":unavailable", d->unavailable_ ? 1 : 0);
|
2011-11-28 06:58:27 +01:00
|
|
|
query->bindValue(":effective_albumartist", this->effective_albumartist());
|
2011-01-15 19:46:23 +01:00
|
|
|
|
2012-07-27 16:04:12 +02:00
|
|
|
query->bindValue(":etag", strval(d->etag_));
|
|
|
|
|
2013-03-03 13:00:24 +01:00
|
|
|
query->bindValue(":performer", strval(d->performer_));
|
|
|
|
query->bindValue(":grouping", strval(d->grouping_));
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
#undef intval
|
2010-06-18 02:11:15 +02:00
|
|
|
#undef notnullintval
|
2012-07-27 16:04:12 +02:00
|
|
|
#undef strval
|
2009-12-24 20:16:07 +01:00
|
|
|
}
|
|
|
|
|
2010-06-20 18:30:10 +02:00
|
|
|
void Song::BindToFtsQuery(QSqlQuery *query) const {
|
|
|
|
query->bindValue(":ftstitle", d->title_);
|
|
|
|
query->bindValue(":ftsalbum", d->album_);
|
|
|
|
query->bindValue(":ftsartist", d->artist_);
|
|
|
|
query->bindValue(":ftsalbumartist", d->albumartist_);
|
|
|
|
query->bindValue(":ftscomposer", d->composer_);
|
2013-03-03 13:00:24 +01:00
|
|
|
query->bindValue(":ftsperformer", d->performer_);
|
|
|
|
query->bindValue(":ftsgrouping", d->grouping_);
|
2010-06-20 18:30:10 +02:00
|
|
|
query->bindValue(":ftsgenre", d->genre_);
|
|
|
|
query->bindValue(":ftscomment", d->comment_);
|
|
|
|
}
|
|
|
|
|
2010-12-18 18:28:02 +01:00
|
|
|
#ifdef HAVE_LIBLASTFM
|
2012-05-13 17:04:55 +02:00
|
|
|
void Song::ToLastFM(lastfm::Track* track, bool prefer_album_artist) const {
|
2009-12-29 20:22:02 +01:00
|
|
|
lastfm::MutableTrack mtrack(*track);
|
|
|
|
|
2012-05-13 17:04:55 +02:00
|
|
|
if (prefer_album_artist && !d->albumartist_.isEmpty()) {
|
|
|
|
mtrack.setArtist(d->albumartist_);
|
|
|
|
} else {
|
|
|
|
mtrack.setArtist(d->artist_);
|
|
|
|
}
|
2010-01-15 22:57:22 +01:00
|
|
|
mtrack.setAlbum(d->album_);
|
|
|
|
mtrack.setTitle(d->title_);
|
2011-02-14 20:34:37 +01:00
|
|
|
mtrack.setDuration(length_nanosec() / kNsecPerSec);
|
2010-01-15 22:57:22 +01:00
|
|
|
mtrack.setTrackNumber(d->track_);
|
2011-04-16 17:13:53 +02:00
|
|
|
|
|
|
|
if (d->filetype_ == Type_Stream && d->end_ == -1) {
|
|
|
|
mtrack.setSource(lastfm::Track::NonPersonalisedBroadcast);
|
|
|
|
} else {
|
|
|
|
mtrack.setSource(lastfm::Track::Player);
|
|
|
|
}
|
2009-12-29 20:22:02 +01:00
|
|
|
}
|
2010-12-18 18:28:02 +01:00
|
|
|
#endif // HAVE_LIBLASTFM
|
2009-12-29 20:22:02 +01:00
|
|
|
|
2013-02-26 15:49:30 +01:00
|
|
|
QString Song::PrettyRating() const {
|
|
|
|
float rating = d->rating_;
|
|
|
|
|
|
|
|
if (rating == -1.0f)
|
|
|
|
return "0";
|
|
|
|
|
|
|
|
return QString::number(static_cast<int>(rating * 100));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-21 22:36:27 +01:00
|
|
|
QString Song::PrettyTitle() const {
|
2010-01-15 22:57:22 +01:00
|
|
|
QString title(d->title_);
|
2009-12-24 20:16:07 +01:00
|
|
|
|
|
|
|
if (title.isEmpty())
|
2010-12-18 21:40:35 +01:00
|
|
|
title = d->basefilename_;
|
2011-06-17 21:32:03 +02:00
|
|
|
if (title.isEmpty())
|
|
|
|
title = d->url_.toString();
|
2009-12-24 20:16:07 +01:00
|
|
|
|
|
|
|
return title;
|
|
|
|
}
|
|
|
|
|
2010-11-21 22:36:27 +01:00
|
|
|
QString Song::PrettyTitleWithArtist() const {
|
2010-01-15 22:57:22 +01:00
|
|
|
QString title(d->title_);
|
2009-12-24 20:16:07 +01:00
|
|
|
|
|
|
|
if (title.isEmpty())
|
2010-12-18 21:40:35 +01:00
|
|
|
title = d->basefilename_;
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2010-11-21 22:36:27 +01:00
|
|
|
if (!d->artist_.isEmpty())
|
|
|
|
title = d->artist_ + " - " + title;
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
return title;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Song::PrettyLength() const {
|
2011-02-13 19:34:30 +01:00
|
|
|
if (length_nanosec() == -1)
|
2009-12-24 20:16:07 +01:00
|
|
|
return QString::null;
|
|
|
|
|
2011-02-13 19:34:30 +01:00
|
|
|
return Utilities::PrettyTimeNanosec(length_nanosec());
|
2009-12-24 20:16:07 +01:00
|
|
|
}
|
|
|
|
|
2010-12-06 00:41:41 +01:00
|
|
|
QString Song::PrettyYear() const {
|
|
|
|
if (d->year_ == -1)
|
|
|
|
return QString::null;
|
|
|
|
|
|
|
|
return QString::number(d->year_);
|
|
|
|
}
|
|
|
|
|
2010-11-21 22:36:27 +01:00
|
|
|
QString Song::TitleWithCompilationArtist() const {
|
|
|
|
QString title(d->title_);
|
|
|
|
|
|
|
|
if (title.isEmpty())
|
2010-12-18 21:40:35 +01:00
|
|
|
title = d->basefilename_;
|
2010-11-21 22:36:27 +01:00
|
|
|
|
|
|
|
if (is_compilation() && !d->artist_.isEmpty() && !d->artist_.toLower().contains("various"))
|
|
|
|
title = d->artist_ + " - " + title;
|
|
|
|
|
|
|
|
return title;
|
|
|
|
}
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
bool Song::IsMetadataEqual(const Song& other) const {
|
2010-01-15 22:57:22 +01:00
|
|
|
return d->title_ == other.d->title_ &&
|
|
|
|
d->album_ == other.d->album_ &&
|
|
|
|
d->artist_ == other.d->artist_ &&
|
|
|
|
d->albumartist_ == other.d->albumartist_ &&
|
|
|
|
d->composer_ == other.d->composer_ &&
|
2013-03-03 13:00:24 +01:00
|
|
|
d->performer_ == other.d->performer_ &&
|
|
|
|
d->grouping_ == other.d->grouping_ &&
|
2010-01-15 22:57:22 +01:00
|
|
|
d->track_ == other.d->track_ &&
|
|
|
|
d->disc_ == other.d->disc_ &&
|
|
|
|
qFuzzyCompare(d->bpm_, other.d->bpm_) &&
|
|
|
|
d->year_ == other.d->year_ &&
|
|
|
|
d->genre_ == other.d->genre_ &&
|
|
|
|
d->comment_ == other.d->comment_ &&
|
|
|
|
d->compilation_ == other.d->compilation_ &&
|
2010-12-28 16:36:01 +01:00
|
|
|
d->beginning_ == other.d->beginning_ &&
|
2011-02-13 19:34:30 +01:00
|
|
|
length_nanosec() == other.length_nanosec() &&
|
2010-01-15 22:57:22 +01:00
|
|
|
d->bitrate_ == other.d->bitrate_ &&
|
2010-02-28 01:35:20 +01:00
|
|
|
d->samplerate_ == other.d->samplerate_ &&
|
|
|
|
d->art_automatic_ == other.d->art_automatic_ &&
|
2011-01-15 19:46:23 +01:00
|
|
|
d->art_manual_ == other.d->art_manual_ &&
|
|
|
|
d->cue_path_ == other.d->cue_path_;
|
2009-12-24 20:16:07 +01:00
|
|
|
}
|
2010-01-16 17:12:47 +01:00
|
|
|
|
2010-06-25 01:36:39 +02:00
|
|
|
bool Song::IsEditable() const {
|
2011-04-28 14:27:53 +02:00
|
|
|
return d->valid_ && !d->url_.isEmpty() && !is_stream() &&
|
2011-03-20 13:43:10 +01:00
|
|
|
d->filetype_ != Type_Unknown && !has_cue();
|
2010-06-25 01:36:39 +02:00
|
|
|
}
|
|
|
|
|
2011-01-17 00:46:58 +01:00
|
|
|
bool Song::operator==(const Song& other) const {
|
|
|
|
// TODO: this isn't working for radios
|
2011-04-28 14:27:53 +02:00
|
|
|
return url() == other.url() &&
|
2011-02-13 19:34:30 +01:00
|
|
|
beginning_nanosec() == other.beginning_nanosec();
|
2011-01-17 00:46:58 +01:00
|
|
|
}
|
2011-01-24 21:06:59 +01:00
|
|
|
|
2011-07-01 22:48:18 +02:00
|
|
|
uint qHash(const Song& song) {
|
|
|
|
// Should compare the same fields as operator==
|
|
|
|
return qHash(song.url().toString()) ^ qHash(song.beginning_nanosec());
|
|
|
|
}
|
|
|
|
|
2012-11-22 02:06:29 +01:00
|
|
|
bool Song::IsSimilar(const Song& other) const {
|
|
|
|
return title().compare(other.title(), Qt::CaseInsensitive) == 0 &&
|
|
|
|
artist().compare(other.artist(), Qt::CaseInsensitive) == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint HashSimilar(const Song& song) {
|
|
|
|
// Should compare the same fields as function IsSimilar
|
|
|
|
return qHash(song.title().toLower()) ^ qHash(song.artist().toLower());
|
|
|
|
}
|
|
|
|
|
2011-03-13 19:37:46 +01:00
|
|
|
bool Song::IsOnSameAlbum(const Song& other) const {
|
|
|
|
if (is_compilation() != other.is_compilation())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (has_cue() && other.has_cue() && cue_path() == other.cue_path())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (is_compilation() && album() == other.album())
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return album() == other.album() && artist() == other.artist();
|
|
|
|
}
|
2011-10-16 22:57:53 +02:00
|
|
|
|
2011-11-27 16:01:10 +01:00
|
|
|
QString Song::AlbumKey() const {
|
|
|
|
return QString("%1|%2|%3").arg(
|
|
|
|
is_compilation() ? "_compilation" : artist(),
|
|
|
|
has_cue() ? cue_path() : "",
|
|
|
|
album());
|
|
|
|
}
|
|
|
|
|
2011-10-16 22:57:53 +02:00
|
|
|
void Song::ToXesam(QVariantMap* map) const {
|
|
|
|
using mpris::AddMetadata;
|
|
|
|
using mpris::AddMetadataAsList;
|
|
|
|
using mpris::AsMPRISDateTimeType;
|
|
|
|
|
|
|
|
AddMetadata("xesam:url", url().toString(), map);
|
|
|
|
AddMetadata("xesam:title", PrettyTitle(), map);
|
|
|
|
AddMetadataAsList("xesam:artist", artist(), map);
|
|
|
|
AddMetadata("xesam:album", album(), map);
|
|
|
|
AddMetadataAsList("xesam:albumArtist", albumartist(), map);
|
|
|
|
AddMetadata("mpris:length", length_nanosec() / kNsecPerUsec, map);
|
|
|
|
AddMetadata("xesam:trackNumber", track(), map);
|
|
|
|
AddMetadataAsList("xesam:genre", genre(), map);
|
|
|
|
AddMetadata("xesam:discNumber", disc(), map);
|
|
|
|
AddMetadataAsList("xesam:comment", comment(), map);
|
|
|
|
AddMetadata("xesam:contentCreated", AsMPRISDateTimeType(ctime()), map);
|
|
|
|
AddMetadata("xesam:lastUsed", AsMPRISDateTimeType(lastplayed()), map);
|
2012-10-15 11:40:18 +02:00
|
|
|
AddMetadata("xesam:audioBPM", static_cast<int>(bpm()), map);
|
2011-10-16 22:57:53 +02:00
|
|
|
AddMetadataAsList("xesam:composer", composer(), map);
|
|
|
|
AddMetadata("xesam:useCount", playcount(), map);
|
|
|
|
AddMetadata("xesam:autoRating", score(), map);
|
|
|
|
if (rating() != -1.0) {
|
|
|
|
AddMetadata("xesam:userRating", rating(), map);
|
|
|
|
}
|
|
|
|
}
|
2012-12-25 14:48:16 +01:00
|
|
|
|
|
|
|
void Song::MergeUserSetData(const Song& other) {
|
|
|
|
set_playcount(other.playcount());
|
|
|
|
set_skipcount(other.skipcount());
|
|
|
|
set_lastplayed(other.lastplayed());
|
|
|
|
set_rating(other.rating());
|
|
|
|
set_score(other.score());
|
|
|
|
set_art_manual(other.art_manual());
|
|
|
|
}
|