Header - Database db5. More...
#include <stdbool.h>
#include "db5_types.h"
Go to the source code of this file.
Functions | |
bool | db5_init () |
open database | |
void | db5_free () |
close database | |
void | db5_unwidechar_row (db5_row *entry) |
convert all strings of an entry to char | |
void | db5_widechar_row (db5_row *entry) |
convert all strings of an entry to wide char | |
bool | db5_update (const char *filename) |
update file information in database | |
bool | db5_insert (const char *filename) |
add a file in database | |
bool | db5_delete (const char *filename) |
remove a file from database | |
char ** | db5_select_filename () |
list files entry | |
bool | db5_index () |
index all columns | |
bool | db5_localfile (const char *filename, char *localfile, const size_t localfile_size) |
retrieve the local file name of a longname | |
bool | db5_longname_to_shortname (const char *longname, char *shortname, const size_t shortname_size) |
retrieve existing shortname from a longname | |
bool | db5_generate_row (const char *localfile, db5_row *row) |
generate a database entry for a file - you must use db5_widechar_row after this function | |
bool | db5_shortname_to_localfile (const char *shortname, char *localfile, const size_t localfile_size) |
complete the path of a short filename to get local filename (real path) | |
bool | db5_exists (const char *filename) |
test if a file is in database | |
uint32_t | db5_count () |
get the number of files return the number of files in database | |
void | db5_print_row (db5_row *row) |
print a database entry |
Header - Database db5.
Definition in file db5.h.
bool db5_delete | ( | const char * | filename | ) |
remove a file from database
filename | the virtual name - utf8 |
Definition at line 308 of file db5.c.
References add_log(), ADDLOG_FAIL, ADDLOG_RECOVER, check, db5_dat_delete_row(), db5_dat_select_by_filename(), db5_longname_to_shortname(), DB5_ROW_NOT_FOUND, log_dump(), log_dump_latin1(), membersizeof, and names_delete().
Referenced by fuse_impl_rename(), and fuse_impl_unlink().
bool db5_exists | ( | const char * | filename | ) |
test if a file is in database
filename | file to check in database - utf8 |
Definition at line 479 of file db5.c.
References add_log(), ADDLOG_DEBUG, check, db5_longname_to_shortname(), and membersizeof.
Referenced by fuse_impl_create(), and fuse_impl_rename().
bool db5_generate_row | ( | const char * | localfile, | |
db5_row * | row | |||
) |
generate a database entry for a file - you must use db5_widechar_row after this function
localfile | file to generate database entry - utf8 | |
row | where database entry is stored |
Definition at line 73 of file db5.c.
References add_log(), ADDLOG_DUMP, ADDLOG_FAIL, ADDLOG_RECOVER, db5_row::album, db5_row::artist, asf_generate_row(), check, CONFIG_ASF_EXT, CONFIG_DEFAULT_ALBUM, CONFIG_DEFAULT_ARTIST, CONFIG_DEFAULT_GENRE, CONFIG_DEFAULT_TITLE, CONFIG_MPEG_EXT, file_exists(), file_path_explode(), file_windows_slashes(), db5_row::filename, db5_row::filepath, db5_row::genre, log_dump(), log_dump_latin1(), membersizeof, mp3_generate_row(), db5_row::title, and utf8_iso8859().
Referenced by db5_insert(), and db5_update().
bool db5_index | ( | ) |
index all columns
Definition at line 357 of file db5.c.
References add_log(), ADDLOG_RECOVER, DB5_IDX_CODE_ALBUM, DB5_IDX_CODE_ARTIST, DB5_IDX_CODE_DEV, DB5_IDX_CODE_FILENAME, DB5_IDX_CODE_FILEPATH, DB5_IDX_CODE_GENRE, DB5_IDX_CODE_SOURCE, DB5_IDX_CODE_TITLE, DB5_IDX_CODE_TRACK, and db5_index_col.
Referenced by fuse_impl_destroy().
bool db5_init | ( | ) |
open database
Definition at line 28 of file db5.c.
References db5_dat_free(), db5_dat_init(), db5_hdr_free(), db5_hdr_init(), and names_init().
Referenced by fuse_impl_init().
bool db5_insert | ( | const char * | filename | ) |
add a file in database
filename | the virtual name - utf8 |
Definition at line 194 of file db5.c.
References add_log(), ADDLOG_DUMP, ADDLOG_FAIL, check, db5_dat_insert(), db5_dat_select_by_filename(), db5_generate_row(), DB5_ROW_NOT_FOUND, db5_shortname_to_localfile(), db5_widechar_row(), db5_row::hidden, log_dump(), log_dump_latin1(), membersizeof, names_insert(), names_select_shortname(), and utf8_iso8859().
Referenced by fuse_impl_create(), and fuse_impl_rename().
bool db5_localfile | ( | const char * | filename, | |
char * | localfile, | |||
const size_t | localfile_size | |||
) |
retrieve the local file name of a longname
filename | longname to convert to local filename - utf8 | |
localfile | buffer where result is returned - utf8 | |
localfile_size | size of localfile |
Definition at line 382 of file db5.c.
References add_log(), ADDLOG_USER_ERROR, check, db5_longname_to_shortname(), db5_shortname_to_localfile(), and membersizeof.
Referenced by fuse_impl_create(), fuse_impl_getattr(), fuse_impl_open(), fuse_impl_rename(), fuse_impl_truncate(), fuse_impl_unlink(), and fuse_impl_utimens().
bool db5_longname_to_shortname | ( | const char * | longname, | |
char * | shortname, | |||
const size_t | shortname_size | |||
) |
retrieve existing shortname from a longname
longname | the filename to resolve in shortname - utf8 | |
shortname | buffer where shortname will be stored - latin1 | |
shortname_size | of shortname |
Definition at line 402 of file db5.c.
References add_log(), ADDLOG_DUMP, ADDLOG_FAIL, ADDLOG_USER_ERROR, check, db5_dat_select_by_filename(), DB5_ROW_NOT_FOUND, log_dump(), log_dump_latin1(), names_generate_shortname(), names_select_shortname(), and utf8_iso8859().
Referenced by db5_delete(), db5_exists(), db5_localfile(), and db5_update().
void db5_print_row | ( | db5_row * | row | ) |
print a database entry
row | the row to print |
Definition at line 503 of file db5.c.
References add_log(), ADDLOG_DUMP, db5_row::album, db5_row::artist, db5_row::bitrate, check, db5_row::duration, db5_row::filename, db5_row::filepath, db5_row::filesize, db5_row::genre, log_dump_latin1(), names_select_longname(), db5_row::samplerate, db5_row::source, db5_row::title, db5_row::track, and db5_row::year.
char** db5_select_filename | ( | ) |
list files entry
Definition at line 139 of file db5.c.
References add_log(), ADDLOG_CRITICAL, ADDLOG_DEBUG, ADDLOG_DUMP, ADDLOG_FAIL, db5_dat_select_row(), db5_hdr_count(), db5_unwidechar_row(), db5_row::filename, iso8859_utf8(), and names_select_longname().
Referenced by fuse_impl_readdir().
bool db5_shortname_to_localfile | ( | const char * | shortname, | |
char * | localfile, | |||
const size_t | localfile_size | |||
) |
complete the path of a short filename to get local filename (real path)
shortname | the filename to complete path - latin1 | |
localfile | buffer where localfile will be stored - utf8 | |
localfile_size | of localfile |
Definition at line 455 of file db5.c.
References add_log(), ADDLOG_DUMP, ADDLOG_FAIL, check, CONFIG_MUSIC_PATH, iso8859_utf8(), log_dump(), and log_dump_latin1().
Referenced by db5_insert(), db5_localfile(), and db5_update().
void db5_unwidechar_row | ( | db5_row * | entry | ) |
convert all strings of an entry to char
entry | to use/edit |
Definition at line 61 of file db5.c.
References db5_row::album, db5_row::artist, check, db5_row::filename, db5_row::filepath, db5_row::genre, membersizeof, db5_row::title, and ws_wstoa().
Referenced by db5_select_filename().
bool db5_update | ( | const char * | filename | ) |
update file information in database
filename | the virtual name - utf8 |
Definition at line 254 of file db5.c.
References add_log(), ADDLOG_DUMP, ADDLOG_FAIL, check, db5_dat_select_by_filename(), db5_dat_update(), db5_generate_row(), db5_longname_to_shortname(), DB5_ROW_NOT_FOUND, db5_shortname_to_localfile(), db5_widechar_row(), db5_row::hidden, log_dump(), log_dump_latin1(), and membersizeof.
Referenced by fuse_impl_flush(), and fuse_impl_rename().
void db5_widechar_row | ( | db5_row * | entry | ) |
convert all strings of an entry to wide char
entry | to store |
Definition at line 49 of file db5.c.
References db5_row::album, db5_row::artist, check, db5_row::filename, db5_row::filepath, db5_row::genre, membersizeof, db5_row::title, and ws_atows().
Referenced by db5_insert(), and db5_update().