2016-12-31 01:28:18 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Christian Meffert <christian.meffert@googlemail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SRC_LIBRARY_H_
|
|
|
|
#define SRC_LIBRARY_H_
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
2017-01-04 14:27:55 -05:00
|
|
|
#include "commands.h"
|
2016-12-31 01:28:18 -05:00
|
|
|
#include "db.h"
|
|
|
|
|
2017-03-13 15:03:25 -04:00
|
|
|
#define LIBRARY_OK 0
|
|
|
|
#define LIBRARY_ERROR -1
|
|
|
|
#define LIBRARY_PATH_INVALID -2
|
2017-02-18 00:55:51 -05:00
|
|
|
|
2016-12-31 01:28:18 -05:00
|
|
|
/*
|
|
|
|
* Definition of a library source
|
|
|
|
*
|
|
|
|
* A library source is responsible for scanning items into the library db.
|
|
|
|
*/
|
|
|
|
struct library_source
|
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
int disabled;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize library source (called from the main thread)
|
|
|
|
*/
|
|
|
|
int (*init)(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Shutdown library source (called from the main thread after
|
|
|
|
* terminating the library thread)
|
|
|
|
*/
|
|
|
|
void (*deinit)(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Run initial scan after startup (called from the library thread)
|
|
|
|
*/
|
|
|
|
int (*initscan)(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Run rescan (called from the library thread)
|
|
|
|
*/
|
|
|
|
int (*rescan)(void);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Run a full rescan (purge library entries and rescan) (called from the library thread)
|
|
|
|
*/
|
|
|
|
int (*fullrescan)(void);
|
|
|
|
|
2017-08-09 12:19:20 -04:00
|
|
|
/*
|
|
|
|
* Save queue as a new playlist under the given virtual path
|
|
|
|
*/
|
|
|
|
int (*playlist_add)(const char *vp_playlist, const char *vp_item);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Removes the playlist under the given virtual path
|
|
|
|
*/
|
|
|
|
int (*playlist_remove)(const char *virtual_path);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Save queue as a new playlist under the given virtual path
|
|
|
|
*/
|
|
|
|
int (*queue_save)(const char *virtual_path);
|
2016-12-31 01:28:18 -05:00
|
|
|
|
2018-03-09 13:03:43 -05:00
|
|
|
/*
|
|
|
|
* Add item for the given path to the current queue
|
|
|
|
*/
|
2018-11-10 01:41:36 -05:00
|
|
|
int (*queue_add)(const char *path, int position, char reshuffle, uint32_t item_id, int *count, int *new_item_id);
|
2018-03-09 13:03:43 -05:00
|
|
|
};
|
2016-12-31 01:28:18 -05:00
|
|
|
|
|
|
|
void
|
2017-02-12 10:03:01 -05:00
|
|
|
library_add_media(struct media_file_info *mfi);
|
2016-12-31 01:28:18 -05:00
|
|
|
|
|
|
|
int
|
|
|
|
library_add_playlist_info(const char *path, const char *title, const char *virtual_path, enum pl_type type, int parent_pl_id, int dir_id);
|
|
|
|
|
2017-02-18 00:55:51 -05:00
|
|
|
int
|
2018-10-13 02:30:41 -04:00
|
|
|
library_queue_add(const char *path, int position, int *count, int *new_item_id);
|
2017-02-18 00:55:51 -05:00
|
|
|
|
2016-12-31 01:28:18 -05:00
|
|
|
void
|
|
|
|
library_rescan();
|
|
|
|
|
|
|
|
void
|
|
|
|
library_fullrescan();
|
|
|
|
|
|
|
|
bool
|
|
|
|
library_is_scanning();
|
|
|
|
|
|
|
|
void
|
|
|
|
library_set_scanning(bool is_scanning);
|
|
|
|
|
|
|
|
bool
|
|
|
|
library_is_exiting();
|
|
|
|
|
2017-01-27 17:23:25 -05:00
|
|
|
void
|
2017-12-09 11:12:13 -05:00
|
|
|
library_update_trigger(short update_events);
|
2017-01-27 17:23:25 -05:00
|
|
|
|
2017-08-09 12:19:20 -04:00
|
|
|
int
|
|
|
|
library_playlist_add(const char *vp_playlist, const char *vp_item);
|
|
|
|
|
|
|
|
int
|
|
|
|
library_playlist_remove(char *virtual_path);
|
|
|
|
|
|
|
|
int
|
|
|
|
library_queue_save(char *path);
|
|
|
|
|
2017-01-04 14:27:55 -05:00
|
|
|
int
|
|
|
|
library_exec_async(command_function func, void *arg);
|
|
|
|
|
2016-12-31 01:28:18 -05:00
|
|
|
int
|
|
|
|
library_init();
|
|
|
|
|
|
|
|
void
|
|
|
|
library_deinit();
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* SRC_LIBRARY_H_ */
|