fix compilation --with-taglib
This commit is contained in:
@@ -329,13 +329,12 @@ void Browser::GetLocalDirectory(ItemList &v, const std::string &directory, bool
|
|||||||
else if (hasSupportedExtension(file->d_name))
|
else if (hasSupportedExtension(file->d_name))
|
||||||
{
|
{
|
||||||
new_item.type = itSong;
|
new_item.type = itSong;
|
||||||
mpd_pair file_pair = { "file", strdup(full_path.c_str()) };
|
mpd_pair file_pair = { "file", full_path.c_str() };
|
||||||
mpd_song *s = mpd_song_begin(&file_pair);
|
new_item.song = new Song(mpd_song_begin(&file_pair));
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
if (!recursively)
|
if (!recursively)
|
||||||
TagEditor::ReadTags(s);
|
TagEditor::ReadTags(*new_item.song);
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
new_item.song = new Song(s);
|
|
||||||
v.push_back(new_item);
|
v.push_back(new_item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -344,6 +344,11 @@ void MPD::Song::SetPosition(unsigned pos)
|
|||||||
mpd_song_set_pos(itsSong, pos);
|
mpd_song_set_pos(itsSong, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MPD::Song::SetLength(unsigned len)
|
||||||
|
{
|
||||||
|
mpd_song_set_duration(itsSong, len);
|
||||||
|
}
|
||||||
|
|
||||||
std::string MPD::Song::ParseFormat(std::string::const_iterator &it) const
|
std::string MPD::Song::ParseFormat(std::string::const_iterator &it) const
|
||||||
{
|
{
|
||||||
std::string result;
|
std::string result;
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ namespace MPD
|
|||||||
void SetDisc(const std::string &);
|
void SetDisc(const std::string &);
|
||||||
void SetComment(const std::string &);
|
void SetComment(const std::string &);
|
||||||
void SetPosition(unsigned);
|
void SetPosition(unsigned);
|
||||||
|
void SetLength(unsigned);
|
||||||
|
|
||||||
void SetNewName(const std::string &name) { itsNewName = name == GetName() ? "" : name; }
|
void SetNewName(const std::string &name) { itsNewName = name == GetName() ? "" : name; }
|
||||||
std::string GetNewName() const { return itsNewName; }
|
std::string GetNewName() const { return itsNewName; }
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "textidentificationframe.h"
|
#include "textidentificationframe.h"
|
||||||
#include "mpegfile.h"
|
#include "mpegfile.h"
|
||||||
|
|
||||||
|
#include "browser.h"
|
||||||
#include "charset.h"
|
#include "charset.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "global.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())
|
if (f.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TagLib::MPEG::File *mpegf = dynamic_cast<TagLib::MPEG::File *>(f.file());
|
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.SetArtist(f.tag()->artist().to8Bit(1));
|
||||||
s->title = !f.tag()->title().isEmpty() ? str_pool_get(f.tag()->title().toCString(1)) : 0;
|
s.SetTitle(f.tag()->title().to8Bit(1));
|
||||||
s->album = !f.tag()->album().isEmpty() ? str_pool_get(f.tag()->album().toCString(1)) : 0;
|
s.SetAlbum(f.tag()->album().to8Bit(1));
|
||||||
s->track = f.tag()->track() ? str_pool_get(IntoStr(f.tag()->track()).c_str()) : 0;
|
s.SetTrack(IntoStr(f.tag()->track()));
|
||||||
s->date = f.tag()->year() ? str_pool_get(IntoStr(f.tag()->year()).c_str()) : 0;
|
s.SetDate(IntoStr(f.tag()->year()));
|
||||||
s->genre = !f.tag()->genre().isEmpty() ? str_pool_get(f.tag()->genre().toCString(1)) : 0;
|
s.SetGenre(f.tag()->genre().to8Bit(1));
|
||||||
if (mpegf)
|
if (mpegf)
|
||||||
{
|
{
|
||||||
s->composer = !mpegf->ID3v2Tag()->frameListMap()["TCOM"].isEmpty()
|
s.SetComposer(!mpegf->ID3v2Tag()->frameListMap()["TCOM"].isEmpty() ? mpegf->ID3v2Tag()->frameListMap()["TCOM"].front()->toString().to8Bit(1) : "");
|
||||||
? (!mpegf->ID3v2Tag()->frameListMap()["TCOM"].front()->toString().isEmpty()
|
s.SetPerformer(!mpegf->ID3v2Tag()->frameListMap()["TOPE"].isEmpty() ? mpegf->ID3v2Tag()->frameListMap()["TOPE"].front()->toString().to8Bit(1) : "");
|
||||||
? str_pool_get(mpegf->ID3v2Tag()->frameListMap()["TCOM"].front()->toString().toCString(1))
|
s.SetDisc(!mpegf->ID3v2Tag()->frameListMap()["TPOS"].isEmpty() ? mpegf->ID3v2Tag()->frameListMap()["TPOS"].front()->toString().to8Bit(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->comment = !f.tag()->comment().isEmpty() ? str_pool_get(f.tag()->comment().toCString(1)) : 0;
|
s.SetComment(f.tag()->comment().to8Bit(1));
|
||||||
s->time = f.audioProperties()->length();
|
s.SetLength(f.audioProperties()->length());
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -1001,7 +990,7 @@ bool TagEditor::WriteTags(MPD::Song &s)
|
|||||||
Mpd.CommitCommandsList();
|
Mpd.CommitCommandsList();
|
||||||
}
|
}
|
||||||
else // only myBrowser->Main()
|
else // only myBrowser->Main()
|
||||||
s.SetFile(new_name);
|
myBrowser->GetDirectory(myBrowser->CurrentDir());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class TagEditor : public Screen<Window>
|
|||||||
/// NOTICE: this string is always in utf8, no need to convert it
|
/// NOTICE: this string is always in utf8, no need to convert it
|
||||||
const std::string &CurrentDir() { return itsBrowsedDir; }
|
const std::string &CurrentDir() { return itsBrowsedDir; }
|
||||||
|
|
||||||
static void ReadTags(mpd_Song *);
|
static void ReadTags(MPD::Song &);
|
||||||
static bool WriteTags(MPD::Song &);
|
static bool WriteTags(MPD::Song &);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user