summaryrefslogtreecommitdiff
path: root/recording
diff options
context:
space:
mode:
Diffstat (limited to 'recording')
-rw-r--r--recording/config.go8
-rw-r--r--recording/runner.go5
2 files changed, 9 insertions, 4 deletions
diff --git a/recording/config.go b/recording/config.go
index 6d8704b..c38d73f 100644
--- a/recording/config.go
+++ b/recording/config.go
@@ -1,6 +1,7 @@
package recording
import (
+ "bilibili-livestream-archiver/bilibili"
"bilibili-livestream-archiver/common"
"fmt"
)
@@ -13,9 +14,10 @@ type TaskConfig struct {
}
type TransportConfig struct {
- SocketTimeoutSeconds int `mapstructure:"socket_timeout_seconds"`
- RetryIntervalSeconds int `mapstructure:"retry_interval_seconds"`
- MaxRetryTimes int `mapstructure:"max_retry_times"`
+ SocketTimeoutSeconds int `mapstructure:"socket_timeout_seconds"`
+ RetryIntervalSeconds int `mapstructure:"retry_interval_seconds"`
+ MaxRetryTimes int `mapstructure:"max_retry_times"`
+ AllowedNetworkTypes []bilibili.IpNetType `mapstructure:"allowed_network_types"`
}
type DownloadConfig struct {
diff --git a/recording/runner.go b/recording/runner.go
index 4fd9b46..974fa0e 100644
--- a/recording/runner.go
+++ b/recording/runner.go
@@ -42,7 +42,9 @@ func RunTask(ctx context.Context, wg *sync.WaitGroup, task *TaskConfig) {
// doTask do the actual work, but returns synchronously.
func doTask(ctx context.Context, task *TaskConfig) error {
logger := log.Default()
- bi := bilibili.NewBilibili()
+ netTypes := task.Transport.AllowedNetworkTypes
+ logger.Printf("Network types: %v", netTypes)
+ bi := bilibili.NewBilibiliWithNetType(netTypes)
logger.Printf("Start task: room %v", task.RoomId)
authKey, url, err := getStreamingServer(task, logger, bi)
@@ -143,6 +145,7 @@ func record(
return
}
+ logger.Printf("INFO: Getting stream url...")
urlInfo, err := common.AutoRetry(
ctx,
func() (bilibili.RoomUrlInfoResponse, error) {