Skip to content

Commit

Permalink
ボキャブライダー(今週分)、mp3ビットレートオプション追加
Browse files Browse the repository at this point in the history
  • Loading branch information
CSReviser committed Apr 13, 2019
1 parent 429270c commit 6aca033
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 6 deletions.
24 changes: 19 additions & 5 deletions downloadthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ DownloadThread::DownloadThread( Ui::MainWindowClass* ui ) : isCanceled(false), f
ffmpegHash["mov"] = "\"%1\" -y -i https://nhk-vh.akamaihd.net/i/gogaku-stream/mp4/%2/master.m3u8 -id3v2_version 3 -metadata title=\"%4\" -metadata artist=\"NHK\" -metadata album=\"%5\" -metadata date=\"%6\" -metadata genre=\"Speech\" -vn -bsf aac_adtstoasc -acodec copy \"%3\"";
ffmpegHash["mp3"] = "\"%1\" -y -i https://nhk-vh.akamaihd.net/i/gogaku-stream/mp4/%2/master.m3u8 -id3v2_version 3 -metadata title=\"%4\" -metadata artist=\"NHK\" -metadata album=\"%5\" -metadata date=\"%6\" -metadata genre=\"Speech\" -vn -acodec libmp3lame \"%3\"";
ffmpegHash["ts"] = "\"%1\" -y -i https://nhk-vh.akamaihd.net/i/gogaku-stream/mp4/%2/master.m3u8 -vn -acodec copy \"%3\"";
ffmpegHash["op1"] = "\"%1\" -y -i https://nhk-vh.akamaihd.net/i/gogaku-stream/mp4/%2/master.m3u8 -id3v2_version 3 -metadata title=\"%4\" -metadata artist=\"NHK\" -metadata album=\"%5\" -metadata date=\"%6\" -metadata genre=\"Speech\" -vn -acodec:a libmp3lame -ab 48k -ar 24000 -ac 1 \"%3\"";
ffmpegHash["op2"] = "\"%1\" -y -i https://nhk-vh.akamaihd.net/i/gogaku-stream/mp4/%2/master.m3u8 -id3v2_version 3 -metadata title=\"%4\" -metadata artist=\"NHK\" -metadata album=\"%5\" -metadata date=\"%6\" -metadata genre=\"Speech\" -vn -acodec:a libmp3lame -ab 48k \"%3\"";
ffmpegHash["op3"] = "\"%1\" -y -i https://nhk-vh.akamaihd.net/i/gogaku-stream/mp4/%2/master.m3u8 -id3v2_version 3 -metadata title=\"%4\" -metadata artist=\"NHK\" -metadata album=\"%5\" -metadata date=\"%6\" -metadata genre=\"Speech\" -vn -acodec:a libmp3lame -ab 40k \"%3\"";
ffmpegHash["op4"] = "\"%1\" -y -i https://nhk-vh.akamaihd.net/i/gogaku-stream/mp4/%2/master.m3u8 -id3v2_version 3 -metadata title=\"%4\" -metadata artist=\"NHK\" -metadata album=\"%5\" -metadata date=\"%6\" -metadata genre=\"Speech\" -vn -acodec:a libmp3lame -ab 32k \"%3\"";
}
if ( processError.empty() ) {
processError[QProcess::FailedToStart] = "FailedToStart";
Expand Down Expand Up @@ -518,7 +522,9 @@ bool DownloadThread::captureStream( QString kouza, QString hdate, QString file )

// 2013/04/05 オーディオフォーマットの変更に伴って拡張子の指定に対応
QString extension = ui->comboBox_extension->currentText();
outFileName = outBasename + "." + extension;
QString extension1 = extension;
if ( extension.left( 2 ) == "op" ) extension1 = "mp3";
outFileName = outBasename + "." + extension1;

#ifdef QT4_QT5_WIN
QString null( "nul" );
Expand All @@ -539,7 +545,15 @@ bool DownloadThread::captureStream( QString kouza, QString hdate, QString file )
QDate today;
today.setDate(QDate::currentDate().year(),QDate::currentDate().month(),QDate::currentDate().day());
int day2 = onair.daysTo(QDate::currentDate())-today.dayOfWeek();
if ( day2 > 7 || day2 < 0 ) return false;
if ( ui->toolButton_vrradio->isChecked() && !ui->toolButton_vrradio1->isChecked() ) {
if ( day2 > 7 || day2 < 0 ) return false;
}
if ( !ui->toolButton_vrradio->isChecked() && ui->toolButton_vrradio1->isChecked() ) {
if ( day2 > 0 || day2 < -7 ) return false;
}
if ( ui->toolButton_vrradio->isChecked() && ui->toolButton_vrradio1->isChecked() ) {
if ( 2019 > year ) return false;
}
}

if ( ui->toolButton_skip->isChecked() && QFile::exists( outputDir + outFileName ) ) {
Expand All @@ -554,7 +568,7 @@ bool DownloadThread::captureStream( QString kouza, QString hdate, QString file )
if ( true ) {
QTemporaryFile file;
if ( file.open() ) {
dstPath = file.fileName() + "." + extension;
dstPath = file.fileName() + "." + extension1;
file.close();
} else {
emit critical( QString::fromUtf8( "一時ファイルの作成に失敗しました: " ) + kouza + QString::fromUtf8( " " ) + yyyymmdd );
Expand Down Expand Up @@ -612,7 +626,7 @@ QString DownloadThread::paths[] = {
"english/basic0", "english/basic1", "english/basic2", "english/basic3",
"english/timetrial", "english/kaiwa", "english/business1",
"english/business2", "english/gakusyu", "english/gendai",
"english/enjoy", "english/vr-radio",
"english/enjoy", "english/vr-radio", "english/vr-radio",
"chinese/kouza", "chinese/levelup", "chinese/omotenashi", "french/kouza", "french/kouza2",
"italian/kouza", "italian/kouza2", "hangeul/kouza","hangeul/levelup", "hangeul/omotenashi",
"german/kouza", "german/kouza2", "spanish/kouza", "spanish/kouza2", "russian/kouza", "russian/kouza2"
Expand All @@ -623,7 +637,7 @@ void DownloadThread::run() {
ui->toolButton_basic0, ui->toolButton_basic1, ui->toolButton_basic2, ui->toolButton_basic3,
ui->toolButton_timetrial, ui->toolButton_kaiwa, ui->toolButton_business1,
ui->toolButton_business2, ui->toolButton_gakusyu, ui->toolButton_gendai,
ui->toolButton_enjoy, ui->toolButton_vrradio,
ui->toolButton_enjoy, ui->toolButton_vrradio, ui->toolButton_vrradio1,
ui->toolButton_chinese, ui->toolButton_levelup_chinese, ui->toolButton_omotenashi_chinese,
ui->toolButton_french, ui->toolButton_french, ui->toolButton_italian, ui->toolButton_italian,
ui->toolButton_hangeul, ui->toolButton_levelup_hangeul, ui->toolButton_omotenashi_hangeul,
Expand Down
1 change: 1 addition & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ void MainWindow::settings( enum ReadWriteMode mode ) {
{ ui->toolButton_enjoy, "enjoy", false, "enjoy_title", DefaultTitle, "enjoy_file_name", DefaultFileName },
{ ui->toolButton_russian, "russian", false, "russian_title", DefaultTitle, "russian_file_name", DefaultFileName },
{ ui->toolButton_vrradio, "vrradio", false, "vrradio_title", DefaultTitle, "vrradio_file_name", DefaultFileName },
{ ui->toolButton_vrradio1, "vrradio1", false, "vrradio_title", DefaultTitle, "vrradio_file_name", DefaultFileName },
{ ui->toolButton_omotenashi_chinese, "omotenashi-chinese", false, "omotenashi-chinese_title", DefaultTitle, "omotenashi-chinese_file_name", DefaultFileName },
{ ui->toolButton_omotenashi_hangeul, "omotenashi-hangeul", false, "omotenashi-hangeul_title", DefaultTitle, "omotenashi-hangeul_file_name", DefaultFileName },
{ ui->checkBox_13, "charo", false, "charo_title", DefaultTitle, "charo_file_name", DefaultFileName },
Expand Down
64 changes: 63 additions & 1 deletion mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,26 @@
<string>ts</string>
</property>
</item>
<item>
<property name="text">
<string>op1</string>
</property>
</item>
<item>
<property name="text">
<string>op2</string>
</property>
</item>
<item>
<property name="text">
<string>op3</string>
</property>
</item>
<item>
<property name="text">
<string>op4</string>
</property>
</item>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -764,7 +784,32 @@
</font>
</property>
<property name="text">
<string>ボキャブライダー</string>
<string>ボキャブライダー(先週分)</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="11" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_29_2">
<item>
<widget class="QToolButton" name="toolButton_vrradio1">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>ボキャブライダー(今週分)</string>
</property>
<property name="checkable">
<bool>true</bool>
Expand Down Expand Up @@ -1183,6 +1228,7 @@
<tabstop>toolButton_german</tabstop>
<tabstop>toolButton_spanish</tabstop>
<tabstop>toolButton_russian</tabstop>
<tabstop>toolButton_vrradio1</tabstop>
<tabstop>toolButton_skip</tabstop>
<tabstop>comboBox_extension</tabstop>
<tabstop>downloadButton</tabstop>
Expand Down Expand Up @@ -1409,6 +1455,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>toolButton_vrradio1</sender>
<signal>toggled(bool)</signal>
<receiver>MainWindowClass</receiver>
<slot>toggled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>232</x>
<y>378</y>
</hint>
<hint type="destinationlabel">
<x>211</x>
<y>602</y>
</hint>
</hints>
</connection>
<connection>
<sender>toolButton_skip</sender>
<signal>toggled(bool)</signal>
Expand Down

0 comments on commit 6aca033

Please sign in to comment.