forked from ElvishArtisan/rivendell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcatch_event.cpp
750 lines (527 loc) · 10.6 KB
/
catch_event.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
// catch_event.cpp
//
// A container class for a Rivendell netcatch event.
//
// (C) Copyright 2002-2022 Fred Gleason <[email protected]>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <rddatedecode.h>
#include <catch_event.h>
CatchEvent::CatchEvent(RDStation *station,RDConfig *config)
{
catch_station=station;
catch_config=config;
clear();
}
unsigned CatchEvent::id() const
{
return catch_id;
}
void CatchEvent::setId(int id)
{
catch_id=id;
}
bool CatchEvent::isActive() const
{
return catch_is_active;
}
void CatchEvent::setIsActive(bool state)
{
catch_is_active=state;
}
RDRecording::Type CatchEvent::type() const
{
return catch_type;
}
void CatchEvent::setType(RDRecording::Type type)
{
catch_type=type;
}
unsigned CatchEvent::channel() const
{
return catch_channel;
}
void CatchEvent::setChannel(unsigned chan)
{
catch_channel=chan;
}
QString CatchEvent::cutName() const
{
return catch_cut_name;
}
void CatchEvent::setCutName(const QString &str)
{
catch_cut_name=str;
}
int CatchEvent::playGain() const
{
return catch_play_gain;
}
void CatchEvent::setPlayGain(int lvl)
{
catch_play_gain=lvl;
}
QString CatchEvent::tempName() const
{
return catch_temp_name;
}
void CatchEvent::setTempName(const QString &str)
{
catch_temp_name=str;
}
bool CatchEvent::deleteTempFile() const
{
return catch_delete_temp_file;
}
void CatchEvent::setDeleteTempFile(bool state)
{
catch_delete_temp_file=state;
}
bool CatchEvent::dayOfWeek(int day) const
{
return catch_day_of_week[day-1];
}
void CatchEvent::setDayOfWeek(int day,bool state)
{
catch_day_of_week[day-1]=state;
}
RDRecording::StartType CatchEvent::startType() const
{
return catch_start_type;
}
void CatchEvent::setStartType(RDRecording::StartType type)
{
catch_start_type=type;
}
QTime CatchEvent::startTime() const
{
return catch_start_time;
}
void CatchEvent::setStartTime(QTime time)
{
catch_start_time=time;
}
int CatchEvent::startLength() const
{
return catch_start_length;
}
void CatchEvent::setStartLength(int len)
{
catch_start_length=len;
}
int CatchEvent::startMatrix() const
{
return catch_start_matrix;
}
void CatchEvent::setStartMatrix(int matrix)
{
catch_start_matrix=matrix;
}
int CatchEvent::startLine() const
{
return catch_start_line;
}
void CatchEvent::setStartLine(int line)
{
catch_start_line=line;
}
int CatchEvent::startOffset() const
{
return catch_start_offset;
}
void CatchEvent::setStartOffset(int offset)
{
catch_start_offset=offset;
}
RDRecording::EndType CatchEvent::endType() const
{
return catch_end_type;
}
void CatchEvent::setEndType(RDRecording::EndType type)
{
catch_end_type=type;
}
QTime CatchEvent::endTime() const
{
return catch_end_time;
}
void CatchEvent::setEndTime(QTime time)
{
catch_end_time=time;
}
int CatchEvent::endLength() const
{
return catch_end_length;
}
void CatchEvent::setEndLength(int len)
{
catch_end_length=len;
}
int CatchEvent::endMatrix() const
{
return catch_end_matrix;
}
void CatchEvent::setEndMatrix(int matrix)
{
catch_end_matrix=matrix;
}
int CatchEvent::endLine() const
{
return catch_end_line;
}
void CatchEvent::setEndLine(int line)
{
catch_end_line=line;
}
unsigned CatchEvent::length() const
{
return catch_length;
}
void CatchEvent::setLength(unsigned len)
{
catch_length=len;
}
int CatchEvent::startGpi() const
{
return catch_start_gpi;
}
void CatchEvent::setStartGpi(int gpi)
{
catch_start_gpi=gpi;
}
int CatchEvent::endGpi() const
{
return catch_end_gpi;
}
void CatchEvent::setEndGpi(int gpi)
{
catch_end_gpi=gpi;
}
bool CatchEvent::allowMultipleRecordings() const
{
return catch_allow_multiple_recordings;
}
void CatchEvent::setAllowMultipleRecordings(bool state)
{
catch_allow_multiple_recordings=state;
}
int CatchEvent::maxGpiRecordLength() const
{
return catch_max_gpi_record_length;
}
void CatchEvent::setMaxGpiRecordLength(int len)
{
catch_max_gpi_record_length=len;
}
unsigned CatchEvent::trimThreshold() const
{
return catch_trim_threshold;
}
void CatchEvent::setTrimThreshold(unsigned level)
{
catch_trim_threshold=level;
}
unsigned CatchEvent::startdateOffset() const
{
return catch_startdate_offset;
}
void CatchEvent::setStartdateOffset(unsigned offset)
{
catch_startdate_offset=offset;
}
unsigned CatchEvent::enddateOffset() const
{
return catch_enddate_offset;
}
void CatchEvent::setEnddateOffset(unsigned offset)
{
catch_enddate_offset=offset;
}
RDSettings::Format CatchEvent::format() const
{
return catch_format;
}
void CatchEvent::setFormat(RDSettings::Format fmt)
{
catch_format=fmt;
}
int CatchEvent::channels() const
{
return catch_channels;
}
void CatchEvent::setChannels(int chans)
{
catch_channels=chans;
}
int CatchEvent::sampleRate() const
{
return catch_samplerate;
}
void CatchEvent::setSampleRate(int rate)
{
catch_samplerate=rate;
}
int CatchEvent::bitrate() const
{
return catch_bitrate;
}
void CatchEvent::setBitrate(int rate)
{
catch_bitrate=rate;
}
int CatchEvent::normalizeLevel() const
{
return catch_normalize_level;
}
void CatchEvent::setNormalizeLevel(int level)
{
catch_normalize_level=level;
}
int CatchEvent::quality() const
{
return catch_quality;
}
void CatchEvent::setQuality(int qual)
{
catch_quality=qual;
}
int CatchEvent::macroCart() const
{
return catch_macro_cart;
}
void CatchEvent::setMacroCart(int cart)
{
catch_macro_cart=cart;
}
int CatchEvent::switchInput() const
{
return catch_switch_input;
}
void CatchEvent::setSwitchInput(int input)
{
catch_switch_input=input;
}
int CatchEvent::switchOutput() const
{
return catch_switch_output;
}
void CatchEvent::setSwitchOutput(int output)
{
catch_switch_output=output;
}
RDDeck::Status CatchEvent::status() const
{
return catch_status;
}
void CatchEvent::setStatus(RDDeck::Status status)
{
catch_status=status;
}
bool CatchEvent::oneShot() const
{
return catch_oneshot;
}
void CatchEvent::setOneShot(bool state)
{
catch_oneshot=state;
}
QString CatchEvent::url()const
{
return catch_url;
}
void CatchEvent::setUrl(const QString &url)
{
catch_url=url;
}
QString CatchEvent::resolvedUrl() const
{
return catch_resolved_url;
}
void CatchEvent::setResolvedUrl(const QString &url)
{
catch_resolved_url=url;
}
QString CatchEvent::urlUsername() const
{
return catch_url_username;
}
void CatchEvent::setUrlUsername(const QString &name)
{
catch_url_username=name;
}
QString CatchEvent::urlPassword() const
{
return catch_url_password;
}
bool CatchEvent::enableMetadata() const
{
return catch_enable_metadata;
}
void CatchEvent::setEnableMetadata(bool state)
{
catch_enable_metadata=state;
}
void CatchEvent::setUrlPassword(const QString &passwd)
{
catch_url_password=passwd;
}
bool CatchEvent::useSshIdentity() const
{
return catch_use_ssh_identity;
}
void CatchEvent::setUseSshIdentity(bool state)
{
catch_use_ssh_identity=state;
}
unsigned CatchEvent::tempLength() const
{
return catch_temp_length;
}
void CatchEvent::setTempLength(unsigned len)
{
catch_temp_length=len;
}
unsigned CatchEvent::finalLength() const
{
return catch_final_length;
}
void CatchEvent::setFinalLength(unsigned len)
{
catch_final_length=len;
}
QTimer *CatchEvent::gpiStartTimer() const
{
return catch_gpi_start_timer;
}
void CatchEvent::setGpiStartTimer(QTimer *timer)
{
catch_gpi_start_timer=timer;
}
QTimer *CatchEvent::gpiOffsetTimer() const
{
return catch_gpi_offset_timer;
}
void CatchEvent::setGpiOffsetTimer(QTimer *timer)
{
catch_gpi_offset_timer=timer;
}
QString CatchEvent::description() const
{
return catch_description;
}
void CatchEvent::setDescription(const QString &desc)
{
catch_description=desc;
}
int CatchEvent::feedId() const
{
return catch_feed_id;
}
void CatchEvent::setFeedId(int id)
{
catch_feed_id=id;
}
int CatchEvent::podcastLength() const
{
return catch_podcast_length;
}
void CatchEvent::setPodcastLength(int bytes)
{
catch_podcast_length=bytes;
}
int CatchEvent::podcastTime() const
{
return catch_podcast_time;
}
void CatchEvent::setPodcastTime(int msecs)
{
catch_podcast_time=msecs;
}
int CatchEvent::eventdateOffset() const
{
return catch_eventdate_offset;
}
void CatchEvent::setEventdateOffset(int days)
{
catch_eventdate_offset=days;
}
void CatchEvent::resolveUrl(int time_offset)
{
QDate date=QDate::currentDate();
QTime current_time=QTime::currentTime();
if((current_time.msecsTo(QTime(23,59,59))+1000)<time_offset) {
date=date.addDays(1);
}
setResolvedUrl(RDDateTimeDecode(url(),QDateTime(date.addDays(eventdateOffset()),
current_time),catch_station,
catch_config));
}
void CatchEvent::clear()
{
catch_id=0;
catch_is_active=false;;
catch_type=RDRecording::Recording;
catch_channel=0;
catch_cut_name="";
catch_play_gain=0;
catch_temp_name="";
catch_delete_temp_file=false;
for(int i=0;i<7;i++) {
catch_day_of_week[i]=false;
}
catch_start_type=RDRecording::HardStart;
catch_start_time=QTime();
catch_start_matrix=-1;
catch_start_line=-1;
catch_start_offset=0;
catch_end_type=RDRecording::HardEnd;
catch_end_time=QTime();
catch_end_matrix=-1;
catch_end_line=-1;
catch_length=0;
catch_start_gpi=-1;
catch_end_gpi=-1;
catch_trim_threshold=0;
catch_startdate_offset=0;
catch_enddate_offset=0;
catch_format=RDSettings::Pcm16;
catch_channels=0;
catch_samplerate=0;
catch_bitrate=0;
catch_quality=0;
catch_normalize_level=-1;
catch_macro_cart=-1;
catch_switch_input=-1;
catch_switch_output=-1;
catch_status=RDDeck::Idle;
catch_oneshot=false;
catch_url="";
catch_resolved_url="";
catch_url_username="";
catch_url_password="";
catch_use_ssh_identity=false;
catch_enable_metadata=false;
catch_temp_length=0;
catch_final_length=0;
catch_gpi_start_timer=NULL;
catch_gpi_offset_timer=NULL;
catch_allow_multiple_recordings=false;
catch_max_gpi_record_length=0;
catch_description="";
catch_feed_id=-1;
catch_podcast_length=0;
catch_podcast_time=0;
catch_eventdate_offset=0;
}