2009-04-19 15:10:19 +02:00
|
|
|
|
|
|
|
#ifndef __FILESCANNER_H__
|
|
|
|
#define __FILESCANNER_H__
|
|
|
|
|
2009-06-07 18:58:02 +02:00
|
|
|
#include "db.h"
|
2009-04-19 15:10:19 +02:00
|
|
|
|
2013-08-14 23:40:55 +02:00
|
|
|
|
2017-10-15 15:43:48 +02:00
|
|
|
/* --------------------------- Actual scanners ---------------------------- */
|
|
|
|
|
2017-01-11 18:14:33 +01:00
|
|
|
int
|
2020-01-31 14:41:28 -08:00
|
|
|
scan_metadata_ffmpeg(struct media_file_info *mfi, const char *file);
|
2017-01-11 18:14:33 +01:00
|
|
|
|
2018-04-12 20:43:05 +02:00
|
|
|
void
|
2020-01-31 14:41:28 -08:00
|
|
|
scan_metadata_stream(struct media_file_info *mfi, const char *path);
|
2018-04-12 20:43:05 +02:00
|
|
|
|
2009-04-20 17:34:39 +02:00
|
|
|
void
|
2017-10-15 00:09:44 +02:00
|
|
|
scan_playlist(const char *file, time_t mtime, int dir_id);
|
2009-04-20 16:27:56 +02:00
|
|
|
|
2015-04-12 06:49:38 +02:00
|
|
|
void
|
2017-10-15 00:09:44 +02:00
|
|
|
scan_smartpl(const char *file, time_t mtime, int dir_id);
|
2015-04-12 06:49:38 +02:00
|
|
|
|
2009-11-22 11:17:33 +01:00
|
|
|
void
|
2017-10-15 23:02:20 +02:00
|
|
|
scan_itunes_itml(const char *file, time_t mtime, int dir_id);
|
2009-11-22 11:17:33 +01:00
|
|
|
|
2017-10-15 15:43:48 +02:00
|
|
|
|
|
|
|
/* ------------ Common utility functions used by the scanners ------------ */
|
|
|
|
|
|
|
|
/* Returns a pointer to the filename part of path.
|
|
|
|
*
|
|
|
|
* @in path the complete path
|
|
|
|
* @return pointer to filename
|
|
|
|
*/
|
2017-03-11 08:14:23 +01:00
|
|
|
const char *
|
|
|
|
filename_from_path(const char *path);
|
|
|
|
|
2024-06-11 23:25:56 +02:00
|
|
|
/* Sets a title (=filename without extension and path) from a path. Caller must
|
|
|
|
* free the result.
|
2017-10-15 15:43:48 +02:00
|
|
|
*
|
|
|
|
* @in path the complete path
|
2024-06-11 23:25:56 +02:00
|
|
|
* @return allocated title
|
2017-10-15 15:43:48 +02:00
|
|
|
*/
|
2017-08-09 18:21:00 +02:00
|
|
|
char *
|
2024-06-11 23:25:56 +02:00
|
|
|
title_from_path(const char *path);
|
2017-08-09 18:21:00 +02:00
|
|
|
|
2017-10-15 15:43:48 +02:00
|
|
|
/* Iterate up a file path.
|
|
|
|
*
|
|
|
|
* Example of three calls where path is '/foo/bar/file.mp3', and starting with
|
|
|
|
* current = NULL:
|
|
|
|
* ret = parent_dir(¤t, path) -> ret = 0, current = /bar/file.mp3
|
|
|
|
* ret = parent_dir(¤t, path) -> ret = 0, current = /foo/bar/file.mp3
|
|
|
|
* ret = parent_dir(¤t, path) -> ret = -1, current = /foo/bar/file.mp3
|
|
|
|
*
|
|
|
|
* @in/out current if the input pointer is not a null pointer, it will be moved
|
|
|
|
* one level up, otherwise it will be set to the point at the
|
|
|
|
* file's directory
|
|
|
|
* @in path the complete path
|
|
|
|
* @return 0 if parent dir found, otherwise -1
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
parent_dir(const char **current, const char *path);
|
|
|
|
|
2020-01-31 14:41:28 -08:00
|
|
|
/* Fills a playlist struct with default values based on path. The title will
|
|
|
|
* for instance be set to the base filename without file extension. Since
|
|
|
|
* the fields in the struct are alloc'ed, caller must free with free_pli().
|
|
|
|
*
|
|
|
|
* @out pli the playlist struct to be filled
|
|
|
|
* @in path the path to the playlist
|
|
|
|
* @return 0 if ok, negative on error
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
playlist_fill(struct playlist_info *pli, const char *path);
|
|
|
|
|
|
|
|
/* Adds a playlist to the database with the fields set by playlist_fill()
|
|
|
|
*
|
|
|
|
* @in path the path to the playlist
|
|
|
|
* @return the id of the playlist (pli->id), negative on error
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
playlist_add(const char *path);
|
|
|
|
|
2024-01-24 22:30:02 +00:00
|
|
|
|
|
|
|
/* --------------------------------- Other -------------------------------- */
|
|
|
|
|
|
|
|
int
|
|
|
|
write_metadata_ffmpeg(const struct media_file_info *mfi);
|
|
|
|
|
2009-04-19 15:10:19 +02:00
|
|
|
#endif /* !__FILESCANNER_H__ */
|