|
|
|
|
@ -29,6 +29,7 @@ |
|
|
|
|
#include "textidentificationframe.h" |
|
|
|
|
#include "mpegfile.h" |
|
|
|
|
|
|
|
|
|
#include "browser.h" |
|
|
|
|
#include "charset.h" |
|
|
|
|
#include "display.h" |
|
|
|
|
#include "global.h" |
|
|
|
|
@ -873,40 +874,28 @@ void TagEditor::PrevColumn() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void TagEditor::ReadTags(mpd_Song *s) |
|
|
|
|
void TagEditor::ReadTags(MPD::Song &s) |
|
|
|
|
{ |
|
|
|
|
TagLib::FileRef f(s->file); |
|
|
|
|
TagLib::FileRef f(s.GetFile().c_str()); |
|
|
|
|
if (f.isNull()) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
TagLib::MPEG::File *mpegf = dynamic_cast<TagLib::MPEG::File *>(f.file()); |
|
|
|
|
|
|
|
|
|
s->artist = !f.tag()->artist().isEmpty() ? str_pool_get(f.tag()->artist().toCString(1)) : 0; |
|
|
|
|
s->title = !f.tag()->title().isEmpty() ? str_pool_get(f.tag()->title().toCString(1)) : 0; |
|
|
|
|
s->album = !f.tag()->album().isEmpty() ? str_pool_get(f.tag()->album().toCString(1)) : 0; |
|
|
|
|
s->track = f.tag()->track() ? str_pool_get(IntoStr(f.tag()->track()).c_str()) : 0; |
|
|
|
|
s->date = f.tag()->year() ? str_pool_get(IntoStr(f.tag()->year()).c_str()) : 0; |
|
|
|
|
s->genre = !f.tag()->genre().isEmpty() ? str_pool_get(f.tag()->genre().toCString(1)) : 0; |
|
|
|
|
s.SetArtist(f.tag()->artist().to8Bit(1)); |
|
|
|
|
s.SetTitle(f.tag()->title().to8Bit(1)); |
|
|
|
|
s.SetAlbum(f.tag()->album().to8Bit(1)); |
|
|
|
|
s.SetTrack(IntoStr(f.tag()->track())); |
|
|
|
|
s.SetDate(IntoStr(f.tag()->year())); |
|
|
|
|
s.SetGenre(f.tag()->genre().to8Bit(1)); |
|
|
|
|
if (mpegf) |
|
|
|
|
{ |
|
|
|
|
s->composer = !mpegf->ID3v2Tag()->frameListMap()["TCOM"].isEmpty() |
|
|
|
|
? (!mpegf->ID3v2Tag()->frameListMap()["TCOM"].front()->toString().isEmpty() |
|
|
|
|
? str_pool_get(mpegf->ID3v2Tag()->frameListMap()["TCOM"].front()->toString().toCString(1)) |
|
|
|
|
: 0) |
|
|
|
|
: 0; |
|
|
|
|
s->performer = !mpegf->ID3v2Tag()->frameListMap()["TOPE"].isEmpty() |
|
|
|
|
? (!mpegf->ID3v2Tag()->frameListMap()["TOPE"].front()->toString().isEmpty() |
|
|
|
|
? str_pool_get(mpegf->ID3v2Tag()->frameListMap()["TOPE"].front()->toString().toCString(1)) |
|
|
|
|
: 0) |
|
|
|
|
: 0; |
|
|
|
|
s->disc = !mpegf->ID3v2Tag()->frameListMap()["TPOS"].isEmpty() |
|
|
|
|
? (!mpegf->ID3v2Tag()->frameListMap()["TPOS"].front()->toString().isEmpty() |
|
|
|
|
? str_pool_get(mpegf->ID3v2Tag()->frameListMap()["TPOS"].front()->toString().toCString(1)) |
|
|
|
|
: 0) |
|
|
|
|
: 0; |
|
|
|
|
s.SetComposer(!mpegf->ID3v2Tag()->frameListMap()["TCOM"].isEmpty() ? mpegf->ID3v2Tag()->frameListMap()["TCOM"].front()->toString().to8Bit(1) : ""); |
|
|
|
|
s.SetPerformer(!mpegf->ID3v2Tag()->frameListMap()["TOPE"].isEmpty() ? mpegf->ID3v2Tag()->frameListMap()["TOPE"].front()->toString().to8Bit(1) : ""); |
|
|
|
|
s.SetDisc(!mpegf->ID3v2Tag()->frameListMap()["TPOS"].isEmpty() ? mpegf->ID3v2Tag()->frameListMap()["TPOS"].front()->toString().to8Bit(1) : ""); |
|
|
|
|
} |
|
|
|
|
s->comment = !f.tag()->comment().isEmpty() ? str_pool_get(f.tag()->comment().toCString(1)) : 0; |
|
|
|
|
s->time = f.audioProperties()->length(); |
|
|
|
|
s.SetComment(f.tag()->comment().to8Bit(1)); |
|
|
|
|
s.SetLength(f.audioProperties()->length()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
@ -1001,7 +990,7 @@ bool TagEditor::WriteTags(MPD::Song &s) |
|
|
|
|
Mpd.CommitCommandsList(); |
|
|
|
|
} |
|
|
|
|
else // only myBrowser->Main()
|
|
|
|
|
s.SetFile(new_name); |
|
|
|
|
myBrowser->GetDirectory(myBrowser->CurrentDir()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
|