mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-30 06:32:36 +00:00
Checkpoint commit for Indexer logging, plus a few necessary file/class renames.
This commit is contained in:
parent
a3a19aaf07
commit
30f50c997c
@ -34,7 +34,7 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "TagReaderTaglib.h"
|
||||
#include "TaglibMetadataReader.h"
|
||||
|
||||
#include <toolkit/tlist.h>
|
||||
#include <toolkit/tfile.h>
|
||||
@ -73,17 +73,17 @@ static inline std::wstring utf8to16(const char* utf8) {
|
||||
}
|
||||
#endif
|
||||
|
||||
TagReaderTaglib::TagReaderTaglib() {
|
||||
TaglibMetadataReader::TaglibMetadataReader() {
|
||||
}
|
||||
|
||||
TagReaderTaglib::~TagReaderTaglib() {
|
||||
TaglibMetadataReader::~TaglibMetadataReader() {
|
||||
}
|
||||
|
||||
void TagReaderTaglib::Destroy() {
|
||||
void TaglibMetadataReader::Destroy() {
|
||||
delete this;
|
||||
}
|
||||
|
||||
bool TagReaderTaglib::CanReadTag(const char *extension){
|
||||
bool TaglibMetadataReader::CanReadTag(const char *extension){
|
||||
if (extension) {
|
||||
std::string ext(extension);
|
||||
boost::algorithm::to_lower(ext);
|
||||
@ -99,7 +99,7 @@ bool TagReaderTaglib::CanReadTag(const char *extension){
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TagReaderTaglib::ReadTag(const char* uri, musik::core::ITrack *track) {
|
||||
bool TaglibMetadataReader::ReadTag(const char* uri, musik::core::IMetadataWriter *track) {
|
||||
std::string path(uri);
|
||||
std::string extension;
|
||||
|
||||
@ -119,7 +119,7 @@ bool TagReaderTaglib::ReadTag(const char* uri, musik::core::ITrack *track) {
|
||||
return this->GetGenericTag(uri, track);
|
||||
}
|
||||
|
||||
bool TagReaderTaglib::GetGenericTag(const char* uri, musik::core::ITrack *track) {
|
||||
bool TaglibMetadataReader::GetGenericTag(const char* uri, musik::core::IMetadataWriter *target) {
|
||||
#ifdef WIN32
|
||||
TagLib::FileRef file(utf8to16(uri).c_str());
|
||||
#else
|
||||
@ -132,27 +132,27 @@ bool TagReaderTaglib::GetGenericTag(const char* uri, musik::core::ITrack *track)
|
||||
if(tag) {
|
||||
|
||||
if (!tag->title().isEmpty()) {
|
||||
this->SetTagValue("title", tag->title(), track);
|
||||
this->SetTagValue("title", tag->title(), target);
|
||||
}
|
||||
else {
|
||||
this->SetTagValue("title", uri, track);
|
||||
this->SetTagValue("title", uri, target);
|
||||
}
|
||||
|
||||
this->SetTagValue("album",tag->album(), track);
|
||||
this->SetSlashSeparatedValues("artist",tag->artist() ,track);
|
||||
this->SetTagValue("genre",tag->genre(), track);
|
||||
this->SetTagValue("comment",tag->comment(), track);
|
||||
this->SetTagValue("album",tag->album(), target);
|
||||
this->SetSlashSeparatedValues("artist",tag->artist() , target);
|
||||
this->SetTagValue("genre",tag->genre(), target);
|
||||
this->SetTagValue("comment",tag->comment(), target);
|
||||
|
||||
if (tag->track()) {
|
||||
this->SetTagValue("track", tag->track(), track);
|
||||
this->SetTagValue("track", tag->track(), target);
|
||||
}
|
||||
|
||||
if (tag->year()) {
|
||||
this->SetTagValue("year", tag->year(), track);
|
||||
this->SetTagValue("year", tag->year(), target);
|
||||
}
|
||||
|
||||
TagLib::AudioProperties *audio = file.audioProperties();
|
||||
this->SetAudioProperties(audio,track);
|
||||
this->SetAudioProperties(audio, target);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -161,7 +161,7 @@ bool TagReaderTaglib::GetGenericTag(const char* uri, musik::core::ITrack *track)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TagReaderTaglib::GetID3v2Tag(const char* uri, musik::core::ITrack *track) {
|
||||
bool TaglibMetadataReader::GetID3v2Tag(const char* uri, musik::core::IMetadataWriter *track) {
|
||||
TagLib::ID3v2::FrameFactory::instance()->setDefaultTextEncoding(TagLib::String::UTF8);
|
||||
|
||||
#ifdef WIN32
|
||||
@ -327,37 +327,37 @@ bool TagReaderTaglib::GetID3v2Tag(const char* uri, musik::core::ITrack *track) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void TagReaderTaglib::SetTagValue(
|
||||
void TaglibMetadataReader::SetTagValue(
|
||||
const char* key,
|
||||
const TagLib::String tagString,
|
||||
musik::core::ITrack *track)
|
||||
musik::core::IMetadataWriter *track)
|
||||
{
|
||||
std::string value(tagString.begin(), tagString.end());
|
||||
track->SetValue(key, value.c_str());
|
||||
}
|
||||
|
||||
void TagReaderTaglib::SetTagValue(
|
||||
void TaglibMetadataReader::SetTagValue(
|
||||
const char* key,
|
||||
const char* string,
|
||||
musik::core::ITrack *track)
|
||||
musik::core::IMetadataWriter *track)
|
||||
{
|
||||
std::string temp(string);
|
||||
track->SetValue(key, temp.c_str());
|
||||
}
|
||||
|
||||
void TagReaderTaglib::SetTagValue(
|
||||
void TaglibMetadataReader::SetTagValue(
|
||||
const char* key,
|
||||
const int tagInt,
|
||||
musik::core::ITrack *track)
|
||||
musik::core::IMetadataWriter *target)
|
||||
{
|
||||
std::string temp = boost::str(boost::format("%1%") % tagInt);
|
||||
track->SetValue(key, temp.c_str());
|
||||
target->SetValue(key, temp.c_str());
|
||||
}
|
||||
|
||||
void TagReaderTaglib::SetTagValues(
|
||||
void TaglibMetadataReader::SetTagValues(
|
||||
const char* key,
|
||||
const TagLib::ID3v2::FrameList &frame,
|
||||
musik::core::ITrack *track)
|
||||
musik::core::IMetadataWriter *target)
|
||||
{
|
||||
if (!frame.isEmpty()) {
|
||||
TagLib::ID3v2::FrameList::ConstIterator value = frame.begin();
|
||||
@ -366,16 +366,16 @@ void TagReaderTaglib::SetTagValues(
|
||||
TagLib::String tagString = (*value)->toString();
|
||||
if(!tagString.isEmpty()) {
|
||||
std::string value(tagString.begin(), tagString.end());
|
||||
track->SetValue(key,value.c_str());
|
||||
target->SetValue(key,value.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TagReaderTaglib::SetSlashSeparatedValues(
|
||||
void TaglibMetadataReader::SetSlashSeparatedValues(
|
||||
const char* key,
|
||||
TagLib::String tagString,
|
||||
musik::core::ITrack *track)
|
||||
musik::core::IMetadataWriter *track)
|
||||
{
|
||||
if(!tagString.isEmpty()) {
|
||||
std::string value(tagString.begin(), tagString.end());
|
||||
@ -391,10 +391,10 @@ void TagReaderTaglib::SetSlashSeparatedValues(
|
||||
}
|
||||
}
|
||||
|
||||
void TagReaderTaglib::SetSlashSeparatedValues(
|
||||
void TaglibMetadataReader::SetSlashSeparatedValues(
|
||||
const char* key,
|
||||
const TagLib::ID3v2::FrameList &frame,
|
||||
musik::core::ITrack *track)
|
||||
musik::core::IMetadataWriter *track)
|
||||
{
|
||||
if(!frame.isEmpty()) {
|
||||
TagLib::ID3v2::FrameList::ConstIterator value = frame.begin();
|
||||
@ -405,9 +405,9 @@ void TagReaderTaglib::SetSlashSeparatedValues(
|
||||
}
|
||||
}
|
||||
|
||||
void TagReaderTaglib::SetAudioProperties(
|
||||
void TaglibMetadataReader::SetAudioProperties(
|
||||
TagLib::AudioProperties *audioProperties,
|
||||
musik::core::ITrack *track)
|
||||
musik::core::IMetadataWriter *track)
|
||||
{
|
||||
/* FIXME: it's overkill to bring boost in just to convert ints to strings */
|
||||
|
@ -62,25 +62,52 @@
|
||||
#include <core/sdk/IMetadataReader.h>
|
||||
#include <core/support/Common.h>
|
||||
|
||||
class TagReaderTaglib : public musik::core::metadata::IMetadataReader {
|
||||
public:
|
||||
TagReaderTaglib();
|
||||
virtual ~TagReaderTaglib();
|
||||
bool ReadTag(const char *uri, musik::core::ITrack *track);
|
||||
virtual bool CanReadTag(const char *extension);
|
||||
class TaglibMetadataReader : public musik::core::metadata::IMetadataReader {
|
||||
public:
|
||||
TaglibMetadataReader();
|
||||
virtual ~TaglibMetadataReader();
|
||||
bool ReadTag(const char *uri, musik::core::IMetadataWriter *target);
|
||||
virtual bool CanReadTag(const char *extension);
|
||||
virtual void Destroy();
|
||||
|
||||
private:
|
||||
void SetTagValue(const char* key,const char* string,musik::core::ITrack *track);
|
||||
void SetTagValue(const char* key,const TagLib::String tagString,musik::core::ITrack *track);
|
||||
void SetTagValue(const char* key,const int tagInt,musik::core::ITrack *track);
|
||||
void SetTagValues(const char* key,const TagLib::ID3v2::FrameList &frame,musik::core::ITrack *track);
|
||||
void SetAudioProperties(TagLib::AudioProperties *audioProperties,musik::core::ITrack *track);
|
||||
private:
|
||||
void SetTagValue(
|
||||
const char* key,
|
||||
const char* string,musik::core::IMetadataWriter *target);
|
||||
|
||||
void SetSlashSeparatedValues(const char* key,const TagLib::ID3v2::FrameList &frame,musik::core::ITrack *track);
|
||||
void SetSlashSeparatedValues(const char* key,TagLib::String tagString,musik::core::ITrack *track);
|
||||
void SetTagValue(
|
||||
const char* key,
|
||||
const TagLib::String tagString,
|
||||
musik::core::IMetadataWriter *target);
|
||||
|
||||
bool GetID3v2Tag(const char* uri, musik::core::ITrack *track);
|
||||
bool GetGenericTag(const char* uri, musik::core::ITrack *track);
|
||||
void SetTagValue(
|
||||
const char* key,
|
||||
const int tagInt,musik::core::IMetadataWriter *target);
|
||||
|
||||
void SetTagValues(const char* key,
|
||||
const TagLib::ID3v2::FrameList &frame,
|
||||
musik::core::IMetadataWriter *target);
|
||||
|
||||
void SetAudioProperties(
|
||||
TagLib::AudioProperties *audioProperties,
|
||||
musik::core::IMetadataWriter *target);
|
||||
|
||||
void SetSlashSeparatedValues(
|
||||
const char* key,
|
||||
const TagLib::ID3v2::FrameList &frame,
|
||||
musik::core::IMetadataWriter *target);
|
||||
|
||||
void SetSlashSeparatedValues(
|
||||
const char* key,
|
||||
TagLib::String tagString,
|
||||
musik::core::IMetadataWriter *target);
|
||||
|
||||
bool GetID3v2Tag(
|
||||
const char* uri,
|
||||
musik::core::IMetadataWriter *target);
|
||||
|
||||
bool GetGenericTag(
|
||||
const char* uri,
|
||||
musik::core::IMetadataWriter *target);
|
||||
};
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TagReaderTaglib.h"
|
||||
#include "TaglibMetadataReader.h"
|
||||
#include "core/sdk/IPlugin.h"
|
||||
#ifndef _HAVE_TAGLIB
|
||||
#include <id3v2framefactory.h>
|
||||
@ -77,7 +77,7 @@ class TaglibPlugin : public musik::core::IPlugin {
|
||||
|
||||
extern "C" {
|
||||
DLLEXPORT musik::core::metadata::IMetadataReader* GetMetadataReader() {
|
||||
return new TagReaderTaglib();
|
||||
return new TaglibMetadataReader();
|
||||
}
|
||||
|
||||
DLLEXPORT musik::core::IPlugin* GetPlugin() {
|
||||
|
@ -213,7 +213,7 @@
|
||||
<ClCompile Include="taglib-1.11\taglib\xm\xmfile.cpp" />
|
||||
<ClCompile Include="taglib-1.11\taglib\xm\xmproperties.cpp" />
|
||||
<ClCompile Include="taglib_plugin.cpp" />
|
||||
<ClCompile Include="TagReaderTaglib.cpp" />
|
||||
<ClCompile Include="TaglibMetadataReader.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
@ -330,7 +330,7 @@
|
||||
<ClInclude Include="taglib-1.11\taglib\wavpack\wavpackproperties.h" />
|
||||
<ClInclude Include="taglib-1.11\taglib\xm\xmfile.h" />
|
||||
<ClInclude Include="taglib-1.11\taglib\xm\xmproperties.h" />
|
||||
<ClInclude Include="TagReaderTaglib.h" />
|
||||
<ClInclude Include="TaglibMetadataReader.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\core\core.vcxproj">
|
||||
@ -341,4 +341,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
@ -16,9 +16,6 @@
|
||||
<ClCompile Include="taglib_plugin.cpp">
|
||||
<Filter>plugin</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TagReaderTaglib.cpp">
|
||||
<Filter>plugin</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="taglib-1.11\taglib\audioproperties.cpp">
|
||||
<Filter>taglib-1.11</Filter>
|
||||
</ClCompile>
|
||||
@ -328,14 +325,14 @@
|
||||
<ClCompile Include="taglib-1.11\taglib\xm\xmproperties.cpp">
|
||||
<Filter>taglib-1.11</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TaglibMetadataReader.cpp">
|
||||
<Filter>plugin</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>plugin</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TagReaderTaglib.h">
|
||||
<Filter>plugin</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="taglib-1.11\taglib\audioproperties.h">
|
||||
<Filter>taglib-1.11</Filter>
|
||||
</ClInclude>
|
||||
@ -675,5 +672,8 @@
|
||||
<ClInclude Include="taglib-1.11\config.h">
|
||||
<Filter>taglib-1.11</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TaglibMetadataReader.h">
|
||||
<Filter>plugin</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -186,7 +186,7 @@ bool Buffer::Append(BufferPtr appendBuffer) {
|
||||
{
|
||||
long newBufferSize = (this->Samples() + appendBuffer->Samples()) * this->channels;
|
||||
|
||||
if (newBufferSize > this->internalBufferSize) { /* resize */
|
||||
if (newBufferSize > this->internalBufferSize) { /* resize, then copy, if too small */
|
||||
float *newBuffer = new float[newBufferSize];
|
||||
|
||||
CopyFloat(newBuffer, this->buffer, this->sampleSize * this->channels);
|
||||
|
@ -160,7 +160,7 @@
|
||||
<ClInclude Include="sdk\IOutput.h" />
|
||||
<ClInclude Include="sdk\IPlayer.h" />
|
||||
<ClInclude Include="sdk\IPlugin.h" />
|
||||
<ClInclude Include="sdk\ITrack.h" />
|
||||
<ClInclude Include="sdk\IMetadataWriter.h" />
|
||||
<ClInclude Include="db\CachedStatement.h" />
|
||||
<ClInclude Include="db\Connection.h" />
|
||||
<ClInclude Include="db\dbconfig.h" />
|
||||
|
@ -198,18 +198,12 @@
|
||||
<ClInclude Include="sdk\IPlayer.h">
|
||||
<Filter>src\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk\IPlugin.h">
|
||||
<Filter>src\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk\IAnalyzer.h">
|
||||
<Filter>src\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk\IBuffer.h">
|
||||
<Filter>src\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk\ITrack.h">
|
||||
<Filter>src\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk\IDataStream.h">
|
||||
<Filter>src\sdk</Filter>
|
||||
</ClInclude>
|
||||
@ -315,5 +309,11 @@
|
||||
<ClInclude Include="sdk\IMetadataReader.h">
|
||||
<Filter>src\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk\IMetadataWriter.h">
|
||||
<Filter>src\sdk</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sdk\IPlugin.h">
|
||||
<Filter>src\sdk</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -79,6 +79,21 @@ Indexer::~Indexer(){
|
||||
}
|
||||
}
|
||||
|
||||
static std::string getStatus(int status, int fileCount, float overall, float current) {
|
||||
switch (status) {
|
||||
case 1: return boost::str(boost::format("Counting files: %1%") % fileCount);
|
||||
case 2: return boost::str(boost::format("Indexing: %.2f") % (overall * 100)) + "%";
|
||||
case 3: return boost::str(boost::format("Removing old files: %.2f") % (overall * 100)) + "%";
|
||||
case 4: return "Cleaning up.";
|
||||
case 5: return "Optimizing.";
|
||||
case 6: return boost::str(boost::format("Analyzing: %.2f%% (current %.1f%%)")
|
||||
% (100.0 * overall / (double) fileCount)
|
||||
% (current * 100.0));
|
||||
}
|
||||
|
||||
return "unknown indexer status";
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Get the current status (text)
|
||||
@ -86,22 +101,13 @@ Indexer::~Indexer(){
|
||||
std::string Indexer::GetStatus() {
|
||||
boost::mutex::scoped_lock lock(this->progressMutex);
|
||||
|
||||
std::string status;
|
||||
switch(this->status) {
|
||||
case 1: return boost::str(boost::format("Counting files: %1%")%this->nofFiles );
|
||||
case 2: return boost::str(boost::format("Indexing: %.2f") % (this->overallProgress*100)) + "%";
|
||||
case 3: return boost::str(boost::format("Removing old files: %.2f") % (this->overallProgress*100)) + "%";
|
||||
case 4: return "Cleaning up.";
|
||||
case 5: return "Optimizing.";
|
||||
case 6: return boost::str(boost::format("Analyzing: %.2f%% (current %.1f%%)")
|
||||
% (100.0 * this->overallProgress / (double) this->nofFiles)
|
||||
% (this->currentProgress * 100.0));
|
||||
}
|
||||
|
||||
return status;
|
||||
return getStatus(
|
||||
this->status,
|
||||
this->nofFiles,
|
||||
this->overallProgress,
|
||||
this->currentProgress);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Restart the sync
|
||||
@ -404,6 +410,7 @@ void Indexer::SyncDirectory(
|
||||
for( ; file != end && !this->Exited() && !this->Restarted();++file) {
|
||||
if (is_directory(file->status())) {
|
||||
/* recursion here */
|
||||
std::cout << getStatus(this->status, this->nofFiles, this->overallProgress, this->currentProgress) << "\n";
|
||||
this->SyncDirectory(file->path().string(), dirId,pathId,syncPath);
|
||||
}
|
||||
else {
|
||||
|
@ -57,7 +57,7 @@ namespace musik { namespace core {
|
||||
///but can also be used as a standalone class for indexing files.
|
||||
///All you need to do is create a Indexer object and call Startup()
|
||||
//////////////////////////////////////////
|
||||
class Indexer : public ThreadHelper,private boost::noncopyable {
|
||||
class Indexer : public ThreadHelper, private boost::noncopyable {
|
||||
public:
|
||||
Indexer();
|
||||
~Indexer();
|
||||
|
@ -63,8 +63,8 @@ namespace musik { namespace core {
|
||||
class LibraryBase;
|
||||
}
|
||||
|
||||
typedef boost::shared_ptr<library::LibraryBase> LibraryPtr;
|
||||
typedef boost::weak_ptr<library::LibraryBase> LibraryWeakPtr;
|
||||
typedef boost::shared_ptr<library::LibraryBase> LibraryPtr;
|
||||
typedef boost::weak_ptr<library::LibraryBase> LibraryWeakPtr;
|
||||
} }
|
||||
|
||||
namespace musik { namespace core { namespace library {
|
||||
@ -90,7 +90,7 @@ namespace musik { namespace core { namespace library {
|
||||
protected:
|
||||
LibraryBase(std::string name,int id);
|
||||
|
||||
public:
|
||||
public:
|
||||
virtual ~LibraryBase();
|
||||
|
||||
//////////////////////////////////////////
|
||||
@ -104,21 +104,6 @@ namespace musik { namespace core { namespace library {
|
||||
//////////////////////////////////////////
|
||||
virtual bool Startup() = 0;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Get state of the library
|
||||
///
|
||||
///\returns
|
||||
///Status of the library. May be empty.
|
||||
///
|
||||
///Get the current status of the Library.
|
||||
///Will for instance report current status of the indexer in the LocalLibrary.
|
||||
///
|
||||
///\remarks
|
||||
///Empty string means that the library thread is holding.
|
||||
//////////////////////////////////////////
|
||||
virtual std::string GetInfo() = 0;
|
||||
|
||||
virtual bool AddQuery( const query::QueryBase &query,unsigned int options=0 );
|
||||
virtual bool RunCallbacks();
|
||||
std::string GetLibraryDirectory();
|
||||
@ -126,9 +111,9 @@ namespace musik { namespace core { namespace library {
|
||||
virtual musik::core::Indexer *Indexer();
|
||||
virtual std::string BasePath();
|
||||
bool Exited();
|
||||
const std::string& Identifier();
|
||||
int Id();
|
||||
const std::string& Name();
|
||||
const std::string& Identifier();
|
||||
int Id();
|
||||
const std::string& Name();
|
||||
virtual const std::string& AuthorizationKey();
|
||||
|
||||
static bool IsStaticMetaKey(std::string &metakey);
|
||||
@ -258,7 +243,7 @@ namespace musik { namespace core { namespace library {
|
||||
|
||||
public:
|
||||
boost::mutex libraryMutex;
|
||||
LibraryWeakPtr self;
|
||||
LibraryWeakPtr self;
|
||||
LibraryPtr GetSelfPtr();
|
||||
int userId;
|
||||
};
|
||||
@ -268,5 +253,5 @@ namespace musik { namespace core { namespace library {
|
||||
|
||||
namespace musik { namespace core {
|
||||
typedef boost::shared_ptr<musik::core::library::LibraryBase> LibraryPtr;
|
||||
typedef boost::weak_ptr<library::LibraryBase> LibraryWeakPtr;
|
||||
typedef boost::weak_ptr<library::LibraryBase> LibraryWeakPtr;
|
||||
} }
|
||||
|
@ -78,21 +78,6 @@ LocalLibrary::~LocalLibrary() {
|
||||
this->threads.join_all();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Get a short status string of what is going on in the Library.
|
||||
///
|
||||
///\returns
|
||||
///Information string.
|
||||
///
|
||||
///The information is mostly used to get the information
|
||||
///about the Indexer.
|
||||
//////////////////////////////////////////
|
||||
std::string LocalLibrary::GetInfo(){
|
||||
return this->indexer.GetStatus();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Startup the library threads.
|
||||
|
@ -67,15 +67,14 @@ namespace musik{ namespace core{ namespace library{
|
||||
///Indexer
|
||||
//////////////////////////////////////////
|
||||
class LocalLibrary : public library::LibraryBase {
|
||||
private:
|
||||
private:
|
||||
LocalLibrary(std::string name, int id);
|
||||
|
||||
public:
|
||||
static LibraryPtr Create(std::string name,int id);
|
||||
static LibraryPtr Create(std::string name,int id);
|
||||
~LocalLibrary(void);
|
||||
|
||||
bool Startup();
|
||||
std::string GetInfo();
|
||||
musik::core::Indexer *Indexer();
|
||||
|
||||
protected:
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <core/sdk/ITrack.h>
|
||||
#include <core/sdk/IMetadataWriter.h>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@ -60,13 +60,13 @@ namespace musik{ namespace core{
|
||||
///\brief
|
||||
///The most basic implementation of a track
|
||||
//////////////////////////////////////////
|
||||
class Track : public ITrack {
|
||||
class Track : public IMetadataWriter {
|
||||
public:
|
||||
typedef std::multimap<std::string, std::string> MetadataMap;
|
||||
typedef std::pair<MetadataMap::iterator, MetadataMap::iterator> MetadataIteratorRange;
|
||||
|
||||
virtual ~Track();
|
||||
|
||||
|
||||
virtual DBID Id();
|
||||
|
||||
virtual musik::core::LibraryPtr Library();
|
||||
|
@ -34,7 +34,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
#include "ITrack.h"
|
||||
#include "IMetadataWriter.h"
|
||||
#include "IBuffer.h"
|
||||
|
||||
namespace musik { namespace core { namespace audio {
|
||||
@ -64,13 +64,13 @@ namespace musik { namespace core { namespace audio {
|
||||
///Start analyzing the track. Returns true if
|
||||
///the analyzing should continue.
|
||||
//////////////////////////////////////////
|
||||
virtual bool Start(musik::core::ITrack *track) = 0;
|
||||
virtual bool Start(musik::core::IMetadataWriter *target) = 0;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
///Analyze a buffer
|
||||
//////////////////////////////////////////
|
||||
virtual bool Analyze(musik::core::ITrack *track, IBuffer *buffer) = 0;
|
||||
virtual bool Analyze(musik::core::IMetadataWriter *target, IBuffer *buffer) = 0;
|
||||
|
||||
//////////////////////////////////////////
|
||||
///\brief
|
||||
@ -78,7 +78,7 @@ namespace musik { namespace core { namespace audio {
|
||||
///If this call makes changes to the track it should
|
||||
///return true.
|
||||
//////////////////////////////////////////
|
||||
virtual bool End(musik::core::ITrack *track) = 0;
|
||||
virtual bool End(musik::core::IMetadataWriter *target) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -37,13 +37,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
#include "ITrack.h"
|
||||
#include "IMetadataWriter.h"
|
||||
|
||||
namespace musik { namespace core { namespace metadata {
|
||||
|
||||
class IMetadataReader {
|
||||
class IMetadataReader {
|
||||
public:
|
||||
virtual bool ReadTag(const char *uri, musik::core::ITrack *track) = 0;
|
||||
virtual bool ReadTag(const char *uri, musik::core::IMetadataWriter *target) = 0;
|
||||
virtual bool CanReadTag(const char *extension) = 0;
|
||||
virtual void Destroy() = 0;
|
||||
};
|
||||
|
@ -44,11 +44,11 @@ namespace musik { namespace core {
|
||||
///\brief
|
||||
///The virtual base for all tracks
|
||||
//////////////////////////////////////////
|
||||
class ITrack {
|
||||
class IMetadataWriter {
|
||||
public:
|
||||
virtual void SetValue(const char* metakey, const char* value) = 0;
|
||||
virtual void ClearValue(const char* metakey) = 0;
|
||||
virtual void SetThumbnail(const char *data, long size) = 0;
|
||||
virtual void SetThumbnail(const char *data, long size) = 0; /* should be SetBlob with a key */
|
||||
};
|
||||
|
||||
} }
|
@ -99,9 +99,7 @@ void ConsoleUI::Run()
|
||||
using musik::core::TrackPtr;
|
||||
|
||||
LibraryPtr library = LibraryFactory::Libraries().at(0); /* there's always at least 1... */
|
||||
//library->Indexer()->AddPath("E:/music/ripped/MR_Bungle");
|
||||
//library->Indexer()->AddPath("E:/music/downloaded/the beatles (remastered)");
|
||||
library->Indexer()->AddPath("E:/testmusic");
|
||||
library->Indexer()->AddPath("E:/music/");
|
||||
library->Indexer()->RestartSync();
|
||||
|
||||
while (!this->shouldQuit) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user