From 063abc1307cd3230b5c15ac3903228619f59ba0c Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Wed, 7 Feb 2024 14:28:26 +0100 Subject: [PATCH] Fix compilation with taglib 2.0 diff --git a/src/tags.cpp b/src/tags.cpp index a8b34ab..d48ff7f 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -122,12 +122,12 @@ void writeCommonTags(const MPD::MutableSong &s, TagLib::Tag *tag) tag->setArtist(ToWString(s.getArtist())); tag->setAlbum(ToWString(s.getAlbum())); try { - tag->setYear(boost::lexical_cast(s.getDate())); + tag->setYear(boost::lexical_cast(s.getDate())); } catch (boost::bad_lexical_cast &) { std::cerr << "writeCommonTags: couldn't write 'year' tag to '" << s.getURI() << "' as it's not a positive integer\n"; } try { - tag->setTrack(boost::lexical_cast(s.getTrack())); + tag->setTrack(boost::lexical_cast(s.getTrack())); } catch (boost::bad_lexical_cast &) { std::cerr << "writeCommonTags: couldn't write 'track' tag to '" << s.getURI() << "' as it's not a positive integer\n"; } @@ -254,7 +254,7 @@ void read(mpd_song *s) if (f.isNull()) return; - setAttribute(s, "Time", boost::lexical_cast(f.audioProperties()->length())); + setAttribute(s, "Time", boost::lexical_cast(f.audioProperties()->lengthInSeconds())); if (auto mpeg_file = dynamic_cast(f.file())) { @@ -294,7 +294,10 @@ bool write(MPD::MutableSong &s) { writeID3v2Tags(s, mpeg_file->ID3v2Tag(true)); // write id3v2.4 tags only - if (!mpeg_file->save(TagLib::MPEG::File::ID3v2, true, 4, false)) + if (!mpeg_file->save(TagLib::MPEG::File::ID3v2, + TagLib::File::StripOthers, + TagLib::ID3v2::v4, + TagLib::File::DoNotDuplicate)) return false; // do not call generic save() as it will duplicate tags saved = true; -- 2.42.1