aboutsummaryrefslogtreecommitdiff
path: root/import/src/plugins/mod.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-12-10 16:21:38 +0100
committermetamuffin <metamuffin@disroot.org>2025-12-10 16:21:38 +0100
commita0cfd77b4d19c43a28c4d82072e6ff136e336af3 (patch)
tree05df9f5faa54cef0ae4136fffddea57fbbafee6b /import/src/plugins/mod.rs
parent242d5763d451eed2402be7afde50cd9fa0d6bc79 (diff)
downloadjellything-a0cfd77b4d19c43a28c4d82072e6ff136e336af3.tar
jellything-a0cfd77b4d19c43a28c4d82072e6ff136e336af3.tar.bz2
jellything-a0cfd77b4d19c43a28c4d82072e6ff136e336af3.tar.zst
refactor import plugins part 1
Diffstat (limited to 'import/src/plugins/mod.rs')
-rw-r--r--import/src/plugins/mod.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/import/src/plugins/mod.rs b/import/src/plugins/mod.rs
new file mode 100644
index 0000000..47fcfbf
--- /dev/null
+++ b/import/src/plugins/mod.rs
@@ -0,0 +1,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(())
+ }
+}