Playlist with multiple, mixed items
Prior to this commit, projects/playlists were limited to folders even if file URLs were passed as arguments. With this commit both files and folders are added to projects from the command line. This doesn't affect opening a file from the GUI yet, but this patch implements the required plumbing for that as well.
This commit is contained in:
parent
3fd8641df2
commit
701fc818f7
2 changed files with 71 additions and 7 deletions
|
|
@ -8,8 +8,10 @@ use url::Url;
|
|||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Arguments {
|
||||
/// URLs to play with associated metadata
|
||||
pub urls: Vec<Url>,
|
||||
/// Files or directory URLs to play
|
||||
pub urls: Option<Vec<Url>>,
|
||||
/// Single URL only
|
||||
pub url_opt: Option<Url>,
|
||||
}
|
||||
|
||||
impl Arguments {
|
||||
|
|
@ -31,7 +33,17 @@ impl Arguments {
|
|||
warn!("Unused argument: {arg:?}");
|
||||
}
|
||||
|
||||
Ok(Arguments { urls })
|
||||
if urls.len() > 1 {
|
||||
Ok(Arguments {
|
||||
urls: Some(urls),
|
||||
..Default::default()
|
||||
})
|
||||
} else {
|
||||
Ok(Arguments {
|
||||
url_opt: urls.into_iter().next(),
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue