• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision416bff9544f1043ba2e679769cc179eb5603911c (tree)
Zeit2011-07-09 07:50:31
Autorjakago <jakago@4267...>
Commiterjakago

Log Message

remove past file downloader

git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/capturestream/trunk@8 4267046d-1765-4020-a4b0-b01f4314ac75

Ändern Zusammenfassung

Diff

--- a/downloadthread.cpp
+++ b/downloadthread.cpp
@@ -664,82 +664,6 @@ bool DownloadThread::captureStream( QString kouza, QString hdate, QString file,
664664 exitCode = process.execute( command80 );
665665 }
666666 if ( exitCode ) {
667- //emit critical( QString::fromUtf8( "リトライしましたが、ダウンロードを完了できませんでした: " ) +
668- emit critical( QString::fromUtf8( "ダウンロードを完了できませんでした: " ) +
669- kouza + QString::fromUtf8( " " ) + yyyymmdd );
670- }
671- QFileInfo fileInfo( flv_file ); // ストリーミングが存在しなかった場合は13バイト
672- if ( fileInfo.size() > 100 && ( !exitCode || ui->checkBox_keep_on_error->isChecked() ) ) {
673- QString error;
674- if ( MP3::flv2mp3( flv_file, outputDir + outFileName, error ) ) {
675- id3tag( outputDir + outFileName, kouza, id3tagTitle, QString::number( year ), "NHK" );
676- result = true;
677- } else
678- emit critical( error );
679- }
680- if ( QFile::exists( flv_file ) )
681- QFile::remove( flv_file );
682- }
683-
684- return result;
685-}
686-
687-bool DownloadThread::captureStreamPast( QString kouza, QString file, int retryCount, bool guess ) {
688- Q_UNUSED( guess )
689- QString hdate = QString::fromUtf8( "00月00日放送分" );
690- QString outputDir = MainWindow::outputDir + kouza;
691- if ( !checkOutputDir( outputDir ) )
692- return false;
693- outputDir += QDir::separator(); //通常ファイルが存在する場合のチェックのために後から追加する
694-
695-#ifdef Q_WS_WIN
696- QString null( "nul" );
697-#else
698- QString null( "/dev/null" );
699-#endif
700-
701- //QString titleFormat;
702- //QString fileNameFormat;
703- //CustomizeDialog::formats( kouza, titleFormat, fileNameFormat );
704- QString id3tagTitle = formatName( "%f", kouza, hdate, file, false );
705- QString outFileName = formatName( "%f.mp3", kouza, hdate, file, true );
706- QFileInfo fileInfo( outFileName );
707- QString outBasename = fileInfo.completeBaseName();
708-
709- bool result = false;
710-
711- if ( file.endsWith( ".flv", Qt::CaseInsensitive ) ) {
712- int month = hdate.left( 2 ).toInt();
713- int year = 2000 + file.left( 2 ).toInt();
714- if ( month <= 3 && QDate::currentDate().year() > year )
715- year += 1;
716- int day = hdate.mid( 3, 2 ).toInt();
717- QDate onair( year, month, day );
718- QString yyyymmdd = onair.toString( "yyyy_MM_dd" );
719- QString basename = file.left( file.size() - 4 );
720- //QString outBasename = kouza + "_" + yyyymmdd;
721- if ( ui->checkBox_skip->isChecked() && QFile::exists( outputDir + outFileName ) ) {
722- emit current( QString::fromUtf8( "スキップ:    " ) + kouza + QString::fromUtf8( " " ) + file );
723- return true;
724- }
725- QString flv_file = outputDir + outBasename + ".flv";
726- QString command1935 = "\"" + flvstreamer + "\"" + Timeout + " -r \"rtmp://" + flv_host + "/" + flv_app +
727- flv_service_prefix + basename + "\" -o " + "\"" + flv_file + "\" > " + null;
728- QString command80 = "\"" + flvstreamer + "\"" + Timeout + " -r \"rtmpt://" + flv_host + ":80/" + flv_app +
729- flv_service_prefix + basename + "\" -o " + "\"" + flv_file + "\" --resume > " + null;
730- QProcess process;
731- //if ( guess ) {
732- //emit current( QString::fromUtf8( "別ファイル名でリトライ中..." ) );
733- //emit messageWithoutBreak( QString::fromUtf8( "." ) );
734- //} else
735- emit current( QString::fromUtf8( "ダウンロード中: " ) + kouza + QString::fromUtf8( " " ) + file );
736- int exitCode = process.execute( command1935 );
737- while ( exitCode && retryCount-- > 0 ) {
738- emit current( QString::fromUtf8( "リトライ中:   " ) + kouza + QString::fromUtf8( " " ) + file );
739- exitCode = process.execute( command80 );
740- }
741- if ( exitCode ) {
742- //emit critical( QString::fromUtf8( "リトライしましたが、ダウンロードを完了できませんでした: " ) +
743667 emit critical( QString::fromUtf8( "ダウンロードを完了できませんでした: " ) +
744668 kouza + QString::fromUtf8( " " ) + yyyymmdd );
745669 }
@@ -785,53 +709,6 @@ static int offsets[langCount][7] = {
785709 { 5, 5, 5, 5, 5 } //まいにちスペイン語
786710 };
787711
788-void DownloadThread::downloadPast( int count, QString file, QString kouza ) {
789- for ( int j = 1; j <= count && !isCanceled; j++ ) {
790- QRegExp rx2( "^(\\d+-\\w+-\\d+-)(\\d+)([a-zA-Z]*)(?:[^-_.]*)(?:[^.]*)(.flv)$" );
791- if ( rx2.indexIn( file, 0 ) != -1 ) {
792- QString prefix = rx2.cap( 1 );
793- QString number = rx2.cap( 2 );
794- QString addition = rx2.cap( 3 );
795- QString suffix = rx2.cap( 4 );
796-
797- QStringList tempList = (QStringList() << "" << "2" << "3" << "4");
798- QStringList additions;
799- additions << "";
800- for ( int k = 0; k < tempList.count(); k++ ) {
801- if ( addition.length() > 0 )
802- additions << (addition + tempList[k]);
803- if ( addition != "mm" )
804- additions << ("mm" + tempList[k]);
805- if ( addition != "vip" )
806- additions << ("vip" + tempList[k]);
807- }
808- //#define Variants 6
809- //static QString revisions[Variants] = { "", "-re01", "-re02", "_re01", "_re02", "-re" };
810- //for ( int k = 0; k < Variants && !isCanceled; k++ ) {
811- QStringList revisions = (QStringList() << "" << "-re01" << "-re02" << "_re01" << "_re02" << "-re");
812- bool done = false;
813- for ( int k = 0; k < revisions.count() && !isCanceled && !done; k++ ) {
814- for ( int m = 0; m < additions.count() && !isCanceled && !done; m++ ) {
815- QString file = QString( "%1%2%3%4%5" )
816- .arg( prefix ).arg( number.toInt() - j, 3, 10, QChar( '0' ) )
817- .arg( additions[m] ).arg( revisions[k] ).arg( suffix );
818- //emit current( file );
819- if ( captureStreamPast( kouza, file, 1, k || m ) )
820- done = true;
821- //else if ( !k && !m )
822- //emit current( QString::fromUtf8( "別ファイル名でリトライ中\n" ) );
823- }
824- }
825- if ( !done ) {
826- //emit current( QString::fromUtf8( "" ) );
827- //emit messageWithoutBreak( QString::fromUtf8( "サーバ上にファイルが存在しないか、ファイル名の推測に失敗しました。" ) );
828- emit current( QString::fromUtf8( "サーバ上にファイルが存在しないか、ファイル名の推測に失敗しました。" ) );
829- }
830- //file = "#{prefix}#{sprintf( "%03d", number.to_i + offset[$target][count] )}#{revision}#{suffix}"
831- }
832- }
833-}
834-
835712 void DownloadThread::downloadOneWeek( int i, int addDays, QStringList& fileList, QStringList& kouzaList, QStringList& hdateList ) {
836713 for ( int j = 0; j < fileList.count() && !isCanceled; j++ ) {
837714 QDate onair = onAirDate( hdateList[j], fileList[j] );
@@ -944,13 +821,6 @@ void DownloadThread::run() {
944821 captureStream( kouzaList[j], hdateList[j], fileList[j], 5 );
945822 }
946823
947- if ( false /*ui->checkBox_past_week->isChecked()*/ ) {
948- emit current( QString::fromUtf8( "***************************" ) );
949- emit current( QString::fromUtf8( "「過去のストリーミング」は試験的に搭載された機能です。" ) );
950- emit current( QString::fromUtf8( "***************************" ) );
951- downloadPast( ui->past_days->text().toInt(), fileList[0], kouzaList[0] );
952- }
953-
954824 if ( false /*ui->checkBox_next_week->isChecked()*/ ) {
955825 emit current( QString::fromUtf8( "***************************" ) );
956826 emit current( QString::fromUtf8( "「次週のストリーミング」は試験的に搭載された機能です。" ) );
--- a/downloadthread.h
+++ b/downloadthread.h
@@ -50,8 +50,6 @@ private:
5050 void downloadCharo();
5151 void downloadENews( bool re_read );
5252 bool captureStream( QString kouza, QString hdate, QString file, int retryCount, bool guess = false );
53- bool captureStreamPast( QString kouza, QString file, int retryCount, bool guess );
54- void downloadPast( int count, QString file, QString kouza );
5553 void downloadOneWeek( int i, int addDays, QStringList& fileList, QStringList& kouzaList, QStringList& hdateList );
5654 QString formatName( QString format, QString kouza, QString hdate, QString file, bool checkIllegal );
5755 QStringList getElements( QString url, QString path );