Skip to content

Commit

Permalink
release: 0.3.4
Browse files Browse the repository at this point in the history
add: print accurate log when the files are lost or permission denied.
  • Loading branch information
ludoux committed Dec 11, 2022
1 parent 1052c47 commit 249dc64
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
27 changes: 22 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var (
debug bool = false
)

var version string = "0.3.3"
var version string = "0.3.4"

type hashsPair struct {
hash2Torrent map[string]qbt.BasicTorrent
Expand Down Expand Up @@ -378,14 +378,31 @@ func exportTorrentFiles(hashs *hashsPair, filter *filterOptions, appendTagName s
curFilename = strings.ReplaceAll(curFilename, "<state>", toSafeFolderName(torrent.State))
curFilename = strings.ReplaceAll(curFilename, "<name>", toSafeFolderName(torrent.Name))
_, err = os.Stat("BT_backup/" + hash + ".torrent")
if err != nil {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ") Not Found in BT_backup")
if err != nil && os.IsNotExist(err) {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ".torrent) Not Found in BT_backup")
errorCount++
continue
} else if err != nil && os.IsPermission(err) {
fmt.Println("Error: No permission to access BT_backup/", torrent.Hash, ".torrent for ", torrent.Name)
errorCount++
continue
} else if err != nil {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ".", "torrent) ", err.Error())
errorCount++
continue
}

_, err = os.Stat("BT_backup/" + hash + ".fastresume")
if err != nil {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ") .fastresume Not Found in BT_backup")
if err != nil && os.IsNotExist(err) {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ".fastresume) Not Found in BT_backup")
errorCount++
continue
} else if err != nil && os.IsPermission(err) {
fmt.Println("Error: No permission to access BT_backup/", torrent.Hash, ".fastresume for ", torrent.Name)
errorCount++
continue
} else if err != nil {
fmt.Println("Error: ", torrent.Name, "(", torrent.Hash, ".", "fastresume) ", err.Error())
errorCount++
continue
}
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.3
0.3.4

0 comments on commit 249dc64

Please sign in to comment.