aboutsummaryrefslogtreecommitdiff
path: root/import/src/plugins/mod.rs
blob: 47fcfbf8184d2311db6c8fb10bbc0b7cac75db18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2025 metamuffin <metamuffin.org>
*/
pub mod acoustid;
pub mod infojson;
pub mod musicbrainz;
pub mod tags;
pub mod tmdb;
pub mod trakt;
pub mod vgmdb;
pub mod wikidata;
pub mod wikimedia_commons;
pub mod media_info;
pub mod misc;

use std::path::Path;

use anyhow::Result;
use jellycommon::NodeID;
use jellydb::Database;
use jellyremuxer::matroska::Segment;
use tokio::runtime::Handle;

pub struct ImportContext {
    pub db: Database,
    pub rt: Handle,
}

pub trait ImportPlugin {
    fn file(&self, ct: &ImportContext, parent: NodeID, path: &Path) -> Result<()> {
        let _ = (ct, parent, path);
        Ok(())
    }
    fn media(&self, ct: &ImportContext, node: NodeID, path: &Path, seg: &Segment) -> Result<()> {
        let _ = (ct, node, path, seg);
        Ok(())
    }
    fn import_instruction(&self, ct: &ImportContext, node: NodeID, line: &str) -> Result<()> {
        let _ = (ct, node, line);
        Ok(())
    }
    fn process_node(&self, ct: &ImportContext, node: NodeID) -> Result<()> {
        let _ = (ct, node);
        Ok(())
    }
}