Skip to content

Commit

Permalink
add 32bit build
Browse files Browse the repository at this point in the history
  • Loading branch information
himananiito committed Dec 15, 2018
1 parent fbbe232 commit 3503dfe
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 66 deletions.
30 changes: 30 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,34 @@ go build src/livedl.go
livedl (20180807.22-linux)
```

## Windows(32bit及び64bit上での32bit向け)コンパイル方法

### gccのインストール

gcc には必ず以下を使用すること。

http://tdm-gcc.tdragon.net/download

環境変数で(例)`C:\TDM-GCC-64\bin`が他のgccより優先されるように設定すること。

### 必要なgoのモジュール

linuxの説明に倣ってインストールする。

### コンパイル

PowerSellで、`build-386.ps1` を実行する。または以下を実行する。

```
set-item env:GOARCH -value 386
set-item env:CGO_ENABLED -value 1
go build -o livedl.x86.exe src/livedl.go
```

## 32bit環境で`x509: certificate signed by unknown authority`が出る

動けばいいのであればオプションで以下を指定する。

`-http-skip-verify=on`

以上
5 changes: 5 additions & 0 deletions build-386.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

set-item env:GOARCH -value 386
set-item env:CGO_ENABLED -value 1

go build -o livedl.x86.exe src/livedl.go
8 changes: 7 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
rm livedl.exe
go run updatebuildno.go
go build src/livedl.go
.\build-386.ps1
go build livedl-logger.go

# hide local path
Expand All @@ -14,8 +15,12 @@ $process = Start-Process -FilePath livedl.exe -ArgumentList '-nicotestrun -nicot
$process.WaitForExit(1000 * 61)
$process.Kill()

$process = Start-Process -FilePath livedl.x86.exe -ArgumentList '-nicotestrun -nicotesttimeout 7 -nicotestfmt "testrec/?UNAME?/?PID?-?UNAME?-?TITLE?"' -PassThru
$process.WaitForExit(1000 * 30)
$process.Kill()

$dir = "livedl"
$zip = "$dir-win64.zip"
$zip = "$dir.zip"
if(Test-Path -PathType Leaf $zip) {
rm $zip
}
Expand All @@ -24,6 +29,7 @@ if(Test-Path -PathType Container $dir) {
}
mkdir $dir
cp livedl.exe $dir
cp livedl.x86.exe $dir
cp livedl-logger.exe $dir
cp Readme.txt $dir

Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
更新履歴

20181215.35
・-nico-ts-start-minオプションの追加
・win32bit版のビルドを追加
・-http-skip-verifyオプションを保存できるようにした
・ライセンスをMITにした

20181107.34
・[ニコ生] (暫定)TEMPORARILY_CROWDEDで録画終了するようにした
・ファイル名が半角ドットで終わる場合に全角ドットにした
Expand Down
2 changes: 1 addition & 1 deletion replacelocal.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use strict;
use v5.20;

for my $file("livedl.exe", "livedl-logger.exe") {
for my $file("livedl.exe", "livedl.x86.exe", "livedl-logger.exe") {
open my $f, "<:raw", $file or die;
undef $/;
my $s = <$f>;
Expand Down
4 changes: 2 additions & 2 deletions src/buildno/buildno.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

package buildno

var BuildDate = "20181107"
var BuildNo = "34"
var BuildDate = "20181215"
var BuildNo = "35"
143 changes: 81 additions & 62 deletions src/options/options.go
Original file line number Diff line number Diff line change
@@ -1,63 +1,66 @@
package options

import (
"database/sql"
"fmt"
"regexp"
"os"
"io/ioutil"
"log"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"path/filepath"
"io/ioutil"
"database/sql"
"golang.org/x/crypto/sha3"

"../buildno"
"../cryptoconf"
"../files"
"golang.org/x/crypto/sha3"
)

var DefaultTcasRetryTimeoutMinute = 5 // TcasRetryTimeoutMinute
var DefaultTcasRetryInterval = 60 // TcasRetryInterval
var DefaultTcasRetryInterval = 60 // TcasRetryInterval

type Option struct {
Command string
NicoLiveId string
NicoStatusHTTPS bool
NicoSession string
NicoLoginAlias string
NicoRtmpMaxConn int
NicoRtmpOnly bool
NicoRtmpIndex map[int]bool
NicoHlsOnly bool
NicoLoginOnly bool
NicoTestTimeout int
TcasId string
TcasRetry bool
Command string
NicoLiveId string
NicoStatusHTTPS bool
NicoSession string
NicoLoginAlias string
NicoRtmpMaxConn int
NicoRtmpOnly bool
NicoRtmpIndex map[int]bool
NicoHlsOnly bool
NicoLoginOnly bool
NicoTestTimeout int
TcasId string
TcasRetry bool
TcasRetryTimeoutMinute int // 再試行を終了する時間(初回終了または録画終了からの時間「分」)
TcasRetryInterval int // 再試行を行うまでの待ち時間
YoutubeId string
ConfFile string // deprecated
ConfPass string // deprecated
ZipFile string
DBFile string
NicoHlsPort int
NicoLimitBw int
NicoTsStart float64
NicoFormat string
NicoFastTs bool
NicoUltraFastTs bool
NicoAutoConvert bool
NicoAutoDeleteDBMode int // 0:削除しない 1:mp4が分割されなかったら削除 2:分割されても削除
NicoDebug bool // デバッグ情報の記録
ConvExt string
ExtractChunks bool
NicoForceResv bool // 終了番組の上書きタイムシフト予約
YtNoStreamlink bool
YtNoYoutubeDl bool
NicoSkipHb bool // コメント出力時に/hbコマンドを出さない
HttpRootCA string
HttpSkipVerify bool
HttpProxy string
TcasRetryInterval int // 再試行を行うまでの待ち時間
YoutubeId string
ConfFile string // deprecated
ConfPass string // deprecated
ZipFile string
DBFile string
NicoHlsPort int
NicoLimitBw int
NicoTsStart float64
NicoFormat string
NicoFastTs bool
NicoUltraFastTs bool
NicoAutoConvert bool
NicoAutoDeleteDBMode int // 0:削除しない 1:mp4が分割されなかったら削除 2:分割されても削除
NicoDebug bool // デバッグ情報の記録
ConvExt string
ExtractChunks bool
NicoForceResv bool // 終了番組の上書きタイムシフト予約
YtNoStreamlink bool
YtNoYoutubeDl bool
NicoSkipHb bool // コメント出力時に/hbコマンドを出さない
HttpRootCA string
HttpSkipVerify bool
HttpProxy string
}

func getCmd() (cmd string) {
cmd = filepath.Base(os.Args[0])
ext := filepath.Ext(cmd)
Expand Down Expand Up @@ -146,6 +149,11 @@ Youtube live録画用オプション:
-conv-ext=mp4 (+) -d2mで出力の拡張子を.mp4とする(デフォルト)
-conv-ext=ts (+) -d2mで出力の拡張子を.tsとする
HTTP関連
-http-skip-verify=on (+) TLS証明書の認証をスキップする (32bit版対策)
-http-skip-verify=off (+) TLS証明書の認証をスキップしない (デフォルト)
(+)のついたオプションは、次回も同じ設定が使用されることを示す。
FILE:
Expand Down Expand Up @@ -236,7 +244,7 @@ func SetNicoSession(hash, session string) (err error) {
}
return
}
func LoadNicoAccount(alias string) (user, pass, session string, err error){
func LoadNicoAccount(alias string) (user, pass, session string, err error) {
db, err := dbAccountOpen()
if err != nil {
if db != nil {
Expand Down Expand Up @@ -270,7 +278,7 @@ func SetYoutubeApiKey(key string) (err error) {
fmt.Printf("Youtube API KEY saved.\n")
return
}
func LoadYoutubeApiKey() (key string, err error){
func LoadYoutubeApiKey() (key string, err error) {
db, err := dbAccountOpen()
if err != nil {
if db != nil {
Expand Down Expand Up @@ -354,7 +362,6 @@ func dbAccountOpen() (db *sql.DB, err error) {
return
}


func dbOpen() (db *sql.DB, err error) {
db, err = sql.Open("sqlite3", "conf.db")
if err != nil {
Expand Down Expand Up @@ -408,7 +415,8 @@ func ParseArgs() (opt Option) {
IFNULL((SELECT v FROM conf WHERE k == "NicoForceResv"), 0),
IFNULL((SELECT v FROM conf WHERE k == "YtNoStreamlink"), 0),
IFNULL((SELECT v FROM conf WHERE k == "YtNoYoutubeDl"), 0),
IFNULL((SELECT v FROM conf WHERE k == "NicoSkipHb"), 0);
IFNULL((SELECT v FROM conf WHERE k == "NicoSkipHb"), 0),
IFNULL((SELECT v FROM conf WHERE k == "HttpSkipVerify"), 0);
`).Scan(
&opt.NicoFormat,
&opt.NicoLimitBw,
Expand All @@ -428,6 +436,7 @@ func ParseArgs() (opt Option) {
&opt.YtNoStreamlink,
&opt.YtNoYoutubeDl,
&opt.NicoSkipHb,
&opt.HttpSkipVerify,
)
if err != nil {
log.Println(err)
Expand Down Expand Up @@ -472,14 +481,14 @@ func ParseArgs() (opt Option) {
}},
Parser{regexp.MustCompile(`\A(https?://(?:[^/]*@)?(?:[^/]*\.)*nicovideo\.jp(?::[^/]*)?/(?:[^/]*?/)*)?(lv\d+)(?:\?.*)?\z`), func() error {
switch opt.Command {
default:
fmt.Printf("Use \"--\" option for FILE for %s\n", opt.Command)
Help()
case "", "NICOLIVE":
opt.NicoLiveId = match[2]
opt.Command = "NICOLIVE"
case "NICOLIVE_TEST":
opt.NicoLiveId = match[2]
default:
fmt.Printf("Use \"--\" option for FILE for %s\n", opt.Command)
Help()
case "", "NICOLIVE":
opt.NicoLiveId = match[2]
opt.Command = "NICOLIVE"
case "NICOLIVE_TEST":
opt.NicoLiveId = match[2]
}
return nil
}},
Expand Down Expand Up @@ -737,7 +746,7 @@ func ParseArgs() (opt Option) {
if err != nil {
return fmt.Errorf("--nico-ts-start-min: Not a number %s\n", s)
}
opt.NicoTsStart = float64(num*60)
opt.NicoTsStart = float64(num * 60)
return nil
}},
Parser{regexp.MustCompile(`\A(?i)--?nico-?(?:format|fmt)\z`), func() (err error) {
Expand Down Expand Up @@ -925,8 +934,17 @@ func ParseArgs() (opt Option) {
opt.HttpRootCA = str
return
}},
Parser{regexp.MustCompile(`\A(?i)--?http-?skip-?verify\z`), func() (err error) {
opt.HttpSkipVerify = true
Parser{regexp.MustCompile(`\A(?i)--?http-?skip-?verify(?:=(on|off))?\z`), func() (err error) {
if strings.EqualFold(match[1], "on") {
opt.HttpSkipVerify = true
dbConfSet(db, "HttpSkipVerify", opt.HttpSkipVerify)
} else if strings.EqualFold(match[1], "off") {
opt.HttpSkipVerify = false
dbConfSet(db, "HttpSkipVerify", opt.HttpSkipVerify)
} else {
opt.HttpSkipVerify = true
}

return
}},
Parser{regexp.MustCompile(`\A(?i)--?http-?proxy\z`), func() (err error) {
Expand Down Expand Up @@ -987,7 +1005,8 @@ func ParseArgs() (opt Option) {
return false
}

LB_ARG: for len(args) > 0 {
LB_ARG:
for len(args) > 0 {
arg, _ := nextArg()

if arg == "--" {
Expand All @@ -1013,7 +1032,7 @@ func ParseArgs() (opt Option) {
continue LB_ARG
}
}
if ok := checkFILE(arg); ! ok {
if ok := checkFILE(arg); !ok {
fmt.Printf("Unknown option: %v\n", arg)
Help()
}
Expand Down Expand Up @@ -1043,7 +1062,6 @@ func ParseArgs() (opt Option) {
}
}


// prints
switch opt.Command {
case "NICOLIVE":
Expand Down Expand Up @@ -1074,6 +1092,7 @@ func ParseArgs() (opt Option) {
fmt.Printf("Conf(ExtractChunks): %#v\n", opt.ExtractChunks)
fmt.Printf("Conf(ConvExt): %#v\n", opt.ConvExt)
}
fmt.Printf("Conf(HttpSkipVerify): %#v\n", opt.HttpSkipVerify)

// check
switch opt.Command {
Expand Down

0 comments on commit 3503dfe

Please sign in to comment.