Explicitly specify sqlite columns, remove video_file_path for now
This commit is contained in:
parent
ce70725b60
commit
c14d2ab6f1
2 changed files with 9 additions and 6 deletions
|
@ -14,7 +14,6 @@ pub struct Collection {
|
|||
pub release_date : String , // TODO: Switch to chrono types, I think rusqlite has crate option for it
|
||||
pub runtime_minutes : u32 ,
|
||||
pub poster_file_path : Option <PathBuf> ,
|
||||
pub video_file_path : Option <PathBuf> ,
|
||||
}
|
||||
|
||||
# [ derive (Clone) ] pub struct Series {
|
||||
|
|
|
@ -21,12 +21,19 @@ pub async fn get_collection_from_file () -> Result <Collection> {
|
|||
|
||||
let collection = sqlite_client . conn ( |sqlite_connection| {
|
||||
let films = sqlite_connection
|
||||
. prepare ("select * from films order by release_date desc") ?
|
||||
. prepare ( "
|
||||
select uuid , name , original_name , release_date , runtime_minutes , poster_file_path
|
||||
from films
|
||||
order by release_date desc
|
||||
" ) ?
|
||||
. query (()) ?
|
||||
. map (row_to_film)
|
||||
. collect () ? ;
|
||||
let series = sqlite_connection
|
||||
. prepare ("select * from series") ?
|
||||
. prepare ( "
|
||||
select uuid , name , original_name , poster_file_path
|
||||
from series
|
||||
" ) ?
|
||||
. query (()) ?
|
||||
. map (row_to_series)
|
||||
. collect () ? ;
|
||||
|
@ -44,8 +51,6 @@ fn row_to_film ( row : & Row ) -> rusqlite :: Result <Film> {
|
|||
let runtime_minutes = row . get (4) ? ;
|
||||
let poster_file_path = row . get :: < _ , Option <String> > (5) ?
|
||||
. map ( PathBuf :: from ) ;
|
||||
let video_file_path = row . get :: < _ , Option <String> > (6) ?
|
||||
. map ( PathBuf :: from ) ;
|
||||
|
||||
Ok ( Film {
|
||||
uuid ,
|
||||
|
@ -54,7 +59,6 @@ fn row_to_film ( row : & Row ) -> rusqlite :: Result <Film> {
|
|||
release_date ,
|
||||
runtime_minutes ,
|
||||
poster_file_path ,
|
||||
video_file_path ,
|
||||
} )
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue