-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to yyjson and isolate audio index parser
- Loading branch information
Showing
10 changed files
with
393 additions
and
1,702 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef AUDIO_INDEX_PARSER_H | ||
#define AUDIO_INDEX_PARSER_H | ||
|
||
#include "util.h" | ||
|
||
typedef struct { | ||
s8 origin; | ||
s8 hira_reading; | ||
s8 pitch_number; | ||
s8 pitch_pattern; | ||
} fileinfo; | ||
|
||
void parse_audio_index_from_file(s8 curdir, const char *index_filepath, | ||
void (*foreach_headword)(void *, s8, s8), void *userdata_hw, | ||
void (*foreach_file)(void *, s8, fileinfo), void *userdata_f); | ||
|
||
#endif //AUDIO_INDEX_PARSER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
#include "util.h" | ||
#include <lmdb.h> | ||
#ifndef DATABASE_H | ||
#define DATABASE_H | ||
|
||
#include <stdbool.h> | ||
#include "util.h" | ||
#include "ajt_audio_index_parser.h" | ||
|
||
typedef struct { | ||
stringbuilder_s lastval; | ||
MDB_env *env; | ||
MDB_dbi dbi1; | ||
MDB_dbi dbi2; | ||
MDB_txn *txn; | ||
bool readonly; | ||
} database; | ||
typedef struct database_s database; | ||
|
||
database opendb(const char *path, bool readonly); | ||
void closedb(database); | ||
database *jdb_open(char *path, bool readonly); | ||
void jdb_close(database *); | ||
/* | ||
* Add to database, allowing duplicates if they are added directly after another | ||
*/ | ||
void addtodb1(database db, s8 key, s8 val); | ||
void addtodb2(database db, s8 key, s8 val); | ||
void jdb_add_headword_with_file(database *db, s8 headword, s8 filepath); | ||
void jdb_add_file_with_fileinfo(database *db, s8 filepath, fileinfo fi); | ||
|
||
s8 *jdb_get_files(database *db, s8 key); | ||
fileinfo jdb_get_fileinfo(database *db, s8 fullpath); | ||
|
||
i32 jdb_check_exists(s8 dbpath); | ||
|
||
DEFINE_DROP_FUNC(database *, jdb_close) | ||
|
||
s8 *getfiles(database db, s8 key); | ||
s8 getfromdb2(database db, s8 key); | ||
#endif // DATABASE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#include "util.h" | ||
|
||
void jppron(s8 word, s8 reading, char *audiopth); | ||
void jppron(s8 word, s8 reading, char *audio_folders_path); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.