TV Show Fix #6

Merged
mattburchett merged 17 commits from matt/#2 into master 2018-11-20 23:08:30 +00:00
2 changed files with 8 additions and 16 deletions
Showing only changes of commit f381b5421e - Show all commits

View File

@ -2,7 +2,6 @@ package main
import ( import (
"flag" "flag"
"fmt"
"log" "log"
"git.linuxrocker.com/mattburchett/Housekeeper/pkg/communicator" "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 delete {
if libraryType == "movie" { if libraryType == "movie" {
files := eraser.LookupMovieFileLocation(cfg, ids) files := eraser.LookupMovieFileLocation(cfg, ids)
err = eraser.DeleteMovies(delete, files) err = eraser.DeleteFiles(delete, files)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
} }
} else if libraryType == "show" { } else if libraryType == "show" {
files := eraser.LookupTVFileLocation(cfg, ids)
err = eraser.DeleteFiles(delete, files)
if err != nil {
log.Println(err)
}
} }
} }
} }

View File

@ -92,17 +92,8 @@ func LookupTVFileLocation(config config.Config, ids []int) []string {
return results return results
} }
func isValueInList(value string, list []string) bool { // DeleteFiles will actually perform the deletion.
for _, v := range list { func DeleteFiles(delete bool, files []string) error {
if v == value {
return true
}
}
return false
}
// DeleteMovies will actually perform the deletion.
func DeleteMovies(delete bool, files []string) error {
var err error var err error
if delete { if delete {
for _, i := range files { for _, i := range files {