1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 03:09:57 +01:00

Slightly hacky support for AAC on Google Drive.

This commit is contained in:
John Maguire 2012-07-31 17:57:17 +02:00
parent fc61f0627f
commit 94878b4bd2
2 changed files with 14 additions and 2 deletions

View File

@ -623,11 +623,16 @@ bool TagReaderWorker::ReadGoogleDrive(const QUrl& download_url,
download_url, title, size, access_token, network_);
stream->Precache();
scoped_ptr<TagLib::File> tag;
if (mime_type == "audio/mpeg") {
if (mime_type == "audio/mpeg" && title.endsWith(".mp3")) {
tag.reset(new TagLib::MPEG::File(
stream, // Takes ownership.
TagLib::ID3v2::FrameFactory::instance(),
TagLib::AudioProperties::Accurate));
} else if (mime_type == "audio/mpeg" && title.endsWith(".m4a")) {
tag.reset(new TagLib::MP4::File(
stream,
true,
TagLib::AudioProperties::Accurate));
} else if (mime_type == "application/ogg") {
tag.reset(new TagLib::Ogg::Vorbis::File(
stream,
@ -657,6 +662,13 @@ bool TagReaderWorker::ReadGoogleDrive(const QUrl& download_url,
song->set_album(tag->tag()->album().toCString(true));
song->set_filesize(size);
if (tag->tag()->track() != 0) {
song->set_track(tag->tag()->track());
}
if (tag->tag()->year() != 0) {
song->set_year(tag->tag()->year());
}
song->set_type(pb::tagreader::SongMetadata_Type_STREAM);
if (tag->audioProperties()) {

View File

@ -103,7 +103,7 @@ void GoogleDriveService::ConnectFinished(google_drive::ConnectResponse* response
s.setValue("refresh_token", response->refresh_token());
// Find any music files
ListFilesForMimeType("audio/mpeg"); // MP3
ListFilesForMimeType("audio/mpeg"); // MP3/AAC
ListFilesForMimeType("application/ogg"); // OGG
ListFilesForMimeType("application/x-flac"); // FLAC
}