Revision | 7af1bda32aa2e87c39dd709a2844d896c04b1b0f (tree) |
---|---|
Zeit | 2011-07-11 18:18:35 |
Autor | jakago <jakago@4267...> |
Commiter | jakago |
remove unused code
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/capturestream/trunk@19 4267046d-1765-4020-a4b0-b01f4314ac75
@@ -17,13 +17,14 @@ require 'fileutils' | ||
17 | 17 | 善意を持って作成しておりますが、すべて使用される方の自己責任でお願いいたします。 |
18 | 18 | |
19 | 19 | ====================【更新履歴】==================== |
20 | +2011/07/11 翌週公開分ダウンロードのコードを削除。作業ファイル名の生成方法を変更(make_temp_name) | |
20 | 21 | 2011/07/06 xmlの取得元をwikiに再変更。 |
21 | 22 | 2011/07/02 デフォルトの動作を基礎英語1のダウンロードから何もダウンロードしないように変更。 |
22 | - flvstreamerの実行をカレントディレクトリからパスの通ったものに変更。 | |
23 | - flvstreamerが実行できなかった場合にエラーメッセージを出して終了するように修正。 | |
23 | + flvstreamerの実行をカレントディレクトリからパスの通ったものに変更。 | |
24 | + flvstreamerが実行できなかった場合にエラーメッセージを出して終了するように修正。 | |
24 | 25 | 2011/07/01 githubにリポジトリ作成。xmlの取得元をgithubに変更。 |
25 | 26 | 2011/06/27 flare対応削除。wikiから日付指定でコードを取得するように修正。Windows版sdl-gnash |
26 | - に対応。独自ビルドのMac版sdl-gnashでの動作確認済み。 | |
27 | + に対応。独自ビルドのMac版sdl-gnashでの動作確認済み。 | |
27 | 28 | 2011/05/02 streaming.swf内のActionScriptの変更に暫定対応。 |
28 | 29 | 2011/04/18 flare対応。 |
29 | 30 | 2011/04/18 gnash対応。 |
@@ -36,14 +37,14 @@ require 'fileutils' | ||
36 | 37 | 2010/04/21 「リトル・チャロ2」に対応。ffmpegへの依存をなくし、独自にflvからmp3を抽出。 |
37 | 38 | 2010/04/20 実践ビジネス英語の10-ebj-4231-295vip.flvの形式に対応。複数講座ダウンロード対応。 |
38 | 39 | 2010/04/11 翌週公開ファイルに対応。id3タグのアルバム名のデフォルトを「講座名_YYYY_MM_DD」に |
39 | - 変更。 | |
40 | + 変更。 | |
40 | 41 | 2010/04/10 コードの整理。スクリプトが存在するディレクトリ以外の場所から相対パスで実行された |
41 | - 場合に対応。 | |
42 | + 場合に対応。 | |
42 | 43 | 2010/04/05 プログラムが先祖返りしてrtmpdumpを使うようになっていたのをflvstreamerを使うよう |
43 | - に修正。新年度最初の3月中の放送分が翌年扱いになっていたのを修正。 | |
44 | -2010/04/04 放送年の扱いをすべて年度から歴年に変更。id3タグのアルバムとタイトルをカスタマイ | |
45 | - ズ可能に。mp3のファイル名を「講座名_YYYY_MM_DD.mp3」の形式に変更。id3タグのアル | |
46 | - バム名のデフォルトを「YYYY_MM_DD」に変更。 | |
44 | + に修正。新年度最初の3月中の放送分が翌年扱いになっていたのを修正。 | |
45 | +2010/04/04 放送年の扱いをすべて年度から歴年に変更。id3タグのアルバムとタイトルをカスタマイ | |
46 | + ズ可能に。mp3のファイル名を「講座名_YYYY_MM_DD.mp3」の形式に変更。id3タグのアル | |
47 | + バム名のデフォルトを「YYYY_MM_DD」に変更。 | |
47 | 48 | |
48 | 49 | ====================【 準備 】==================== |
49 | 50 | このスクリプトを実行するためにはRubyとflvstreamerが必要です。flvstreamerはパスの通ったフォ |
@@ -148,7 +149,7 @@ end | ||
148 | 149 | # 何らかの問題でウィキからスクランブル文字列が取得できない場合には自分で設定してください |
149 | 150 | #-------------------------------------------------------------------------------- |
150 | 151 | |
151 | -jputs( "語学講座ダウンローダ (2011/07/06)" ) | |
152 | +jputs( "語学講座ダウンローダ (2011/07/11)" ) | |
152 | 153 | |
153 | 154 | $scramble = "" |
154 | 155 |
@@ -616,104 +617,6 @@ def capture_stream( target, kouza, hdate, file, retry_count ) | ||
616 | 617 | end |
617 | 618 | |
618 | 619 | #-------------------------------------------------------------------------------- |
619 | -# 公開中ファイルのダウンロード | |
620 | -#-------------------------------------------------------------------------------- | |
621 | - | |
622 | -def this_week( target, xml_uri ) | |
623 | - open( xml_uri ) { |f| | |
624 | - doc = REXML::Document.new( f ) | |
625 | - doc.elements.each( "musicdata/music" ) { |element| | |
626 | - kouza = element.attributes["kouza"] | |
627 | - hdate = element.attributes["hdate"] | |
628 | - file = element.attributes["file"] | |
629 | - capture_stream( target, kouza, hdate, file, 5 ) | |
630 | - } | |
631 | - } | |
632 | -end | |
633 | - | |
634 | -#-------------------------------------------------------------------------------- | |
635 | -# 翌週公開ファイルにトライ | |
636 | -#-------------------------------------------------------------------------------- | |
637 | - | |
638 | -RegFlv = /^(\d+-\w+-\d+-)(\d+)([a-zA-Z]*)(?:[^-_.]*)(?:[^.]*)(.flv)$/ | |
639 | - | |
640 | -def next_week( target, xml_uri ) | |
641 | - open( xml_uri ) { |f| | |
642 | - offset = { "training" => [7, 7, 7, 7, 7, 7, 7], "business1" => [2, 2], "business2" => [3, 3, 3], "chinese" => [3, 3, 3, 2, 2], "french" => [4, 4, 4, 4, 1], "italian" => [3, 3, 3, 2, 2], "hangeul" => [3, 3, 3, 2, 2], "german" => [4, 4, 4, 4, 1] } | |
643 | - offset.default = [5, 5, 5, 5, 5] | |
644 | - count = 0 | |
645 | - kouza = "" | |
646 | - hdate_file = Array.new | |
647 | - doc = REXML::Document.new( f ) | |
648 | - doc.elements.each( "musicdata/music" ) { |element| | |
649 | - kouza = element.attributes["kouza"] | |
650 | - hdate_file << [element.attributes["hdate"], element.attributes["file"]] | |
651 | - } | |
652 | - | |
653 | - # ゴールデンウィーク対応 | |
654 | - if target == "basic2" || target == "basic3" | |
655 | - match = RegFlv =~ hdate_file[-1][1] | |
656 | - if match == 0 && $3 == "gw" | |
657 | - prefix = $1 | |
658 | - number = $2 | |
659 | - suffix = $4 | |
660 | - last_hdate = hdate_file[-1][0] | |
661 | - last_file = hdate_file[-1][1] | |
662 | - date = make_date( last_hdate, last_file ) - hdate_file.size + 1 | |
663 | - (0...hdate_file.size).each { |num| | |
664 | - hdate = hdate_file[num][0] | |
665 | - /^\d+(\D+)\d+(\D+)/ =~ hdate | |
666 | - hdate_file[num][0] = "#{date.month}#{$1}#{date.day}#{$2}" | |
667 | - date += 1 | |
668 | - hdate_file[num][1] = "#{prefix}#{sprintf( "%03d", number.to_i - hdate_file.size + num + 1 )}#{suffix}" | |
669 | - } | |
670 | - end | |
671 | - end | |
672 | - | |
673 | - hdate_file.each { |pair| | |
674 | - hdate = pair[0] | |
675 | - file = pair[1] | |
676 | - date = make_date( hdate, file ) + 7 | |
677 | - /^\d+(\D+)\d+(\D+)/ =~ hdate | |
678 | - hdate = "#{date.month}#{$1}#{date.day}#{$2}" | |
679 | - | |
680 | - # 10-et5-4249-365-re01.flv の形式に対応しなければならない | |
681 | - # 実践ビジネス英語の10-ebj-4231-295vip.flvにも対応 | |
682 | - match = RegFlv =~ file | |
683 | - if match != 0 | |
684 | - jputs( "flvファイル名の形式に対応できません:#{file}" ) | |
685 | - elsif $3 == "gw" | |
686 | - jputs( "\nゴールデンウィーク仕様なので翌週公開ファイルのダウンロードをスキップします:#{file}" ) | |
687 | - return | |
688 | - else | |
689 | - prefix = $1 | |
690 | - number = $2 | |
691 | - addition = $3 | |
692 | - suffix = $4 | |
693 | - | |
694 | - additions = Array[""] | |
695 | - ["",2,3,4].each { |num| | |
696 | - additions << "#{addition}#{num}" if addition.length > 0 | |
697 | - additions << "mm#{num}" unless addition == "mm" | |
698 | - additions << "vip#{num}" unless addition == "vip" | |
699 | - } | |
700 | - | |
701 | - begin | |
702 | - ["", "-re01", "-re02", "_re01", "_re02", "-re"].each { |revision| | |
703 | - additions.each { |temp| | |
704 | - file = "#{prefix}#{sprintf( "%03d", number.to_i + offset[target][count] )}#{temp}#{revision}#{suffix}" | |
705 | - raise file if capture_stream( target, kouza, hdate, file, 1 ) | |
706 | - } | |
707 | - } | |
708 | - rescue | |
709 | - end | |
710 | - end | |
711 | - count += 1 | |
712 | - } | |
713 | - } | |
714 | -end | |
715 | - | |
716 | -#-------------------------------------------------------------------------------- | |
717 | 620 | # リトル・チャロ2 |
718 | 621 | #-------------------------------------------------------------------------------- |
719 | 622 |
@@ -864,8 +767,15 @@ targets.each { |target| | ||
864 | 767 | end |
865 | 768 | |
866 | 769 | print( "#{target}: " ) |
867 | - this_week( target, xml_uri ) | |
868 | - #next_week( target, xml_uri ) | |
770 | + open( xml_uri ) { |f| | |
771 | + doc = REXML::Document.new( f ) | |
772 | + doc.elements.each( "musicdata/music" ) { |element| | |
773 | + kouza = element.attributes["kouza"] | |
774 | + hdate = element.attributes["hdate"] | |
775 | + file = element.attributes["file"] | |
776 | + capture_stream( target, kouza, hdate, file, 5 ) | |
777 | + } | |
778 | + } | |
869 | 779 | puts() |
870 | 780 | } |
871 | 781 |