From 6afd359aa669db74744621ed45cebefad415ac2a Mon Sep 17 00:00:00 2001 From: Corentin Barreau Date: Mon, 1 Jul 2019 15:06:36 +0200 Subject: [PATCH] Add: second layer of hierarchy for file saving --- utils.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils.go b/utils.go index ad3fcca..9441c4f 100644 --- a/utils.go +++ b/utils.go @@ -47,8 +47,9 @@ func genPath(video *Video) { } func checkFiles(video *Video) { - firstChar := video.ID[:1] - video.Path = firstChar + "/" + video.ID + "/" + firstLayer := video.ID[:1] + secondLayer := video.ID[:3] + video.Path = firstLayer + "/" + secondLayer + "/" + video.ID + "/" files, err := ioutil.ReadDir(video.Path) if err == nil && len(files) >= 4 { color.Println(color.Yellow("[") + color.Red("!") + color.Yellow("]") + color.Yellow("[") + color.Cyan(video.ID) + color.Yellow("]") + color.Red(" This video has already been archived!"))