|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- use std::path::Path;
-
- /// Identifier for a particular movie or episode. Doesn't handle different
- /// releases of movies or anything like that.
- #[derive(Clone, Eq, PartialEq, Hash, Debug)]
- pub enum MediaId {
- Movie {
- /// Name of the movie.
- name: String,
-
- /// Year released, to disambiguate.
- year: String,
- },
-
- /// Episode of some TV show or anime.
- Episode {
- /// Name of the show.
- name: String,
-
- /// Some shows aren't released as seasons, often anime.
- season: Option<u32>,
-
- /// Episode with the season, or overall of no seasons.
- episode: u32,
-
- /// What kind of TV is it?
- cat: TvCategory,
- },
- }
-
- #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub enum TvCategory {
- /// Regular TV, typically western but mostly everything else.
- Tv,
-
- /// Anime, which often is categorized seperately.
- Anime,
- }
-
- /// Hint to provide to matching engine about content identity.
- #[derive(Clone, Eq, PartialEq, Hash, Debug)]
- pub enum IdHint {
- /// Name of thing, like "Inception", or "Game of Thrones".
- Name(String),
-
- /// Year released, usually for movies, like "2010".
- Year(String),
-
- /// Season of a show, like "S06".
- Season(String),
-
- /// Episode number, usually passed *with* a season, like "E11".
- Episode(String),
- }
-
- /// Some kind of error that can happen when trying to identify a match.
- #[derive(Debug)]
- pub enum MatchError {
- /// No matches found.
- NoMatches,
-
- /// Muliple matches for the file, should handle accordingly.
- Multiple(Vec<MediaId>),
-
- /// Error with the network.
- NetworkError,
-
- /// File permissions error.
- PermissionsError,
-
- /// In case they're using the wrong version of filebot.
- NonlibreError,
- }
-
- // TODO Decide what we want to be able to do with an engine.
- pub trait MatchingEngine {
- fn identify(&self, path: &Path) -> Result<MediaId, MatchError>;
- }
|