Browse Source

Fixed some issues in the ident module.

experimental/bootyd
treyzania 5 years ago
parent
commit
fe8f2c6048
1 changed files with 10 additions and 10 deletions
  1. 10
    10
      core/ident.rs

+ 10
- 10
core/ident.rs View File

use std::path::Path;


/// Identifier for a particular movie or episode. Doesn't handle different /// Identifier for a particular movie or episode. Doesn't handle different
/// releases of movies or anything like that. /// releases of movies or anything like that.
name: String, name: String,


/// Year released, to disambiguate. /// Year released, to disambiguate.
year: String
year: String,
}, },


/// Episode of some TV show or anime. /// Episode of some TV show or anime.
Episode { Episode {
/// Name of the show. /// Name of the show.
name: String, name: String,
/// Some shows aren't released as seasons, often anime. /// Some shows aren't released as seasons, often anime.
season: Option<u32>, season: Option<u32>,


episode: u32, episode: u32,


/// What kind of TV is it? /// What kind of TV is it?
cat: TvCategory
}
cat: TvCategory,
},
} }


#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
Tv, Tv,


/// Anime, which often is categorized seperately. /// Anime, which often is categorized seperately.
Anime
Anime,
} }


/// Hint to provide to matching engine about content identity. /// Hint to provide to matching engine about content identity.
Season(String), Season(String),


/// Episode number, usually passed *with* a season, like "E11". /// Episode number, usually passed *with* a season, like "E11".
Episode(String)
Episode(String),
} }


/// Some kind of error that can happen when trying to identify a match. /// Some kind of error that can happen when trying to identify a match.
#[derive(Debug)] #[derive(Debug)]
enum MatchError {
pub enum MatchError {
/// No matches found. /// No matches found.
NoMatches, NoMatches,




/// File permissions error. /// File permissions error.
PermissionsError, PermissionsError,
/// In case they're using the wrong version of filebot. /// In case they're using the wrong version of filebot.
NonlibreError, NonlibreError,

} }


// TODO Decide what we want to be able to do with an engine. // TODO Decide what we want to be able to do with an engine.
trait MatchinEngine {
pub trait MatchingEngine {
fn identify(&self, path: &Path) -> Result<MediaId, MatchError>; fn identify(&self, path: &Path) -> Result<MediaId, MatchError>;
} }

Loading…
Cancel
Save