@@ -2,6 +2,7 @@ use super::{CURRENT_PROJECT_VERSION, filters::*, metadata::*};
22use crate :: {
33 Error , Result ,
44 filters:: traits:: SubtitleEntry ,
5+ media:: playlist:: Playlist ,
56 tracks:: {
67 audio_track:: AudioTrack ,
78 manager:: Manager ,
@@ -23,6 +24,7 @@ pub struct ProjectFile {
2324 pub modified_at : DateTime < Utc > ,
2425 pub duration_secs : f64 ,
2526 pub tracks : Vec < TrackData > ,
27+ pub playlist : Playlist ,
2628 #[ serde( default ) ]
2729 pub preview_config : ProjectPreviewConfig ,
2830}
@@ -223,6 +225,7 @@ impl From<&Manager> for ProjectFile {
223225 duration_secs : manager. duration . as_secs_f64 ( ) ,
224226 tracks : manager. tracks . iter ( ) . map ( |t| t. into ( ) ) . collect ( ) ,
225227 preview_config : ProjectPreviewConfig :: default ( ) ,
228+ playlist : Playlist :: new ( "Default" . to_string ( ) ) ,
226229 }
227230 }
228231}
@@ -445,6 +448,7 @@ pub struct ManagerData {
445448 pub version : u32 ,
446449 pub created_at : DateTime < Utc > ,
447450 pub preview_config : ProjectPreviewConfig ,
451+ pub playlist : Playlist ,
448452 pub inner : Option < Manager > ,
449453}
450454
@@ -454,6 +458,7 @@ impl ManagerData {
454458 version : CURRENT_PROJECT_VERSION ,
455459 created_at : chrono:: Utc :: now ( ) ,
456460 preview_config : ProjectPreviewConfig :: default ( ) ,
461+ playlist : Playlist :: new ( "Default" . to_string ( ) ) ,
457462 inner : Some ( manager) ,
458463 }
459464 }
@@ -462,6 +467,11 @@ impl ManagerData {
462467 self . preview_config = config;
463468 self
464469 }
470+
471+ pub fn with_playlist ( mut self , playlist : Playlist ) -> Self {
472+ self . playlist = playlist;
473+ self
474+ }
465475}
466476
467477impl TryFrom < & ProjectFile > for ManagerData {
@@ -487,6 +497,7 @@ impl TryFrom<&ProjectFile> for ManagerData {
487497 version : file. version ,
488498 created_at : file. created_at ,
489499 preview_config : file. preview_config . clone ( ) ,
500+ playlist : file. playlist . clone ( ) ,
490501 inner : Some ( manager) ,
491502 } ;
492503
@@ -523,6 +534,7 @@ pub fn save_project<P: AsRef<Path>>(manager_data: &ManagerData, path: P) -> Resu
523534 let mut project_file = ProjectFile :: from ( manager) ;
524535 project_file. created_at = manager_data. created_at ;
525536 project_file. preview_config = manager_data. preview_config . clone ( ) ;
537+ project_file. playlist = manager_data. playlist . clone ( ) ;
526538 let json = serde_json:: to_string_pretty ( & project_file) ?;
527539
528540 fs:: write ( & path, json) ?;
0 commit comments