in fact only mp3 supports ID3v2 tags so remove flac support for it
This commit is contained in:
@@ -25,7 +25,6 @@
|
|||||||
#include "id3v2tag.h"
|
#include "id3v2tag.h"
|
||||||
#include "textidentificationframe.h"
|
#include "textidentificationframe.h"
|
||||||
#include "mpegfile.h"
|
#include "mpegfile.h"
|
||||||
#include "flacfile.h"
|
|
||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "status_checker.h"
|
#include "status_checker.h"
|
||||||
@@ -125,9 +124,9 @@ bool GetSongTags(Song &s)
|
|||||||
mTagEditor->AddOption("[.b]Year:[/b] " + s.GetYear());
|
mTagEditor->AddOption("[.b]Year:[/b] " + s.GetYear());
|
||||||
mTagEditor->AddOption("[.b]Track:[/b] " + s.GetTrack());
|
mTagEditor->AddOption("[.b]Track:[/b] " + s.GetTrack());
|
||||||
mTagEditor->AddOption("[.b]Genre:[/b] " + s.GetGenre());
|
mTagEditor->AddOption("[.b]Genre:[/b] " + s.GetGenre());
|
||||||
mTagEditor->AddOption("[.b]Composer:[/b] " + s.GetComposer(), 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" && ext != "flac");
|
mTagEditor->AddOption("[.b]Performer:[/b] " + s.GetPerformer(), 0, ext != "mp3");
|
||||||
mTagEditor->AddOption("[.b]Disc:[/b] " + s.GetDisc(), 0, ext != "mp3" && ext != "flac");
|
mTagEditor->AddOption("[.b]Disc:[/b] " + s.GetDisc(), 0, ext != "mp3");
|
||||||
mTagEditor->AddOption("[.b]Comment:[/b] " + s.GetComment());
|
mTagEditor->AddOption("[.b]Comment:[/b] " + s.GetComment());
|
||||||
mTagEditor->AddSeparator();
|
mTagEditor->AddSeparator();
|
||||||
mTagEditor->AddOption("[.b]Filename:[/b] " + s.GetName());
|
mTagEditor->AddOption("[.b]Filename:[/b] " + s.GetName());
|
||||||
@@ -156,21 +155,10 @@ bool WriteTags(Song &s)
|
|||||||
|
|
||||||
string ext = s.GetFile();
|
string ext = s.GetFile();
|
||||||
ext = ext.substr(ext.find_last_of(".")+1);
|
ext = ext.substr(ext.find_last_of(".")+1);
|
||||||
ID3v2::Tag *tag = 0;
|
|
||||||
File *file = 0;
|
|
||||||
|
|
||||||
if (ext == "mp3")
|
if (ext == "mp3")
|
||||||
{
|
{
|
||||||
file = new MPEG::File(path_to_file.c_str());
|
MPEG::File file(path_to_file.c_str());
|
||||||
tag = ((MPEG::File *)file)->ID3v2Tag();
|
ID3v2::Tag *tag = file.ID3v2Tag();
|
||||||
}
|
|
||||||
else if (ext == "flac")
|
|
||||||
{
|
|
||||||
file = new FLAC::File(path_to_file.c_str());
|
|
||||||
tag = ((FLAC::File *)file)->ID3v2Tag();
|
|
||||||
}
|
|
||||||
if (file && tag)
|
|
||||||
{
|
|
||||||
ByteVector Composer("TCOM");
|
ByteVector Composer("TCOM");
|
||||||
ByteVector Performer("TOPE");
|
ByteVector Performer("TOPE");
|
||||||
ByteVector Disc("TPOS");
|
ByteVector Disc("TPOS");
|
||||||
@@ -186,8 +174,7 @@ bool WriteTags(Song &s)
|
|||||||
tag->addFrame(PerformerFrame);
|
tag->addFrame(PerformerFrame);
|
||||||
tag->removeFrames(Disc);
|
tag->removeFrames(Disc);
|
||||||
tag->addFrame(DiscFrame);
|
tag->addFrame(DiscFrame);
|
||||||
file->save();
|
file.save();
|
||||||
delete file;
|
|
||||||
}
|
}
|
||||||
s.GetEmptyFields(0);
|
s.GetEmptyFields(0);
|
||||||
if (!s.GetNewName().empty())
|
if (!s.GetNewName().empty())
|
||||||
|
|||||||
Reference in New Issue
Block a user