1 Commits

Author SHA1 Message Date
davidskrundz c2fb43de30 Improve date formats 2025-11-08 23:01:46 -07:00
12 changed files with 72 additions and 72 deletions
Generated
+6 -6
View File
@@ -578,7 +578,7 @@ checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127"
[[package]] [[package]]
name = "flix" name = "flix"
version = "0.0.14" version = "0.0.15"
dependencies = [ dependencies = [
"flix-db", "flix-db",
"flix-fs", "flix-fs",
@@ -588,7 +588,7 @@ dependencies = [
[[package]] [[package]]
name = "flix-cli" name = "flix-cli"
version = "0.0.14" version = "0.0.15"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@@ -605,7 +605,7 @@ dependencies = [
[[package]] [[package]]
name = "flix-db" name = "flix-db"
version = "0.0.14" version = "0.0.15"
dependencies = [ dependencies = [
"chrono", "chrono",
"flix-model", "flix-model",
@@ -618,7 +618,7 @@ dependencies = [
[[package]] [[package]]
name = "flix-fs" name = "flix-fs"
version = "0.0.14" version = "0.0.15"
dependencies = [ dependencies = [
"async-stream", "async-stream",
"flix-model", "flix-model",
@@ -630,7 +630,7 @@ dependencies = [
[[package]] [[package]]
name = "flix-model" name = "flix-model"
version = "0.0.14" version = "0.0.15"
dependencies = [ dependencies = [
"seamantic", "seamantic",
"serde", "serde",
@@ -639,7 +639,7 @@ dependencies = [
[[package]] [[package]]
name = "flix-tmdb" name = "flix-tmdb"
version = "0.0.14" version = "0.0.15"
dependencies = [ dependencies = [
"chrono", "chrono",
"flix-model", "flix-model",
+6 -6
View File
@@ -35,12 +35,12 @@ overflow-checks = true
strip = "debuginfo" strip = "debuginfo"
[workspace.dependencies] [workspace.dependencies]
flix = { path = "crates/flix", version = "=0.0.14", default-features = false } flix = { path = "crates/flix", version = "=0.0.15", default-features = false }
flix-cli = { path = "crates/cli", version = "=0.0.14", default-features = false } flix-cli = { path = "crates/cli", version = "=0.0.15", default-features = false }
flix-db = { path = "crates/db", version = "=0.0.14", default-features = false } flix-db = { path = "crates/db", version = "=0.0.15", default-features = false }
flix-fs = { path = "crates/fs", version = "=0.0.14", default-features = false } flix-fs = { path = "crates/fs", version = "=0.0.15", default-features = false }
flix-model = { path = "crates/model", version = "=0.0.14", default-features = false } flix-model = { path = "crates/model", version = "=0.0.15", default-features = false }
flix-tmdb = { path = "crates/tmdb", version = "=0.0.14", default-features = false } flix-tmdb = { path = "crates/tmdb", version = "=0.0.15", default-features = false }
seamantic = { version = "0.0.10", default-features = false } seamantic = { version = "0.0.10", default-features = false }
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "flix-cli" name = "flix-cli"
version = "0.0.14" version = "0.0.15"
categories = ["command-line-utilities"] categories = ["command-line-utilities"]
description = "CLI for interacting with a flix database" description = "CLI for interacting with a flix database"
+8 -8
View File
@@ -49,7 +49,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
entity::tmdb::collections::ActiveModel { entity::tmdb::collections::ActiveModel {
tmdb_id: Set(id), tmdb_id: Set(id),
flix_id: Set(flix.id), flix_id: Set(flix.id),
last_update: Set(Utc::now().naive_utc().date()), last_update: Set(Utc::now()),
movie_count: Set(collection.movies.len().try_into().unwrap_or(0)), movie_count: Set(collection.movies.len().try_into().unwrap_or(0)),
} }
.insert(txn) .insert(txn)
@@ -99,7 +99,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
entity::tmdb::movies::ActiveModel { entity::tmdb::movies::ActiveModel {
tmdb_id: Set(id), tmdb_id: Set(id),
flix_id: Set(flix.id), flix_id: Set(flix.id),
last_update: Set(Utc::now().naive_utc().date()), last_update: Set(Utc::now()),
runtime: Set(movie.runtime.into()), runtime: Set(movie.runtime.into()),
collection_id: Set(movie.collection.map(|c| c.id)), collection_id: Set(movie.collection.map(|c| c.id)),
} }
@@ -198,7 +198,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
entity::tmdb::shows::ActiveModel { entity::tmdb::shows::ActiveModel {
tmdb_id: Set(id), tmdb_id: Set(id),
flix_id: Set(flix.id), flix_id: Set(flix.id),
last_update: Set(Utc::now().naive_utc().date()), last_update: Set(Utc::now()),
number_of_seasons: Set(show.number_of_seasons), number_of_seasons: Set(show.number_of_seasons),
} }
.insert(txn) .insert(txn)
@@ -220,7 +220,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
tmdb_season: Set(season.season_number), tmdb_season: Set(season.season_number),
flix_show: Set(flix.id), flix_show: Set(flix.id),
flix_season: Set(season.season_number), flix_season: Set(season.season_number),
last_update: Set(Utc::now().naive_utc().date()), last_update: Set(Utc::now()),
} }
.insert(txn) .insert(txn)
.await?; .await?;
@@ -246,7 +246,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
flix_show: Set(flix.id), flix_show: Set(flix.id),
flix_season: Set(season), flix_season: Set(season),
flix_episode: Set(episode.episode_number), flix_episode: Set(episode.episode_number),
last_update: Set(Utc::now().naive_utc().date()), last_update: Set(Utc::now()),
runtime: Set(episode.runtime.into()), runtime: Set(episode.runtime.into()),
} }
.insert(txn) .insert(txn)
@@ -338,7 +338,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
tmdb_season: Set(season_number), tmdb_season: Set(season_number),
flix_show: Set(show.flix_id), flix_show: Set(show.flix_id),
flix_season: Set(season_number), flix_season: Set(season_number),
last_update: Set(Utc::now().naive_utc().date()), last_update: Set(Utc::now()),
} }
.insert(txn) .insert(txn)
.await?; .await?;
@@ -362,7 +362,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
flix_show: Set(show.flix_id), flix_show: Set(show.flix_id),
flix_season: Set(season_number), flix_season: Set(season_number),
flix_episode: Set(episode.episode_number), flix_episode: Set(episode.episode_number),
last_update: Set(Utc::now().naive_utc().date()), last_update: Set(Utc::now()),
runtime: Set(episode.runtime.into()), runtime: Set(episode.runtime.into()),
} }
.insert(txn) .insert(txn)
@@ -453,7 +453,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
flix_show: Set(flix_id), flix_show: Set(flix_id),
flix_season: Set(season), flix_season: Set(season),
flix_episode: Set(episode_number), flix_episode: Set(episode_number),
last_update: Set(Utc::now().naive_utc().date()), last_update: Set(Utc::now()),
runtime: Set(episode.runtime.into()), runtime: Set(episode.runtime.into()),
} }
.insert(txn) .insert(txn)
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "flix-db" name = "flix-db"
version = "0.0.14" version = "0.0.15"
categories = [] categories = []
description = "Types for storing persistent data about media" description = "Types for storing persistent data about media"
+5 -5
View File
@@ -6,7 +6,7 @@ pub mod libraries {
use seamantic::model::path::PathBytes; use seamantic::model::path::PathBytes;
use chrono::NaiveDateTime; use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
/// The database representation of a library media folder /// The database representation of a library media folder
@@ -20,7 +20,7 @@ pub mod libraries {
/// The library's directory /// The library's directory
pub directory: PathBytes, pub directory: PathBytes,
/// The library's last scan data /// The library's last scan data
pub last_scan: Option<NaiveDateTime>, pub last_scan: Option<DateTime<Utc>>,
/// Collections that are part of this library /// Collections that are part of this library
#[sea_orm(has_many, on_update = "Cascade", on_delete = "Cascade")] #[sea_orm(has_many, on_update = "Cascade", on_delete = "Cascade")]
@@ -431,7 +431,7 @@ mod tests {
use flix_model::id::{CollectionId, LibraryId, MovieId, ShowId}; use flix_model::id::{CollectionId, LibraryId, MovieId, ShowId};
use chrono::{NaiveDate, NaiveDateTime, NaiveTime}; use chrono::NaiveDate;
use sea_orm::ActiveValue::{NotSet, Set}; use sea_orm::ActiveValue::{NotSet, Set};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
use sea_orm::sqlx::error::ErrorKind; use sea_orm::sqlx::error::ErrorKind;
@@ -471,7 +471,7 @@ mod tests {
assert_eq!(model.id, LibraryId::from_raw($id)); assert_eq!(model.id, LibraryId::from_raw($id));
assert_eq!(model.directory, Path::new(concat!("L Directory ", $id)).to_owned().into()); assert_eq!(model.directory, Path::new(concat!("L Directory ", $id)).to_owned().into());
assert_eq!(model.last_scan, noneable!(last_scan, NaiveDateTime::new(NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt"), NaiveTime::from_hms_opt(1, 1, 1).expect("from_yo_opt")) $(, $($skip),+)?)); assert_eq!(model.last_scan, noneable!(last_scan, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?));
}; };
($db:expr, $id:literal, $error:ident $(; $($skip:ident),+)?) => { ($db:expr, $id:literal, $error:ident $(; $($skip:ident),+)?) => {
let model = assert_library!(@insert, $db, $id $(; $($skip),+)?) let model = assert_library!(@insert, $db, $id $(; $($skip),+)?)
@@ -483,7 +483,7 @@ mod tests {
super::libraries::ActiveModel { super::libraries::ActiveModel {
id: notsettable!(id, LibraryId::from_raw($id) $(, $($skip),+)?), id: notsettable!(id, LibraryId::from_raw($id) $(, $($skip),+)?),
directory: notsettable!(directory, Path::new(concat!("L Directory ", $id)).to_owned().into() $(, $($skip),+)?), directory: notsettable!(directory, Path::new(concat!("L Directory ", $id)).to_owned().into() $(, $($skip),+)?),
last_scan: notsettable!(last_scan, Some(NaiveDateTime::new(NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt"), NaiveTime::from_hms_opt(1, 1, 1).expect("from_yo_opt"))) $(, $($skip),+)?), last_scan: notsettable!(last_scan, Some(NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc()) $(, $($skip),+)?),
}.insert($db).await }.insert($db).await
}; };
} }
+25 -25
View File
@@ -5,7 +5,7 @@ pub mod collections {
use flix_model::id::CollectionId as FlixId; use flix_model::id::CollectionId as FlixId;
use flix_tmdb::model::id::CollectionId; use flix_tmdb::model::id::CollectionId;
use chrono::NaiveDate; use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
use crate::entity; use crate::entity;
@@ -22,7 +22,7 @@ pub mod collections {
#[sea_orm(unique)] #[sea_orm(unique)]
pub flix_id: FlixId, pub flix_id: FlixId,
/// The date of the last update /// The date of the last update
pub last_update: NaiveDate, pub last_update: DateTime<Utc>,
/// The number of movies in the collection /// The number of movies in the collection
pub movie_count: u16, pub movie_count: u16,
@@ -44,7 +44,7 @@ pub mod movies {
use seamantic::model::duration::Seconds; use seamantic::model::duration::Seconds;
use chrono::NaiveDate; use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
use crate::entity; use crate::entity;
@@ -61,7 +61,7 @@ pub mod movies {
#[sea_orm(unique)] #[sea_orm(unique)]
pub flix_id: FlixId, pub flix_id: FlixId,
/// The date of the last update /// The date of the last update
pub last_update: NaiveDate, pub last_update: DateTime<Utc>,
/// The movie's runtime in seconds /// The movie's runtime in seconds
pub runtime: Seconds, pub runtime: Seconds,
/// The TMDB ID of the collection this movie belongs to /// The TMDB ID of the collection this movie belongs to
@@ -84,7 +84,7 @@ pub mod shows {
use flix_model::id::ShowId as FlixId; use flix_model::id::ShowId as FlixId;
use flix_tmdb::model::id::ShowId; use flix_tmdb::model::id::ShowId;
use chrono::NaiveDate; use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
use crate::entity; use crate::entity;
@@ -101,7 +101,7 @@ pub mod shows {
#[sea_orm(unique)] #[sea_orm(unique)]
pub flix_id: FlixId, pub flix_id: FlixId,
/// The movie's runtime in seconds /// The movie's runtime in seconds
pub last_update: NaiveDate, pub last_update: DateTime<Utc>,
/// The number of seasons the show has /// The number of seasons the show has
pub number_of_seasons: u32, pub number_of_seasons: u32,
@@ -125,7 +125,7 @@ pub mod seasons {
use flix_model::numbers::SeasonNumber; use flix_model::numbers::SeasonNumber;
use flix_tmdb::model::id::ShowId; use flix_tmdb::model::id::ShowId;
use chrono::NaiveDate; use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
use crate::entity; use crate::entity;
@@ -148,7 +148,7 @@ pub mod seasons {
#[sea_orm(unique_key = "flix")] #[sea_orm(unique_key = "flix")]
pub flix_season: SeasonNumber, pub flix_season: SeasonNumber,
/// The date of the last update /// The date of the last update
pub last_update: NaiveDate, pub last_update: DateTime<Utc>,
/// The show this season belongs to /// The show this season belongs to
#[sea_orm(belongs_to, from = "tmdb_show", to = "tmdb_id")] #[sea_orm(belongs_to, from = "tmdb_show", to = "tmdb_id")]
@@ -172,7 +172,7 @@ pub mod episodes {
use flix_tmdb::model::id::ShowId; use flix_tmdb::model::id::ShowId;
use seamantic::model::duration::Seconds; use seamantic::model::duration::Seconds;
use chrono::NaiveDate; use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
use crate::entity; use crate::entity;
@@ -201,7 +201,7 @@ pub mod episodes {
#[sea_orm(unique_key = "flix")] #[sea_orm(unique_key = "flix")]
pub flix_episode: EpisodeNumber, pub flix_episode: EpisodeNumber,
/// The date of the last update /// The date of the last update
pub last_update: NaiveDate, pub last_update: DateTime<Utc>,
/// The episode's runtime in seconds /// The episode's runtime in seconds
pub runtime: Seconds, pub runtime: Seconds,
@@ -235,7 +235,7 @@ pub mod test {
$crate::entity::tmdb::collections::ActiveModel { $crate::entity::tmdb::collections::ActiveModel {
tmdb_id: Set(::flix_tmdb::model::id::CollectionId::from_raw($id)), tmdb_id: Set(::flix_tmdb::model::id::CollectionId::from_raw($id)),
flix_id: Set(::flix_model::id::CollectionId::from_raw($flix_id)), flix_id: Set(::flix_model::id::CollectionId::from_raw($flix_id)),
last_update: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")), last_update: Set(::chrono::Utc::now()),
movie_count: Set(::core::default::Default::default()), movie_count: Set(::core::default::Default::default()),
} }
.insert($db) .insert($db)
@@ -250,7 +250,7 @@ pub mod test {
$crate::entity::tmdb::movies::ActiveModel { $crate::entity::tmdb::movies::ActiveModel {
tmdb_id: Set(::flix_tmdb::model::id::MovieId::from_raw($id)), tmdb_id: Set(::flix_tmdb::model::id::MovieId::from_raw($id)),
flix_id: Set(::flix_model::id::MovieId::from_raw($flix_id)), flix_id: Set(::flix_model::id::MovieId::from_raw($flix_id)),
last_update: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")), last_update: Set(::chrono::Utc::now()),
runtime: Set(::core::default::Default::default()), runtime: Set(::core::default::Default::default()),
collection_id: Set(None), collection_id: Set(None),
} }
@@ -266,7 +266,7 @@ pub mod test {
$crate::entity::tmdb::shows::ActiveModel { $crate::entity::tmdb::shows::ActiveModel {
tmdb_id: Set(::flix_tmdb::model::id::ShowId::from_raw($id)), tmdb_id: Set(::flix_tmdb::model::id::ShowId::from_raw($id)),
flix_id: Set(::flix_model::id::ShowId::from_raw($flix_id)), flix_id: Set(::flix_model::id::ShowId::from_raw($flix_id)),
last_update: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")), last_update: Set(::chrono::Utc::now()),
number_of_seasons: Set(::core::default::Default::default()), number_of_seasons: Set(::core::default::Default::default()),
} }
.insert($db) .insert($db)
@@ -283,7 +283,7 @@ pub mod test {
tmdb_season: Set($season), tmdb_season: Set($season),
flix_show: Set(::flix_model::id::ShowId::from_raw($flix_show)), flix_show: Set(::flix_model::id::ShowId::from_raw($flix_show)),
flix_season: Set($flix_season), flix_season: Set($flix_season),
last_update: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")), last_update: Set(::chrono::Utc::now()),
} }
.insert($db) .insert($db)
.await .await
@@ -301,7 +301,7 @@ pub mod test {
flix_show: Set(::flix_model::id::ShowId::from_raw($flix_show)), flix_show: Set(::flix_model::id::ShowId::from_raw($flix_show)),
flix_season: Set($flix_season), flix_season: Set($flix_season),
flix_episode: Set($flix_episode), flix_episode: Set($flix_episode),
last_update: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")), last_update: Set(::chrono::Utc::now()),
runtime: Set(::core::default::Default::default()), runtime: Set(::core::default::Default::default()),
} }
.insert($db) .insert($db)
@@ -365,7 +365,7 @@ mod tests {
assert_eq!(model.tmdb_id, TmdbCollectionId::from_raw($tid)); assert_eq!(model.tmdb_id, TmdbCollectionId::from_raw($tid));
assert_eq!(model.flix_id, CollectionId::from_raw($id)); assert_eq!(model.flix_id, CollectionId::from_raw($id));
assert_eq!(model.last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt")); assert_eq!(model.last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
assert_eq!(model.movie_count, $id); assert_eq!(model.movie_count, $id);
}; };
($db:expr, $id:literal, $tid:literal, $error:ident $(; $($skip:ident),+)?) => { ($db:expr, $id:literal, $tid:literal, $error:ident $(; $($skip:ident),+)?) => {
@@ -378,7 +378,7 @@ mod tests {
super::collections::ActiveModel { super::collections::ActiveModel {
tmdb_id: notsettable!(tmdb_id, TmdbCollectionId::from_raw($tid) $(, $($skip),+)?), tmdb_id: notsettable!(tmdb_id, TmdbCollectionId::from_raw($tid) $(, $($skip),+)?),
flix_id: notsettable!(flix_id, CollectionId::from_raw($id) $(, $($skip),+)?), flix_id: notsettable!(flix_id, CollectionId::from_raw($id) $(, $($skip),+)?),
last_update: notsettable!(last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt") $(, $($skip),+)?), last_update: notsettable!(last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
movie_count: notsettable!(movie_count, $id $(, $($skip),+)?), movie_count: notsettable!(movie_count, $id $(, $($skip),+)?),
}.insert($db).await }.insert($db).await
}; };
@@ -412,7 +412,7 @@ mod tests {
assert_eq!(model.tmdb_id, TmdbMovieId::from_raw($tid)); assert_eq!(model.tmdb_id, TmdbMovieId::from_raw($tid));
assert_eq!(model.flix_id, MovieId::from_raw($id)); assert_eq!(model.flix_id, MovieId::from_raw($id));
assert_eq!(model.last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt")); assert_eq!(model.last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
assert_eq!(model.runtime, Duration::from_secs($tid).into()); assert_eq!(model.runtime, Duration::from_secs($tid).into());
assert_eq!(model.collection_id, $cid.map(TmdbCollectionId::from_raw)); assert_eq!(model.collection_id, $cid.map(TmdbCollectionId::from_raw));
}; };
@@ -426,7 +426,7 @@ mod tests {
super::movies::ActiveModel { super::movies::ActiveModel {
tmdb_id: notsettable!(tmdb_id, TmdbMovieId::from_raw($tid) $(, $($skip),+)?), tmdb_id: notsettable!(tmdb_id, TmdbMovieId::from_raw($tid) $(, $($skip),+)?),
flix_id: notsettable!(flix_id, MovieId::from_raw($id) $(, $($skip),+)?), flix_id: notsettable!(flix_id, MovieId::from_raw($id) $(, $($skip),+)?),
last_update: notsettable!(last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt") $(, $($skip),+)?), last_update: notsettable!(last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
runtime: notsettable!(runtime, Duration::from_secs($tid).into() $(, $($skip),+)?), runtime: notsettable!(runtime, Duration::from_secs($tid).into() $(, $($skip),+)?),
collection_id: notsettable!(collection_id, $cid.map(TmdbCollectionId::from_raw) $(, $($skip),+)?), collection_id: notsettable!(collection_id, $cid.map(TmdbCollectionId::from_raw) $(, $($skip),+)?),
}.insert($db).await }.insert($db).await
@@ -465,7 +465,7 @@ mod tests {
assert_eq!(model.tmdb_id, TmdbShowId::from_raw($tid)); assert_eq!(model.tmdb_id, TmdbShowId::from_raw($tid));
assert_eq!(model.flix_id, ShowId::from_raw($id)); assert_eq!(model.flix_id, ShowId::from_raw($id));
assert_eq!(model.last_update, NaiveDate::from_yo_opt(2000, $tid).expect("NaiveDate::from_yo_opt")); assert_eq!(model.last_update, NaiveDate::from_yo_opt($tid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
assert_eq!(model.number_of_seasons, $id); assert_eq!(model.number_of_seasons, $id);
}; };
($db:expr, $id:literal, $tid:literal, $error:ident $(; $($skip:ident),+)?) => { ($db:expr, $id:literal, $tid:literal, $error:ident $(; $($skip:ident),+)?) => {
@@ -481,7 +481,7 @@ mod tests {
super::shows::ActiveModel { super::shows::ActiveModel {
tmdb_id: notsettable!(tmdb_id, TmdbShowId::from_raw($tid) $(, $($skip),+)?), tmdb_id: notsettable!(tmdb_id, TmdbShowId::from_raw($tid) $(, $($skip),+)?),
flix_id: notsettable!(flix_id, ShowId::from_raw($id) $(, $($skip),+)?), flix_id: notsettable!(flix_id, ShowId::from_raw($id) $(, $($skip),+)?),
last_update: notsettable!(last_update, NaiveDate::from_yo_opt(2000, $tid).expect("NaiveDate::from_yo_opt") $(, $($skip),+)?), last_update: notsettable!(last_update, NaiveDate::from_yo_opt($tid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
number_of_seasons: notsettable!(number_of_seasons, $id $(, $($skip),+)?), number_of_seasons: notsettable!(number_of_seasons, $id $(, $($skip),+)?),
}.insert($db).await }.insert($db).await
}; };
@@ -517,7 +517,7 @@ mod tests {
assert_eq!(model.tmdb_season, $tseason); assert_eq!(model.tmdb_season, $tseason);
assert_eq!(model.flix_show, ShowId::from_raw($show)); assert_eq!(model.flix_show, ShowId::from_raw($show));
assert_eq!(model.flix_season, $season); assert_eq!(model.flix_season, $season);
assert_eq!(model.last_update, NaiveDate::from_yo_opt(2000, $tshow).expect("NaiveDate::from_yo_opt")); assert_eq!(model.last_update, NaiveDate::from_yo_opt($tshow, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
}; };
($db:expr, $show:literal, $season:literal, $tshow:literal, $tseason:literal, $error:ident $(; $($skip:ident),+)?) => { ($db:expr, $show:literal, $season:literal, $tshow:literal, $tseason:literal, $error:ident $(; $($skip:ident),+)?) => {
let model = assert_season!(@insert, $db, $show, $season, $tshow, $tseason $(; $($skip),+)?) let model = assert_season!(@insert, $db, $show, $season, $tshow, $tseason $(; $($skip),+)?)
@@ -534,7 +534,7 @@ mod tests {
tmdb_season: notsettable!(tmdb_season, $tseason $(, $($skip),+)?), tmdb_season: notsettable!(tmdb_season, $tseason $(, $($skip),+)?),
flix_show: notsettable!(flix_show, ShowId::from_raw($show) $(, $($skip),+)?), flix_show: notsettable!(flix_show, ShowId::from_raw($show) $(, $($skip),+)?),
flix_season: notsettable!(flix_season, $season $(, $($skip),+)?), flix_season: notsettable!(flix_season, $season $(, $($skip),+)?),
last_update: notsettable!(last_update, NaiveDate::from_yo_opt(2000, $tshow).expect("NaiveDate::from_yo_opt") $(, $($skip),+)?), last_update: notsettable!(last_update, NaiveDate::from_yo_opt($tshow, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
}.insert($db).await }.insert($db).await
}; };
} }
@@ -574,7 +574,7 @@ mod tests {
assert_eq!(model.flix_show, ShowId::from_raw($show)); assert_eq!(model.flix_show, ShowId::from_raw($show));
assert_eq!(model.flix_season, $season); assert_eq!(model.flix_season, $season);
assert_eq!(model.flix_episode, $episode); assert_eq!(model.flix_episode, $episode);
assert_eq!(model.last_update, NaiveDate::from_yo_opt(2000, $tshow).expect("NaiveDate::from_yo_opt")); assert_eq!(model.last_update, NaiveDate::from_yo_opt($tshow, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
assert_eq!(model.runtime, Duration::from_secs($tshow).into()); assert_eq!(model.runtime, Duration::from_secs($tshow).into());
}; };
($db:expr, $show:literal, $season:literal, $episode:literal, $tshow:literal, $tseason:literal, $tepisode:literal, $error:ident $(; $($skip:ident),+)?) => { ($db:expr, $show:literal, $season:literal, $episode:literal, $tshow:literal, $tseason:literal, $tepisode:literal, $error:ident $(; $($skip:ident),+)?) => {
@@ -594,7 +594,7 @@ mod tests {
flix_show: notsettable!(flix_show, ShowId::from_raw($show) $(, $($skip),+)?), flix_show: notsettable!(flix_show, ShowId::from_raw($show) $(, $($skip),+)?),
flix_season: notsettable!(flix_season, $season $(, $($skip),+)?), flix_season: notsettable!(flix_season, $season $(, $($skip),+)?),
flix_episode: notsettable!(flix_episode, $episode $(, $($skip),+)?), flix_episode: notsettable!(flix_episode, $episode $(, $($skip),+)?),
last_update: notsettable!(last_update, NaiveDate::from_yo_opt(2000, $tshow).expect("NaiveDate::from_yo_opt") $(, $($skip),+)?), last_update: notsettable!(last_update, NaiveDate::from_yo_opt($tshow, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
runtime: notsettable!(runtime, Duration::from_secs($tshow).into() $(, $($skip),+)?), runtime: notsettable!(runtime, Duration::from_secs($tshow).into() $(, $($skip),+)?),
}.insert($db).await }.insert($db).await
}; };
+16 -16
View File
@@ -4,7 +4,7 @@
pub mod collections { pub mod collections {
use flix_model::id::{CollectionId, RawId}; use flix_model::id::{CollectionId, RawId};
use chrono::NaiveDate; use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
use crate::entity; use crate::entity;
@@ -21,7 +21,7 @@ pub mod collections {
#[sea_orm(primary_key, auto_increment = false)] #[sea_orm(primary_key, auto_increment = false)]
pub user_id: RawId, pub user_id: RawId,
/// The date this collection was watched /// The date this collection was watched
pub watched_date: NaiveDate, pub watched_date: DateTime<Utc>,
/// The info for this collection /// The info for this collection
#[sea_orm(belongs_to, relation_enum = "Info", from = "id", to = "id")] #[sea_orm(belongs_to, relation_enum = "Info", from = "id", to = "id")]
@@ -38,7 +38,7 @@ pub mod collections {
pub mod movies { pub mod movies {
use flix_model::id::{MovieId, RawId}; use flix_model::id::{MovieId, RawId};
use chrono::NaiveDate; use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
use crate::entity; use crate::entity;
@@ -55,7 +55,7 @@ pub mod movies {
#[sea_orm(primary_key, auto_increment = false)] #[sea_orm(primary_key, auto_increment = false)]
pub user_id: RawId, pub user_id: RawId,
/// The date this movie was watched /// The date this movie was watched
pub watched_date: NaiveDate, pub watched_date: DateTime<Utc>,
/// The info for this movie /// The info for this movie
#[sea_orm(belongs_to, from = "id", to = "id")] #[sea_orm(belongs_to, from = "id", to = "id")]
@@ -72,7 +72,7 @@ pub mod movies {
pub mod shows { pub mod shows {
use flix_model::id::{RawId, ShowId}; use flix_model::id::{RawId, ShowId};
use chrono::NaiveDate; use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
use crate::entity; use crate::entity;
@@ -89,7 +89,7 @@ pub mod shows {
#[sea_orm(primary_key, auto_increment = false)] #[sea_orm(primary_key, auto_increment = false)]
pub user_id: RawId, pub user_id: RawId,
/// The date this show was watched /// The date this show was watched
pub watched_date: NaiveDate, pub watched_date: DateTime<Utc>,
/// The info for this show /// The info for this show
#[sea_orm(belongs_to, relation_enum = "Info", from = "id", to = "id")] #[sea_orm(belongs_to, relation_enum = "Info", from = "id", to = "id")]
@@ -107,7 +107,7 @@ pub mod seasons {
use flix_model::id::{RawId, ShowId}; use flix_model::id::{RawId, ShowId};
use flix_model::numbers::SeasonNumber; use flix_model::numbers::SeasonNumber;
use chrono::NaiveDate; use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
use crate::entity; use crate::entity;
@@ -127,7 +127,7 @@ pub mod seasons {
#[sea_orm(primary_key, auto_increment = false)] #[sea_orm(primary_key, auto_increment = false)]
pub user_id: RawId, pub user_id: RawId,
/// The date this season was watched /// The date this season was watched
pub watched_date: NaiveDate, pub watched_date: DateTime<Utc>,
/// The info for this season /// The info for this season
#[sea_orm( #[sea_orm(
@@ -156,7 +156,7 @@ pub mod episodes {
use flix_model::id::{RawId, ShowId}; use flix_model::id::{RawId, ShowId};
use flix_model::numbers::{EpisodeNumber, SeasonNumber}; use flix_model::numbers::{EpisodeNumber, SeasonNumber};
use chrono::NaiveDate; use chrono::{DateTime, Utc};
use sea_orm::entity::prelude::*; use sea_orm::entity::prelude::*;
use crate::entity; use crate::entity;
@@ -179,7 +179,7 @@ pub mod episodes {
#[sea_orm(primary_key, auto_increment = false)] #[sea_orm(primary_key, auto_increment = false)]
pub user_id: RawId, pub user_id: RawId,
/// The date this episode was watched /// The date this episode was watched
pub watched_date: NaiveDate, pub watched_date: DateTime<Utc>,
/// The info for this episode /// The info for this episode
#[sea_orm( #[sea_orm(
@@ -211,7 +211,7 @@ pub mod test {
$crate::entity::watched::movies::ActiveModel { $crate::entity::watched::movies::ActiveModel {
id: Set(::flix_model::id::MovieId::from_raw($id)), id: Set(::flix_model::id::MovieId::from_raw($id)),
user_id: Set($user), user_id: Set($user),
watched_date: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")), watched_date: Set(::chrono::Utc::now()),
} }
.insert($db) .insert($db)
.await .await
@@ -227,7 +227,7 @@ pub mod test {
season_number: Set($season), season_number: Set($season),
episode_number: Set($episode), episode_number: Set($episode),
user_id: Set($user), user_id: Set($user),
watched_date: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")), watched_date: Set(::chrono::Utc::now()),
} }
.insert($db) .insert($db)
.await .await
@@ -284,7 +284,7 @@ mod tests {
assert_eq!(model.id, MovieId::from_raw($id)); assert_eq!(model.id, MovieId::from_raw($id));
assert_eq!(model.user_id, $uid); assert_eq!(model.user_id, $uid);
assert_eq!(model.watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt")); assert_eq!(model.watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
}; };
($db:expr, $id:literal, $uid:literal, $error:ident $(; $($skip:ident),+)?) => { ($db:expr, $id:literal, $uid:literal, $error:ident $(; $($skip:ident),+)?) => {
let model = assert_movie!(@insert, $db, $id, $uid $(; $($skip),+)?) let model = assert_movie!(@insert, $db, $id, $uid $(; $($skip),+)?)
@@ -296,7 +296,7 @@ mod tests {
super::movies::ActiveModel { super::movies::ActiveModel {
id: notsettable!(id, MovieId::from_raw($id) $(, $($skip),+)?), id: notsettable!(id, MovieId::from_raw($id) $(, $($skip),+)?),
user_id: notsettable!(user_id, $uid $(, $($skip),+)?), user_id: notsettable!(user_id, $uid $(, $($skip),+)?),
watched_date: notsettable!(watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt") $(, $($skip),+)?), watched_date: notsettable!(watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
}.insert($db).await }.insert($db).await
}; };
} }
@@ -329,7 +329,7 @@ mod tests {
assert_eq!(model.season_number, $season); assert_eq!(model.season_number, $season);
assert_eq!(model.episode_number, $episode); assert_eq!(model.episode_number, $episode);
assert_eq!(model.user_id, $uid); assert_eq!(model.user_id, $uid);
assert_eq!(model.watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt")); assert_eq!(model.watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
}; };
($db:expr, $show:literal, $season:literal, $episode:literal, $uid:literal, $error:ident $(; $($skip:ident),+)?) => { ($db:expr, $show:literal, $season:literal, $episode:literal, $uid:literal, $error:ident $(; $($skip:ident),+)?) => {
let model = assert_episode!(@insert, $db, $show, $season, $episode, $uid $(; $($skip),+)?) let model = assert_episode!(@insert, $db, $show, $season, $episode, $uid $(; $($skip),+)?)
@@ -343,7 +343,7 @@ mod tests {
season_number: notsettable!(season_number, $season $(, $($skip),+)?), season_number: notsettable!(season_number, $season $(, $($skip),+)?),
episode_number: notsettable!(episode_number, $episode $(, $($skip),+)?), episode_number: notsettable!(episode_number, $episode $(, $($skip),+)?),
user_id: notsettable!(user_id, $uid $(, $($skip),+)?), user_id: notsettable!(user_id, $uid $(, $($skip),+)?),
watched_date: notsettable!(watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt") $(, $($skip),+)?), watched_date: notsettable!(watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
}.insert($db).await }.insert($db).await
}; };
} }
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "flix" name = "flix"
version = "0.0.14" version = "0.0.15"
categories = [] categories = []
description = "Mechanisms for interacting with flix media" description = "Mechanisms for interacting with flix media"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "flix-fs" name = "flix-fs"
version = "0.0.14" version = "0.0.15"
categories = [] categories = []
description = "Filesystem scanner for flix media" description = "Filesystem scanner for flix media"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "flix-model" name = "flix-model"
version = "0.0.14" version = "0.0.15"
categories = [] categories = []
description = "Core types for flix data" description = "Core types for flix data"
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "flix-tmdb" name = "flix-tmdb"
version = "0.0.14" version = "0.0.15"
categories = [] categories = []
description = "Clients and models for fetching data from TMDB" description = "Clients and models for fetching data from TMDB"