Skip to content

Commit 6afd359

Browse files
committed
Add: second layer of hierarchy for file saving
1 parent f5af5f9 commit 6afd359

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

utils.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ func genPath(video *Video) {
4747
}
4848

4949
func checkFiles(video *Video) {
50-
firstChar := video.ID[:1]
51-
video.Path = firstChar + "/" + video.ID + "/"
50+
firstLayer := video.ID[:1]
51+
secondLayer := video.ID[:3]
52+
video.Path = firstLayer + "/" + secondLayer + "/" + video.ID + "/"
5253
files, err := ioutil.ReadDir(video.Path)
5354
if err == nil && len(files) >= 4 {
5455
color.Println(color.Yellow("[") + color.Red("!") + color.Yellow("]") + color.Yellow("[") + color.Cyan(video.ID) + color.Yellow("]") + color.Red(" This video has already been archived!"))

0 commit comments

Comments
 (0)