inc/db5.h File Reference

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

Detailed Description

Header - Database db5.

Author:
Julien Blitte
Version:
0.1

Definition in file db5.h.


Function Documentation

bool db5_delete ( const char *  filename  ) 

remove a file from database

Parameters:
filename the virtual name - utf8
Returns:
true if successfull

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

Parameters:
filename file to check in database - utf8
Returns:
true if file is in database

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

Parameters:
localfile file to generate database entry - utf8
row where database entry is stored
Returns:
true if successfull

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 (  ) 
bool db5_init (  ) 

open database

Returns:
true if successfull

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  ) 
bool db5_localfile ( const char *  filename,
char *  localfile,
const size_t  localfile_size 
)

retrieve the local file name of a longname

Parameters:
filename longname to convert to local filename - utf8
localfile buffer where result is returned - utf8
localfile_size size of localfile
Returns:
true if successfull

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

Parameters:
longname the filename to resolve in shortname - utf8
shortname buffer where shortname will be stored - latin1
shortname_size of shortname
Returns:
true if successfull

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  ) 
char** db5_select_filename (  ) 

list files entry

Returns:
a NULL terminated array to all virutal filenames - utf8

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)

Parameters:
shortname the filename to complete path - latin1
localfile buffer where localfile will be stored - utf8
localfile_size of localfile
Returns:
true if successfull

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

Parameters:
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

Parameters:
filename the virtual name - utf8
Returns:
true if successfull

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

Parameters:
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().

 All Classes Files Functions Variables Typedefs Defines

Generated on Mon Jan 11 00:15:07 2010 for db5fuse by  doxygen 1.6.1