From f381b5421e45c4892352a1c38cd9cd99da4f4587 Mon Sep 17 00:00:00 2001 From: Matt Burchett Date: Tue, 20 Nov 2018 17:07:22 -0600 Subject: [PATCH] Cleanup --- cmd/main.go | 11 ++++++----- pkg/eraser/eraser.go | 13 ++----------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index c241282..483e209 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -2,7 +2,6 @@ package main import ( "flag" - "fmt" "log" "git.linuxrocker.com/mattburchett/Housekeeper/pkg/communicator" @@ -49,17 +48,19 @@ func main() { } } - files := eraser.LookupTVFileLocation(cfg, ids) - fmt.Printf("%v\n", files) - if delete { if libraryType == "movie" { files := eraser.LookupMovieFileLocation(cfg, ids) - err = eraser.DeleteMovies(delete, files) + err = eraser.DeleteFiles(delete, files) if err != nil { log.Println(err) } } else if libraryType == "show" { + files := eraser.LookupTVFileLocation(cfg, ids) + err = eraser.DeleteFiles(delete, files) + if err != nil { + log.Println(err) + } } } } diff --git a/pkg/eraser/eraser.go b/pkg/eraser/eraser.go index 1f790b8..197e24c 100644 --- a/pkg/eraser/eraser.go +++ b/pkg/eraser/eraser.go @@ -92,17 +92,8 @@ func LookupTVFileLocation(config config.Config, ids []int) []string { return results } -func isValueInList(value string, list []string) bool { - for _, v := range list { - if v == value { - return true - } - } - return false -} - -// DeleteMovies will actually perform the deletion. -func DeleteMovies(delete bool, files []string) error { +// DeleteFiles will actually perform the deletion. +func DeleteFiles(delete bool, files []string) error { var err error if delete { for _, i := range files {