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

* Implemented '--set-datetimes' option for rdimport(1) in
	'utils/rdimport/rdimport.cpp' and 'utils/rdimport/rdimport.h'.
This commit is contained in:
Fred Gleason 2014-10-26 16:39:57 -04:00
parent c6b756fcad
commit 0091c531d4
4 changed files with 93 additions and 9 deletions

View File

@ -14597,3 +14597,6 @@
* Implemented '--set-string-description' and '--set-string-outcue'
options for rdimport(1) in 'utils/rdimport/rdimport.cpp' and
'utils/rdimport/rdimport.h'.
2014-10-26 Fred Gleason <fredg@paravelsystems.com>
* Implemented '--set-datetimes' option for rdimport(1) in
'utils/rdimport/rdimport.cpp' and 'utils/rdimport/rdimport.h'.

View File

@ -167,9 +167,13 @@ Length of the added segue in msecs. See \fB--segue-level\fP below.
Specify the threshold level to use for setting the segue markers, in dBFS.
Default action is not to create segue markers.
.TP
.B --set-datetimes=<\fIstart-datetime\fP>,<\fIend-datetime\fP>
Set the cut start and end datetimes, in the format YYYYMMDD-HHMMSS.
.TP
.B --set-daypart-times=<\fIstart-time\fP>,<\fIend-time\fP>
Set the start and end daypart times, in the format HHMMSS.
Set the cut start and end daypart times, in the format HHMMSS.
.TP
.B --set-marker-end-<\fImarker\fP>=<\fIoffset\fP>
@ -223,45 +227,59 @@ for <\fIfield\fP> are:
.TP
.B agency
Agency Name
.TP
.B album
Album Name
.TP
.B artist
Artist Name
.TP
.B bpm
Beats per Minute (integer numeric)
.TP
.B client
Client Name
.TP
.B composer
Music Composer Name
.TP
.B description
Cut Description
.TP
.B outcue
Cut Outcue
.TP
.B conductor
Conductor Name
.TP
.B publisher
Music Publisher (rights holder)
.B description
Cut Description
.TP
.B label
Record Label Name (rights holder)
.TP
.B outcue
Cut Outcue
.TP
.B publisher
Music Publisher (rights holder)
.TP
.B song-id
Song ID
.TP
.B title
Title
.TP
.B user-defined
Miscelaneous Information
.TP
.B year
Year Released (four digit numeric)

View File

@ -164,6 +164,58 @@ MainObject::MainObject(QObject *parent,const char *name)
exit(256);
}
}
if(import_cmd->key(i)=="--set-datetimes") {
QStringList f0=QStringList().split(",",import_cmd->value(i));
if(f0.size()!=2) {
fprintf(stderr,"rdimport: invalid argument to --set-datetimes\n");
exit(256);
}
for(unsigned j=0;j<2;j++) {
if((f0[j].length()!=15)||(f0[j].mid(8,1)!="-")) {
fprintf(stderr,"rdimport: invalid argument to --set-datetimes\n");
exit(256);
}
unsigned year=f0[j].left(4).toUInt(&ok);
if(!ok) {
fprintf(stderr,"rdimport: invalid year argument to --set-datetimes\n");
exit(256);
}
unsigned month=f0[j].mid(4,2).toUInt(&ok);
if((!ok)||(month>12)) {
fprintf(stderr,"rdimport: invalid month argument to --set-datetimes\n");
exit(256);
}
unsigned day=f0[j].mid(6,2).toUInt(&ok);
if((!ok)||(day>31)) {
fprintf(stderr,"rdimport: invalid day argument to --set-datetimes\n");
exit(256);
}
unsigned hour=f0[j].mid(9,2).toUInt(&ok);
if((!ok)||(hour>23)) {
fprintf(stderr,"rdimport: invalid hour argument to --set-datetimes\n");
exit(256);
}
unsigned min=f0[j].mid(11,2).toUInt(&ok);
if((!ok)||(min>59)) {
fprintf(stderr,"rdimport: invalid minute argument to --set-datetimes\n");
exit(256);
}
unsigned sec=f0[j].right(2).toUInt(&ok);
if((!ok)||(sec>59)) {
fprintf(stderr,"rdimport: invalid seconds argument to --set-datetimes\n");
exit(256);
}
import_datetimes[j]=QDateTime(QDate(year,month,day),
QTime(hour,min,sec));
if(!import_datetimes[j].isValid()) {
fprintf(stderr,"rdimport: invalid argument to --set-datetimes\n");
}
}
if(import_datetimes[0]>=import_datetimes[1]) {
fprintf(stderr,"rdimport: datetime cannot end before it begins\n");
exit(256);
}
}
if(import_cmd->key(i)=="--set-daypart-times") {
QStringList f0=QStringList().split(",",import_cmd->value(i));
if(f0.size()!=2) {
@ -577,6 +629,12 @@ MainObject::MainObject(QObject *parent,const char *name)
printf(" End Daypart = %s\n",
(const char *)import_dayparts[1].toString("hh:mm:ss"));
}
if((!import_datetimes[0].isNull())||(!import_datetimes[1].isNull())) {
printf(" Start DateTime = %s\n",
(const char *)import_datetimes[0].toString("MM/dd/yyyy hh:mm:ss"));
printf(" End DateTime = %s\n",
(const char *)import_datetimes[1].toString("MM/dd/yyyy hh:mm:ss"));
}
if(import_fix_broken_formats) {
printf(" Broken format workarounds are ENABLED\n");
}
@ -1196,6 +1254,10 @@ MainObject::Result MainObject::ImportFile(const QString &filename,
cut->setStartDaypart(import_dayparts[0],true);
cut->setEndDaypart(import_dayparts[1],true);
}
if((!import_datetimes[0].isNull())||(!import_datetimes[1].isNull())) {
cut->setStartDatetime(import_datetimes[0],true);
cut->setEndDatetime(import_datetimes[1],true);
}
import_cut_markers->setAudioLength(wavefile->getExtTimeLength());
if(import_cut_markers->hasStartValue()) {
cut->setStartPoint(import_cut_markers->startValue());

View File

@ -104,6 +104,7 @@ class MainObject : public QObject
bool import_create_dates;
int import_create_startdate_offset;
int import_create_enddate_offset;
QDateTime import_datetimes[2];
QTime import_dayparts[2];
bool import_fix_broken_formats;
int import_persistent_dropbox_id;