Skip to content

Commit

Permalink
Update for tablib 2.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
fenuks committed Jan 29, 2024
1 parent e2a8aa4 commit 45bac9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Expand Up @@ -139,7 +139,7 @@ endif ()

if (ENABLE_TAGLIB)
if (NOT TAGLIB_FOUND)
set(TAGLIB_MIN_VERSION "1.6")
set(TAGLIB_MIN_VERSION "2.0")
find_package(Taglib)
endif()
macro_log_feature(TAGLIB_FOUND "TagLib" "Tag editor, file organiser, etc." "http://taglib.github.io/")
Expand Down Expand Up @@ -186,6 +186,7 @@ if (TAGLIB_FOUND)
macro_log_feature(MTP_FOUND "libmtp" "MTP Device Support." "http://libmtp.sourceforge.net")
endif ()
else (TAGLIB_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable -Wno-unused-parameter")
set(ENABLE_DEVICES_SUPPORT OFF)
endif ()

Expand Down
8 changes: 4 additions & 4 deletions tags/tags.cpp
Expand Up @@ -619,7 +619,7 @@ static void readAPETags(TagLib::APE::Tag *tag, Song *song, ReplayGain *rg, QImag
if (map.contains("COVER ART (FRONT)")) {
const TagLib::ByteVector nullStringTerminator(1, 0);

TagLib::ByteVector item = map["COVER ART (FRONT)"].value();
TagLib::ByteVector item = map["COVER ART (FRONT)"].binaryData();
int pos = item.find(nullStringTerminator); // Skip the filename

if (++pos > 0) {
Expand Down Expand Up @@ -1301,7 +1301,7 @@ static void readTags(const TagLib::FileRef fileref, Song *song, ReplayGain *rg,
}
} else if (TagLib::RIFF::WAV::File *file = dynamic_cast< TagLib::RIFF::WAV::File * >(fileref.file())) {
if (file->tag()) {
readID3v2Tags(file->tag(), song, rg, img, lyrics, rating);
readID3v2Tags(file->ID3v2Tag(), song, rg, img, lyrics, rating);
}
#ifdef TAGLIB_ASF_FOUND
} else if (TagLib::ASF::File *file = dynamic_cast< TagLib::ASF::File * >(fileref.file())) {
Expand Down Expand Up @@ -1419,7 +1419,7 @@ static bool writeTags(const TagLib::FileRef fileref, const Song &from, const Son
}
} else if (TagLib::RIFF::WAV::File *file = dynamic_cast< TagLib::RIFF::WAV::File * >(fileref.file())) {
if (file->tag()) {
changed=writeID3v2Tags(file->tag(), from, to, rg, img, rating) || changed;
changed=writeID3v2Tags(file->ID3v2Tag(), from, to, rg, img, rating) || changed;
}
#ifdef TAGLIB_ASF_FOUND
} else if (TagLib::ASF::File *file = dynamic_cast< TagLib::ASF::File * >(fileref.file())) {
Expand Down Expand Up @@ -1455,7 +1455,7 @@ Song read(const QString &fileName)

readTags(fileref, &song, nullptr, nullptr, nullptr, nullptr);
song.file=fileName;
song.time=fileref.audioProperties() ? fileref.audioProperties()->length() : 0;
song.time=fileref.audioProperties() ? fileref.audioProperties()->lengthInSeconds() : 0;
return song;
}

Expand Down

0 comments on commit 45bac9e

Please sign in to comment.