Skip to content

Commit

Permalink
Show error if impossible to move album while syncing.
Browse files Browse the repository at this point in the history
  • Loading branch information
barsanuphe committed Jan 26, 2016
1 parent 2f9ce0c commit 4727776
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion music/album_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func createTestFiles(c config.Config) {
panic(err)
}

// TODO what happens if we want to move an album to an already existing path???
// create folders
a0 := filepath.Join(c.Paths.Root, "arthi (2000) jqojdoijd")
a1 := filepath.Join(c.Paths.Root, "arthi東京?-4. (2000) jqojdoijd(??)--+")
Expand Down
9 changes: 6 additions & 3 deletions music/walks.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,16 @@ func SortAlbums(c config.Config, doNothing bool) (err error) {
if !hasGenre {
uncategorized++
}

originalRelative, _ := filepath.Rel(a.Root, a.Path)
destRelative, _ := filepath.Rel(a.Root, a.NewPath)

hasMoved, err := a.MoveToNewPath(doNothing)
if err != nil {
panic(err)
fmt.Println(chalk.Bold.TextStyle(chalk.Red.Color("!!! ERROR MOVING " + a.String())))
fmt.Println(chalk.Bold.TextStyle(chalk.Red.Color("!!!\t " + originalRelative + "\n!!!\t -> " + destRelative)))
}
if hasMoved {
originalRelative, _ := filepath.Rel(a.Root, a.Path)
destRelative, _ := filepath.Rel(a.Root, a.NewPath)
fmt.Println(chalk.Yellow.Color("+ " + a.String()))
fmt.Println("\t " + originalRelative + "\n\t -> " + destRelative)
movedAlbums++
Expand Down

0 comments on commit 4727776

Please sign in to comment.