mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-20 01:50:26 -05:00
[library/filescanner/spotify] Add library source abstraction and new
"library" thread - Implement filescanner as a library_source - Add library source implementation for spotify - Move process_media_info to library with small adjustments: - Remove dependency to F_SCAN_TYPE defines - Pass data_kind as parameter - Pass media_kind and compilation as parameter if a source forces a specific value for these - Move declaration of scan_ffmpeg to library; add library_add_playlist_info to library
This commit is contained in:
98
src/library.h
Normal file
98
src/library.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
#include "db.h"
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
};
|
||||
|
||||
int
|
||||
scan_metadata_ffmpeg(const char *file, struct media_file_info *mfi);
|
||||
|
||||
|
||||
void
|
||||
library_process_media(const char *path, time_t mtime, off_t size, enum data_kind data_kind, enum media_kind force_media_kind, bool force_compilation, struct media_file_info *external_mfi, int dir_id);
|
||||
|
||||
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);
|
||||
|
||||
void
|
||||
library_rescan();
|
||||
|
||||
void
|
||||
library_fullrescan();
|
||||
|
||||
bool
|
||||
library_is_scanning();
|
||||
|
||||
void
|
||||
library_set_scanning(bool is_scanning);
|
||||
|
||||
bool
|
||||
library_is_exiting();
|
||||
|
||||
int
|
||||
library_init();
|
||||
|
||||
void
|
||||
library_deinit();
|
||||
|
||||
|
||||
#endif /* SRC_LIBRARY_H_ */
|
||||
Reference in New Issue
Block a user