initial commit
This commit is contained in:
commit
4b60ece582
327 changed files with 28286 additions and 0 deletions
71
corax/tools/parser.h
Normal file
71
corax/tools/parser.h
Normal file
|
@ -0,0 +1,71 @@
|
|||
#ifndef PARSER_H
|
||||
#define PARSER_H
|
||||
|
||||
/**
|
||||
* @todo write docs
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include <wType/string.h>
|
||||
#include <wType/address.h>
|
||||
#include <wSocket/socket.h>
|
||||
#include <wDispatcher/dispatcher.h>
|
||||
#include <wController/collection.h>
|
||||
#include <wDatabase/resourcecache.h>
|
||||
#include <tools/file.h>
|
||||
|
||||
#include "audiotag.h"
|
||||
#include "audioid.h"
|
||||
|
||||
class Parser: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Parser(const W::Socket* p_socket, W::Dispatcher* p_dp, ResourceCache* p_audio, ResourceCache* p_images);
|
||||
~Parser();
|
||||
|
||||
void parse(const W::String& p_path);
|
||||
|
||||
signals:
|
||||
void serviceMessage(const QString& msg);
|
||||
void done(const W::String& path);
|
||||
|
||||
private:
|
||||
enum State {
|
||||
idle,
|
||||
waitingForCollections,
|
||||
parsingDirectory,
|
||||
updatingMusicDataBase,
|
||||
updatingImageDataBase
|
||||
};
|
||||
|
||||
const W::Socket* socket;
|
||||
W::Dispatcher* dp;
|
||||
C::Collection songs;
|
||||
C::Collection albums;
|
||||
C::Collection artists;
|
||||
ResourceCache* audio;
|
||||
ResourceCache* images;
|
||||
W::String path;
|
||||
|
||||
bool songsReady;
|
||||
bool albumsReady;
|
||||
bool artistsReady;
|
||||
State state;
|
||||
std::map<W::String, uint64_t> foundImages;
|
||||
std::map<AudioId, uint64_t> foundAudios;
|
||||
|
||||
void checkState();
|
||||
void parseDirectory();
|
||||
void updateMusicDataBase();
|
||||
void updateImageDataBase();
|
||||
|
||||
private slots:
|
||||
void onSongsReady();
|
||||
void onAlbumsReady();
|
||||
void onArtistsReady();
|
||||
};
|
||||
|
||||
#endif // PARSER_H
|
Loading…
Add table
Add a link
Reference in a new issue