Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dominic_render_video
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
videoag
dominic_render_video
Commits
703cf9c0
Verified
Commit
703cf9c0
authored
8 months ago
by
Dorian Koch
Browse files
Options
Downloads
Patches
Plain Diff
Make preset parameter optional
parent
57050709
Branches
Branches containing commit
Tags
240926-1
No related merge requests found
Pipeline
#6469
passed
8 months ago
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main.rs
+9
-5
9 additions, 5 deletions
src/main.rs
src/project.rs
+5
-0
5 additions, 0 deletions
src/project.rs
with
14 additions
and
5 deletions
src/main.rs
+
9
−
5
View file @
703cf9c0
...
...
@@ -22,7 +22,7 @@ struct Args {
/// The preset of the lecture. Can be a toml file or a known course slug.
#[clap(short,
long)]
preset
:
String
,
preset
:
Option
<
String
>
,
#[cfg(feature
=
"mem_limit"
)]
/// The memory limit for external tools like ffmpeg.
...
...
@@ -55,14 +55,16 @@ fn main() {
// process arguments
let
directory
=
args
.directory
.canonicalize_utf8
()
.unwrap
();
let
preset
=
Preset
::
find
(
&
args
.preset
)
.unwrap
();
let
course
=
preset
.course
;
// let's see if we need to initialise the project
let
project_path
=
directory
.join
(
"project.toml"
);
let
mut
project
=
if
project_path
.exists
()
{
toml
::
from_slice
(
&
fs
::
read
(
&
project_path
)
.unwrap
())
.unwrap
()
}
else
{
assert!
(
args
.preset
.is_some
());
let
preset
=
Preset
::
find
(
&
args
.preset
.unwrap
())
.unwrap
();
let
course
=
preset
.course
;
let
dirname
=
directory
.file_name
()
.unwrap
();
let
date
=
parse_date
(
dirname
)
.expect
(
"Directory name is not in the expected format"
);
...
...
@@ -112,6 +114,8 @@ fn main() {
stereo
:
args
.stereo
,
start
:
None
,
end
:
None
,
transcode_lowest
:
args
.transcode
.or
(
preset
.transcode
),
transcode_highest
:
args
.transcode_start
.unwrap_or
(
preset
.transcode_start
),
fast
:
Vec
::
new
(),
questions
:
Vec
::
new
(),
metadata
:
None
...
...
@@ -214,10 +218,10 @@ fn main() {
});
// rescale the video
if
let
Some
(
lowest_res
)
=
args
.transcode
.or
(
preset
.transcode
)
{
if
let
Some
(
lowest_res
)
=
project
.source
.transcode
_lowest
{
for
res
in
Resolution
::
STANDARD_RESOLUTIONS
.into_iter
()
.rev
()
{
if
res
>
project
.source.metadata
.as_ref
()
.unwrap
()
.source_res
||
res
>
args
.transcode_start
.unwrap_or
(
preset
.transcode_
start
)
||
res
>
project
.source
.transcode_
highest
||
res
<
lowest_res
{
continue
;
...
...
This diff is collapsed.
Click to expand it.
src/project.rs
+
5
−
0
View file @
703cf9c0
...
...
@@ -150,6 +150,11 @@ pub struct ProjectSource {
#[serde_as(as
=
"Option<DisplayFromStr>"
)]
pub
end
:
Option
<
Time
>
,
#[serde_as(as
=
"Option<DisplayFromStr>"
)]
pub
transcode_lowest
:
Option
<
Resolution
>
,
#[serde_as(as
=
"DisplayFromStr"
)]
pub
transcode_highest
:
Resolution
,
#[serde(default)]
#[serde_as(as
=
"Vec<(DisplayFromStr, DisplayFromStr)>"
)]
pub
fast
:
Vec
<
(
Time
,
Time
)
>
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment