Skip to content

Commit

Permalink
fix(): Fixed the bug that directory naming failed when saving some se…
Browse files Browse the repository at this point in the history
…ries videos.

Fixed the bug that directory naming failed when saving some series videos. (close #12 )
  • Loading branch information
yliu7949 committed Jul 28, 2022
1 parent 9db1cd9 commit f0a8af2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Thursday, 28 July 2022: Version 0.8.2
Fixed the bug that directory naming failed when saving some series videos.

Sunday, 10 July 2022: Version 0.8.1
Allowed users to view the size of encrypted videos.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ cd C:\Users\lenovo\Downloads\
ks version
```

若出现`KouShare-dl v0.8.1`字样,则说明可以正常使用。接下来您可以继续输入 KouShare-dl 程序的命令来进行交互。比如,输入`ks help`并回车,您就可以看到 KouShare-dl 程序的帮助信息了。
若出现`KouShare-dl v0.8.2`字样,则说明可以正常使用。接下来您可以继续输入 KouShare-dl 程序的命令来进行交互。比如,输入`ks help`并回车,您就可以看到 KouShare-dl 程序的帮助信息了。

# 命令简介

Expand Down
2 changes: 1 addition & 1 deletion ks.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func main() {
},
}

const version = "v0.8.1"
const version = "v0.8.2"
var cmdVersion = &cobra.Command{
Use: "version",
Short: "输出版本号,并检查最新版本",
Expand Down
8 changes: 6 additions & 2 deletions video/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,14 @@ func (v *Video) DownloadSeriesVideos(quality string) {
return
}

// 过滤系列名中的不合法字符,参考 https://github.com/yliu7949/KouShare-dl/issues/12
reg, _ := regexp.Compile(`[\\/:*?"<>|]`)
seriesName := reg.ReplaceAllString(v.seriesName, "")

if v.svpName != "" {
v.SaveDir += fmt.Sprintf("%s_%s_videos\\", v.seriesName, v.svpName)
v.SaveDir += fmt.Sprintf("%s_%s_videos\\", seriesName, reg.ReplaceAllString(v.svpName, ""))
} else {
v.SaveDir += fmt.Sprintf("%s_videos\\", v.seriesName)
v.SaveDir += fmt.Sprintf("%s_videos\\", seriesName)
}
if _, err := os.Stat(v.SaveDir); os.IsNotExist(err) {
if err := os.Mkdir(v.SaveDir, os.ModePerm); err != nil {
Expand Down

0 comments on commit f0a8af2

Please sign in to comment.