Skip to content

Commit

Permalink
Add: second layer of hierarchy for file saving
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinB committed Jul 1, 2019
1 parent f5af5f9 commit 6afd359
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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!"))
Expand Down

0 comments on commit 6afd359

Please sign in to comment.