-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecordingcore.h
More file actions
156 lines (127 loc) · 4.97 KB
/
recordingcore.h
File metadata and controls
156 lines (127 loc) · 4.97 KB
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
/*
Copyright (C) 2009–2014 jakago
Copyright (C) 2018–2026 CSReviser Team
This file is part of CaptureStream2, a recorder that supports HLS for
NHK radio language courses.
CaptureStream2 is a modified version of CaptureStream, originally
developed by jakago.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
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, see <https://www.gnu.org/licenses/gpl-2.0.html>.
*/
#pragma once
#include <QThread>
#include <QStringList>
#include <QHash>
#include <QProcess>
#include <tuple>
#include <atomic>
#include "settings.h"
#include "constants.h"
#include "runtimeconfig.h"
#include "networkclient.h"
#include "ffmpegcommandbuilder.h"
#include "ffmpegrunner.h"
#include "thumbnailoptionsbuilder.h"
class RecordingCore : public QThread {
Q_OBJECT
public:
RecordingCore( const RuntimeConfig& runtime );
~RecordingCore() {}
// void cancel() { isCanceled = true; }
// void requestCancel() { isCanceled = true; }
void cancel();
static QString nendo1;
static QString nendo2;
static QDate nendo_end_date1;
static QDate nendo_end_date2;
static QDate nendo_start_date1;
static QDate nendo_start_date2;
static QDate nendo_start_date;
static QDate zenki_end_date;
static QDate kouki_start_date;
static QDate nendo_end_date;
protected:
void run();
signals:
void messageGenerated(const QString &msg);
void progressChanged(int percent);
void errorOccurred(const QString &msg);
void finished();
public slots:
// void requestCancel();
// void requestCancel() { isCanceled = true; }
private:
std::tuple<QStringList, QStringList, QStringList, QStringList, QStringList> getAttribute1( const QString &url );
QString getAttribute2( QString url, QString attribute );
std::tuple<QStringList, QStringList, QStringList, QStringList, QStringList> getJsonData( const QString& urlInput );
std::tuple<QStringList, QStringList, QStringList, QStringList, QStringList> getJsonData1( QString url );
bool checkExecutable( QString path );
bool isFfmpegAvailable( QString& path );
bool istestAvailable( QString& path );
bool checkOutputDir( QString dirPath );
void downloadENews( bool re_read );
QString ffmpeg_process( QStringList arguments );
bool captureStream( QString kouza, QString hdate, QString file, QString nendo, QString dir, QString this_week, QString json_path );
bool captureStream_json( QString kouza, QString hdate, QString file, QString nendo, QString title, QString dupnmb, QString json_patg );
QString formatName( QString format, QString kouza, QString hdate, QString file, QString nendo, QString dupnmb, bool checkIllegal );
QStringList getElements( QString url, QString path );
void downloadShower();
QDate getBroadcastDate(int fiscalYear, int broadcastMonth, int broadcastDay);
QDate getNHKLectureStartDate(int fiscalYear);
int getNHKLectureFiscalYear(const QDate& date);
QStringList formatBroadcastDates(const QStringList &dates);
QString getFfmpegFolder(const QString &ffmpegPath);
QString formatQDate(const QDate &date, bool year4Digits, bool monthTwoDigits, bool dayTwoDigits, const QString &separator);
QStringList extractAllDates( const QString &contentId);
QString extractNthDate( const QString &contentId, int index);
bool execute(const RecordingRequest& req,
const QString& ffmpegPath);
bool isCanceled = false;
bool failed1935;
static QString Error_mes;
static QString paths[];
static QString paths2[];
static QString paths3[];
static QString json_paths[];
static QString json_paths2[];
static QMap<QString, QString> map;
static QMultiMap<QString, QString> multimap;
static QMultiMap<QString, QString> multimap1;
static QString prefix;
static QString prefix1;
static QString prefix2;
static QString prefix3;
static QString suffix;
static QString suffix1;
static QString suffix2;
static QString suffix3;
static QString json_prefix;
static QString Json_url;
static QString flv_host;
static QString flv_app;
static QString flv_service_prefix;
static QString Xml_koza;
static QString flvstreamer;
static QString ffmpeg;
static QString test;
static QStringList malformed;
static QHash<QProcess::ProcessError, QString>processError;
static QStringList one2two(const QStringList &hdateList);
static QStringList thisweekfile( QStringList fileList2, QStringList codeList );
static bool illegal( char c );
static QString normalizeExtension(const QString& ext);
RuntimeConfig runtime;
NetworkClient m_client;
FfmpegRunner m_runner;
std::atomic<bool> m_cancelRequested { false };
FfmpegRunRequest m_plan;
QString outputExtension;
};