mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2024-12-22 21:48:03 +01:00
Save album cover to gpod devices
This commit is contained in:
parent
85eba24167
commit
4990f44b10
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
#include "core/tagreaderclient.h"
|
||||||
#include "collection/collectionbackend.h"
|
#include "collection/collectionbackend.h"
|
||||||
#include "collection/collectionmodel.h"
|
#include "collection/collectionmodel.h"
|
||||||
#include "connecteddevice.h"
|
#include "connecteddevice.h"
|
||||||
@ -146,6 +147,28 @@ bool GPodDevice::CopyToStorage(const CopyJob &job) {
|
|||||||
|
|
||||||
Itdb_Track *track = AddTrackToITunesDb(job.metadata_);
|
Itdb_Track *track = AddTrackToITunesDb(job.metadata_);
|
||||||
|
|
||||||
|
bool result(false);
|
||||||
|
if (!job.metadata_.image().isNull()) {
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||||
|
result = itdb_track_set_thumbnails_from_data(track, job.metadata_.image().constBits(), job.metadata_.image().sizeInBytes());
|
||||||
|
#else
|
||||||
|
result = itdb_track_set_thumbnails_from_data(track, job.metadata_.image().constBits(), job.metadata_.image().byteCount());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (!job.metadata_.art_manual().isEmpty()) {
|
||||||
|
result = itdb_track_set_thumbnails(track, QDir::toNativeSeparators(job.metadata_.art_manual()).toLocal8Bit().constData());
|
||||||
|
}
|
||||||
|
else if (!job.metadata_.art_automatic().isEmpty()) {
|
||||||
|
result = itdb_track_set_thumbnails(track, QDir::toNativeSeparators(job.metadata_.art_automatic()).toLocal8Bit().constData());
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
track->has_artwork = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
track->has_artwork = 0;
|
||||||
|
qLog(Error) << "failed to set album cover image";
|
||||||
|
}
|
||||||
|
|
||||||
// Copy the file
|
// Copy the file
|
||||||
GError *error = nullptr;
|
GError *error = nullptr;
|
||||||
itdb_cp_track_to_ipod(track, QDir::toNativeSeparators(job.source_).toLocal8Bit().constData(), &error);
|
itdb_cp_track_to_ipod(track, QDir::toNativeSeparators(job.source_).toLocal8Bit().constData(), &error);
|
||||||
|
Loading…
Reference in New Issue
Block a user