1
0
mirror of https://github.com/ElvishArtisan/rivendell.git synced 2025-04-22 16:59:24 +02:00

2014-10-25 Fred Gleason <fredg@paravelsystems.com>

* Implemented '--set-marker-fadedown=' and '--set-marker-fadeup*='
	options for rdimport(1) in 'utils/rdimport/markerset.cpp',,
	'utils/rdimport/markerset.h', 'utils/rdimport/rdimport.cpp' and
	'utils/rdimport/rdimport.h'.
This commit is contained in:
Fred Gleason 2014-10-25 18:42:18 -04:00
parent 42d3bb430a
commit 1afd09366c
6 changed files with 103 additions and 8 deletions

@ -14582,3 +14582,8 @@
options for rdimport(1) in 'utils/rdimport/markerset.cpp',, options for rdimport(1) in 'utils/rdimport/markerset.cpp',,
'utils/rdimport/markerset.h', 'utils/rdimport/rdimport.cpp' and 'utils/rdimport/markerset.h', 'utils/rdimport/rdimport.cpp' and
'utils/rdimport/rdimport.h'. 'utils/rdimport/rdimport.h'.
2014-10-25 Fred Gleason <fredg@paravelsystems.com>
* Implemented '--set-marker-fadedown=' and '--set-marker-fadeup*='
options for rdimport(1) in 'utils/rdimport/markerset.cpp',,
'utils/rdimport/markerset.h', 'utils/rdimport/rdimport.cpp' and
'utils/rdimport/rdimport.h'.

@ -20,53 +20,65 @@ list of filespecs to be read from standard input.
Add Scheduler Code <\fIstr\fP> to the target cart. The specified Add Scheduler Code <\fIstr\fP> to the target cart. The specified
code must exist in RDAdmin->SchedulerCodes. This option may be code must exist in RDAdmin->SchedulerCodes. This option may be
specified multiple times. specified multiple times.
.TP .TP
.B --autotrim-level=<level> .B --autotrim-level=<level>
Specify the threshold level to use for autotrimming the audio, in dBFS. Specify the threshold level to use for autotrimming the audio, in dBFS.
Specifying '0' will turn off autotrimming. Specifying '0' will turn off autotrimming.
.TP .TP
.B --cart-number-offset=<\fIoffset\fP> .B --cart-number-offset=<\fIoffset\fP>
Add <\fIoffset\fP> to the cart number as determined from metadata pattern Add <\fIoffset\fP> to the cart number as determined from metadata pattern
or --use-cartchunk-cutid. or --use-cartchunk-cutid.
.TP .TP
.B --create-enddate-offset=<\fIdays\fP> .B --create-enddate-offset=<\fIdays\fP>
If the imported file does not reference an end date, create with If the imported file does not reference an end date, create with
end date offset by <\fIdays\fP> days relative to the current date. end date offset by <\fIdays\fP> days relative to the current date.
Cannot be less than the value the value for \fB--create-startdate-offset\fP Cannot be less than the value the value for \fB--create-startdate-offset\fP
(default = 0). (default = 0).
.TP .TP
.B --create-startdate-offset=<\fIdays\fP> .B --create-startdate-offset=<\fIdays\fP>
If the imported file does not reference a start date, create with If the imported file does not reference a start date, create with
startdate offset by <\fIdays\fP> days relative to the current date. startdate offset by <\fIdays\fP> days relative to the current date.
Cannot be greater than the value for \fB--create-enddate-offset\fP Cannot be greater than the value for \fB--create-enddate-offset\fP
(default = 0). (default = 0).
.TP .TP
.B --delete-cuts .B --delete-cuts
Delete all cuts within the destination cart before importing. Use Delete all cuts within the destination cart before importing. Use
with caution! with caution!
.TP .TP
.B --delete-source .B --delete-source
Delete each source file after successful import. Use with caution! Delete each source file after successful import. Use with caution!
.TP .TP
.B --drop-box .B --drop-box
Operate in DropBox mode, causing \fIrdimport(1)\fP to run continuously, Operate in DropBox mode, causing \fIrdimport(1)\fP to run continuously,
periodically scanning for files matching the specified <\fIfilespec\fP>, periodically scanning for files matching the specified <\fIfilespec\fP>,
importing and then deleting them when found. WARNING: use of this option importing and then deleting them when found. WARNING: use of this option
also implies the \fB--delete-source\fP option! also implies the \fB--delete-source\fP option!
.TP .TP
.B --enddate-offset=<days> .B --enddate-offset=<days>
If the imported file references an end date, offset the value by <\fIdays\fP> If the imported file references an end date, offset the value by <\fIdays\fP>
days. days.
.TP .TP
.B --fix-broken-formats .B --fix-broken-formats
Attempt to work around malformed audio input data. Attempt to work around malformed audio input data.
.TP .TP
.B --help .B --help
Print a short usage message and exit. Print a short usage message and exit.
.TP .TP
.B --log-mode .B --log-mode
Prepend date/time information to each line of printed status (implies Prepend date/time information to each line of printed status (implies
the '--verbose' option). the '--verbose' option).
.TP .TP
.B --metadata-pattern=<\fIpattern\fP> .B --metadata-pattern=<\fIpattern\fP>
Attempt to read metadata parameters from the source filename, using Attempt to read metadata parameters from the source filename, using
@ -140,20 +152,25 @@ characters between macros. For example, the pattern '%t_%a_%g_%n.',
when processing a filename of 'My Song_My Artist_TEMP_123456.mp3', when processing a filename of 'My Song_My Artist_TEMP_123456.mp3',
would extract 'My Song' as the title and 'My Artist' as the artist, would extract 'My Song' as the title and 'My Artist' as the artist,
while importing it into cart 123456 in the TEMP group. while importing it into cart 123456 in the TEMP group.
.TP .TP
.B --normalization-level=<\fIlevel\fP> .B --normalization-level=<\fIlevel\fP>
Specify the level to use for peak normalizing the audio, in dBFS. Specify the level to use for peak normalizing the audio, in dBFS.
Specifying '0' will turn off normalization. Specifying '0' will turn off normalization.
.TP .TP
.B --segue-length=<\fIlength\fP> .B --segue-length=<\fIlength\fP>
Length of the added segue in msecs. See \fB--segue-level\fP below. Length of the added segue in msecs. See \fB--segue-level\fP below.
.TP .TP
.B --segue-level=<\fIlevel\fP> .B --segue-level=<\fIlevel\fP>
Specify the threshold level to use for setting the segue markers, in dBFS. Specify the threshold level to use for setting the segue markers, in dBFS.
Default action is not to create segue markers. Default action is not to create segue markers.
.TP .TP
.B --set-daypart-times=<\fIstart-time\fP>,<\fIend-time\fP> .B --set-daypart-times=<\fIstart-time\fP>,<\fIend-time\fP>
Set the start and end daypart times, in the format HHMMSS. Set the start and end daypart times, in the format HHMMSS.
.TP .TP
.B --set-marker-end-<\fImarker\fP>=<\fIoffset\fP> .B --set-marker-end-<\fImarker\fP>=<\fIoffset\fP>
Set an end marker to a given offset value. The <\fIoffset\fP> parameter is Set an end marker to a given offset value. The <\fIoffset\fP> parameter is
@ -179,27 +196,44 @@ The Talk markers.
.RE .RE
.RE .RE
.TP
.B --set-marker-fadedown=<\fIoffset\fP>
Set the FadeDown marker to a given offset value. See the discussion of the
\fB--set-marker-end-<marker>\fP option above for a description of the
<\fIoffset\fP> parameter.
.TP
.B --set-marker-fadeup=<\fIoffset\fP>
Set the FadeUp marker to a given offset value. See the discussion of the
\fB--set-marker-end-<marker>\fP option above for a description of the
<\fIoffset\fP> parameter.
.TP .TP
.B --set-marker-start-<\fImarker\fP>=<\fIoffset\fP> .B --set-marker-start-<\fImarker\fP>=<\fIoffset\fP>
Set a start marker to a given offset value. See the discussion of the Set a start marker to a given offset value. See the discussion of the
\fB--set-marker-end-<marker>\fP option above for a description of the \fB--set-marker-end-<marker>\fP option above for a description of the
<\fImarker\fP> and <\fIoffset\fP> parameters. <\fImarker\fP> and <\fIoffset\fP> parameters.
.TP .TP
.B --set-user-defined=<\fIstr\fP> .B --set-user-defined=<\fIstr\fP>
Set the User Defined field for the target cart to <\fIstr\fP>. This will Set the User Defined field for the target cart to <\fIstr\fP>. This will
override any value that might otherwise be set --e.g. by using the override any value that might otherwise be set --e.g. by using the
\fB--metadata-pattern\fP option. \fB--metadata-pattern\fP option.
.TP .TP
.B --single-cart .B --single-cart
If more than one file is imported, place them within multiple cuts within a If more than one file is imported, place them within multiple cuts within a
single cart, rather than creating separate carts for each file. single cart, rather than creating separate carts for each file.
.TP .TP
.B --startdate-offset=<\fIdays\fP> .B --startdate-offset=<\fIdays\fP>
If the imported file references a start date, offset the value by <\fIdays\fP> If the imported file references a start date, offset the value by <\fIdays\fP>
days. days.
.TP .TP
.B --title-from-cartchunk-cutid .B --title-from-cartchunk-cutid
Set the cart title from CartChunk CutID. Set the cart title from CartChunk CutID.
.TP .TP
.B --to-cart=<\fIcartnum\fP> .B --to-cart=<\fIcartnum\fP>
Specify the cart to import the audio into, rather than using the next Specify the cart to import the audio into, rather than using the next
@ -207,15 +241,18 @@ available cart number for the group. If the cart does not exist, it will
be created. Each file will be imported into a separate new cut within the be created. Each file will be imported into a separate new cut within the
cart. Use of this option implies the \fB--single-cart\fP option as well, cart. Use of this option implies the \fB--single-cart\fP option as well,
and is mutually exclusive with the \fB--use-cartchunk-cutid\fP option. and is mutually exclusive with the \fB--use-cartchunk-cutid\fP option.
.TP .TP
.B --use-cartchunk-cutid .B --use-cartchunk-cutid
Import the audio into the cart specified by the CartChunk CutID parameter Import the audio into the cart specified by the CartChunk CutID parameter
associated with the file. If the cart does not exist, it will be associated with the file. If the cart does not exist, it will be
created. Use of this option is mutually exclusive with the \fB--to-cart\fP created. Use of this option is mutually exclusive with the \fB--to-cart\fP
option. option.
.TP .TP
.B --verbose .B --verbose
Print progress messages during processing. Print progress messages during processing.
.TP .TP
.B --version .B --version
Output version information and exit. Output version information and exit.

@ -29,6 +29,8 @@ MarkerSet::MarkerSet()
marker_start_value=0; marker_start_value=0;
marker_end_valid=false; marker_end_valid=false;
marker_end_value=0; marker_end_value=0;
marker_fade_valid=false;
marker_fade_value=0;
marker_audio_length=0; marker_audio_length=0;
} }
@ -41,7 +43,7 @@ bool MarkerSet::hasStartValue() const
int MarkerSet::startValue(int lo_limit,int hi_limit) const int MarkerSet::startValue(int lo_limit,int hi_limit) const
{ {
return LimitCheck(marker_start_value,lo_limit,hi_limit); return LimitCheck(FrontReference(marker_start_value),lo_limit,hi_limit);
} }
@ -53,11 +55,23 @@ bool MarkerSet::hasEndValue() const
int MarkerSet::endValue(int lo_limit,int hi_limit) const int MarkerSet::endValue(int lo_limit,int hi_limit) const
{ {
return LimitCheck(marker_end_value,lo_limit,hi_limit); return LimitCheck(FrontReference(marker_end_value),lo_limit,hi_limit);
} }
void MarkerSet::load(RDCmdSwitch *cmd,const QString &marker) bool MarkerSet::hasFadeValue() const
{
return marker_fade_valid;
}
int MarkerSet::fadeValue(int lo_limit,int hi_limit) const
{
return LimitCheck(FrontReference(marker_fade_value),lo_limit,hi_limit);
}
void MarkerSet::loadMarker(RDCmdSwitch *cmd,const QString &marker)
{ {
QString start_key="--set-marker-start-"+marker; QString start_key="--set-marker-start-"+marker;
QString end_key="--set-marker-end-"+marker; QString end_key="--set-marker-end-"+marker;
@ -89,6 +103,24 @@ void MarkerSet::load(RDCmdSwitch *cmd,const QString &marker)
} }
void MarkerSet::loadFade(RDCmdSwitch *cmd,const QString &marker)
{
QString key="--set-marker-"+marker;
marker_marker=marker;
for(unsigned i=0;i<cmd->keys();i++) {
if(cmd->key(i)==key) {
marker_fade_value=cmd->value(i).toInt(&marker_fade_valid);
if(!marker_fade_valid) {
fprintf(stderr,"rdimport: invalid argment to %s\n",
(const char *)key);
exit(255);
}
cmd->setProcessed(i,true);
}
}
}
void MarkerSet::setAudioLength(int msecs) void MarkerSet::setAudioLength(int msecs)
{ {
if(marker_start_valid&&(!marker_end_valid)) { if(marker_start_valid&&(!marker_end_valid)) {

@ -31,7 +31,10 @@ class MarkerSet
int startValue(int lo_limit=-1,int hi_limit=-1) const; int startValue(int lo_limit=-1,int hi_limit=-1) const;
bool hasEndValue() const; bool hasEndValue() const;
int endValue(int lo_limit=-1,int hi_limit=-1) const; int endValue(int lo_limit=-1,int hi_limit=-1) const;
void load(RDCmdSwitch *cmd,const QString &marker); bool hasFadeValue() const;
int fadeValue(int lo_limit=-1,int hi_limit=-1) const;
void loadMarker(RDCmdSwitch *cmd,const QString &marker);
void loadFade(RDCmdSwitch *cmd,const QString &marker);
void setAudioLength(int msecs); void setAudioLength(int msecs);
void dump(); void dump();
@ -43,6 +46,8 @@ class MarkerSet
int marker_start_value; int marker_start_value;
bool marker_end_valid; bool marker_end_valid;
int marker_end_value; int marker_end_value;
bool marker_fade_valid;
int marker_fade_value;
int marker_audio_length; int marker_audio_length;
}; };

@ -247,13 +247,17 @@ MainObject::MainObject(QObject *parent,const char *name)
} }
} }
import_cut_markers=new MarkerSet(); import_cut_markers=new MarkerSet();
import_cut_markers->load(import_cmd,"cut"); import_cut_markers->loadMarker(import_cmd,"cut");
import_talk_markers=new MarkerSet(); import_talk_markers=new MarkerSet();
import_talk_markers->load(import_cmd,"talk"); import_talk_markers->loadMarker(import_cmd,"talk");
import_hook_markers=new MarkerSet(); import_hook_markers=new MarkerSet();
import_hook_markers->load(import_cmd,"hook"); import_hook_markers->loadMarker(import_cmd,"hook");
import_segue_markers=new MarkerSet(); import_segue_markers=new MarkerSet();
import_segue_markers->load(import_cmd,"segue"); import_segue_markers->loadMarker(import_cmd,"segue");
import_fadedown_marker=new MarkerSet();
import_fadedown_marker->loadFade(import_cmd,"fadedown");
import_fadeup_marker=new MarkerSet();
import_fadeup_marker->loadFade(import_cmd,"fadeup");
// //
// Read Configuration // Read Configuration
@ -520,6 +524,8 @@ MainObject::MainObject(QObject *parent,const char *name)
import_talk_markers->dump(); import_talk_markers->dump();
import_hook_markers->dump(); import_hook_markers->dump();
import_segue_markers->dump(); import_segue_markers->dump();
import_fadedown_marker->dump();
import_fadeup_marker->dump();
printf(" Files to process:\n"); printf(" Files to process:\n");
for(unsigned i=import_file_key;i<import_cmd->keys();i++) { for(unsigned i=import_file_key;i<import_cmd->keys();i++) {
printf(" \"%s\"\n",(const char *)import_cmd->key(i)); printf(" \"%s\"\n",(const char *)import_cmd->key(i));
@ -1041,6 +1047,14 @@ MainObject::Result MainObject::ImportFile(const QString &filename,
cut->setSegueStartPoint(import_segue_markers->startValue(lo,hi)); cut->setSegueStartPoint(import_segue_markers->startValue(lo,hi));
cut->setSegueEndPoint(import_segue_markers->endValue(lo,hi)); cut->setSegueEndPoint(import_segue_markers->endValue(lo,hi));
} }
import_fadedown_marker->setAudioLength(wavefile->getExtTimeLength());
if(import_fadedown_marker->hasFadeValue()) {
cut->setFadedownPoint(import_fadedown_marker->fadeValue(lo,hi));
}
import_fadeup_marker->setAudioLength(wavefile->getExtTimeLength());
if(import_fadeup_marker->hasFadeValue()) {
cut->setFadeupPoint(import_fadeup_marker->fadeValue(lo,hi));
}
delete settings; delete settings;
delete conv; delete conv;
delete cut; delete cut;

@ -133,6 +133,8 @@ class MainObject : public QObject
MarkerSet *import_talk_markers; MarkerSet *import_talk_markers;
MarkerSet *import_hook_markers; MarkerSet *import_hook_markers;
MarkerSet *import_segue_markers; MarkerSet *import_segue_markers;
MarkerSet *import_fadedown_marker;
MarkerSet *import_fadeup_marker;
}; };