From f59921c2f8522be9484e836c43ab9117e04819c8 Mon Sep 17 00:00:00 2001 From: Wouter Verhelst Date: Sun, 2 Feb 2025 20:35:25 +0100 Subject: [PATCH] Allow uploads in the syncing state --- lib/SReview/Config/Common.pm | 3 +++ scripts/sreview-upload | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/SReview/Config/Common.pm b/lib/SReview/Config/Common.pm index 95151f6..ad835f2 100644 --- a/lib/SReview/Config/Common.pm +++ b/lib/SReview/Config/Common.pm @@ -146,7 +146,10 @@ sub setup { # Values for upload script $config->define('upload_actions', 'An array of commands to run on each file to be uploaded. Each component is passed through Mojo::Template before processing. To avoid quoting issues, it is a two-dimensional array, so that no shell will be called to run this.', [['echo', '<%== $file %>', 'ready for upload']]); $config->define('remove_actions', 'An array of commands to run on each file to be removed, when final review determines that the file needs to be reprocessed. Same format as upload_actions', [['echo', '<%== $file %>', 'ready for removal']]); + $config->define('sync_extensions', 'An array of extensions of files to sync'); + $config->define('sync_actions', 'An array of commands to run on each file to be synced. Each component is passed through Mojo::Template before processing. To avoid quoting issues, it is a two-dimensional array, so that no shell will be called to run this.', [['echo', '<%== $file %>', 'ready for sync']]); $config->define('cleanup', 'Whether to remove files after they have been published. Possible values: "all" (removes all files), "previews" (removes the output of sreview-cut, but not that of sreview-transcode), and "output" (removes the output of sreview-transcode, but not the output of sreview-cut). Other values will not remove files', 'none'); + # for sreview-copy $config->define('extra_collections', 'A hash of extra collection basenames. Can be used by sreview-copy.', undef); diff --git a/scripts/sreview-upload b/scripts/sreview-upload index 7c7f589..194dabc 100644 --- a/scripts/sreview-upload +++ b/scripts/sreview-upload @@ -93,8 +93,18 @@ if($configprefix eq "upload" && ($config->get('cleanup') eq "all" || $config->ge } } -foreach my $profile(@{$config->get('output_profiles')}) { - my $basename = join('.', $talkdata->{slug}, Media::Convert::Asset::ProfileFactory->create($profile, $raw_file, $config->get('extra_profiles'))->exten()); +my $exts = []; + +if($configprefix ne "sync") { + foreach my $profile(@{$config->get('output_profiles')}) { + push @$exts, Media::Convert::Asset::ProfileFactory->create($profile, $raw_file, $config->get('extra_profiles'))->exten(); + } +} else { + $exts = $config->get('sync_extensions'); +} + +foreach my $ext(@$exts) { + my $basename = join('.', $talkdata->{slug}, $ext); my $file = $output_coll->get_file(relname => join('/', $reldir, $basename)); run_command($file->valid_path_filename, $file->relname, $file->basepath); if($config->get('cleanup') eq "all" || $config->get('cleanup') eq 'output') {