flix_fs/scanner/
mod.rs

1//! This module contains all of the filesystem scanner modules
2//!
3//! The most common scanner to use is [generic::Scanner] which will
4//! automatically detect and use the appropriate scanner.
5
6use flix_model::id::{CollectionId, MovieId, ShowId};
7use flix_model::numbers::{EpisodeNumbers, SeasonNumber};
8
9pub mod library;
10
11pub mod generic;
12
13pub mod collection;
14
15pub mod movie;
16
17pub mod episode;
18pub mod season;
19pub mod show;
20
21/// A reference to a piece of media
22#[derive(Debug, Clone)]
23pub enum MediaRef<ID> {
24	/// An explicit ID
25	Id(ID),
26	/// A filesystem slug
27	Slug(String),
28}
29
30/// A scanned collection
31#[derive(Debug)]
32pub struct CollectionScan {
33	/// The ID of the parent collection (if any)
34	pub parent_ref: Option<MediaRef<CollectionId>>,
35	/// The ID of the collection
36	pub id_ref: MediaRef<CollectionId>,
37	/// The file name of the poster file
38	pub poster_file_name: Option<String>,
39}
40
41/// A scanned movie
42#[derive(Debug)]
43pub struct MovieScan {
44	/// The ID of the parent collection (if any)
45	pub parent_ref: Option<MediaRef<CollectionId>>,
46	/// The ID of the movie
47	pub id_ref: MediaRef<MovieId>,
48	/// The file name of the media file
49	pub media_file_name: String,
50	/// The file name of the poster file
51	pub poster_file_name: Option<String>,
52}
53
54/// A scanned show
55#[derive(Debug)]
56pub struct ShowScan {
57	/// The ID of the parent collection (if any)
58	pub parent_ref: Option<MediaRef<CollectionId>>,
59	/// The ID of the show
60	pub id_ref: MediaRef<ShowId>,
61	/// The file name of the poster file
62	pub poster_file_name: Option<String>,
63}
64
65/// A scanned season
66#[derive(Debug)]
67pub struct SeasonScan {
68	/// The ID of the show this season belongs to
69	pub show_ref: MediaRef<ShowId>,
70	/// The season this episode belongs to
71	pub season: SeasonNumber,
72	/// The file name of the poster file
73	pub poster_file_name: Option<String>,
74}
75
76/// A scanned episode
77#[derive(Debug)]
78pub struct EpisodeScan {
79	/// The ID of the show this episode belongs to
80	pub show_ref: MediaRef<ShowId>,
81	/// The season this episode belongs to
82	pub season: SeasonNumber,
83	/// The number(s) of this episode
84	pub episode: EpisodeNumbers,
85	/// The file name of the media file
86	pub media_file_name: String,
87	/// The file name of the poster file
88	pub poster_file_name: Option<String>,
89}