From 08303146be75d85ba304c83ebc9b36773c00ae5a Mon Sep 17 00:00:00 2001 From: unK Date: Sat, 27 Sep 2008 12:46:46 +0200 Subject: [PATCH] in fact only mp3 supports ID3v2 tags so remove flac support for it --- src/tag_editor.cpp | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/tag_editor.cpp b/src/tag_editor.cpp index b643e955..90532d1d 100644 --- a/src/tag_editor.cpp +++ b/src/tag_editor.cpp @@ -25,7 +25,6 @@ #include "id3v2tag.h" #include "textidentificationframe.h" #include "mpegfile.h" -#include "flacfile.h" #include "helpers.h" #include "status_checker.h" @@ -125,9 +124,9 @@ bool GetSongTags(Song &s) mTagEditor->AddOption("[.b]Year:[/b] " + s.GetYear()); mTagEditor->AddOption("[.b]Track:[/b] " + s.GetTrack()); mTagEditor->AddOption("[.b]Genre:[/b] " + s.GetGenre()); - mTagEditor->AddOption("[.b]Composer:[/b] " + s.GetComposer(), 0, ext != "mp3" && ext != "flac"); - mTagEditor->AddOption("[.b]Performer:[/b] " + s.GetPerformer(), 0, ext != "mp3" && ext != "flac"); - mTagEditor->AddOption("[.b]Disc:[/b] " + s.GetDisc(), 0, ext != "mp3" && ext != "flac"); + mTagEditor->AddOption("[.b]Composer:[/b] " + s.GetComposer(), 0, ext != "mp3"); + mTagEditor->AddOption("[.b]Performer:[/b] " + s.GetPerformer(), 0, ext != "mp3"); + mTagEditor->AddOption("[.b]Disc:[/b] " + s.GetDisc(), 0, ext != "mp3"); mTagEditor->AddOption("[.b]Comment:[/b] " + s.GetComment()); mTagEditor->AddSeparator(); mTagEditor->AddOption("[.b]Filename:[/b] " + s.GetName()); @@ -156,21 +155,10 @@ bool WriteTags(Song &s) string ext = s.GetFile(); ext = ext.substr(ext.find_last_of(".")+1); - ID3v2::Tag *tag = 0; - File *file = 0; - if (ext == "mp3") { - file = new MPEG::File(path_to_file.c_str()); - tag = ((MPEG::File *)file)->ID3v2Tag(); - } - else if (ext == "flac") - { - file = new FLAC::File(path_to_file.c_str()); - tag = ((FLAC::File *)file)->ID3v2Tag(); - } - if (file && tag) - { + MPEG::File file(path_to_file.c_str()); + ID3v2::Tag *tag = file.ID3v2Tag(); ByteVector Composer("TCOM"); ByteVector Performer("TOPE"); ByteVector Disc("TPOS"); @@ -186,8 +174,7 @@ bool WriteTags(Song &s) tag->addFrame(PerformerFrame); tag->removeFrames(Disc); tag->addFrame(DiscFrame); - file->save(); - delete file; + file.save(); } s.GetEmptyFields(0); if (!s.GetNewName().empty())