filecopy uncommented

This commit is contained in:
milarin 2023-01-14 12:23:00 +01:00
parent 2e56da71c9
commit 507e114908

View File

@ -1,6 +1,9 @@
package main package main
import ( import (
"errors"
"io"
"os"
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
@ -65,50 +68,50 @@ func OrganizeAnimeEpisode(b *strings.Builder, parsedFile *model.ParsedFile) erro
oldFile := filepath.Join(DownloadPath, parsedFile.File) oldFile := filepath.Join(DownloadPath, parsedFile.File)
newFile := logic.GetAnimeEpFilepath(parsedFile.AnimeEpisode(), filepath.Ext(parsedFile.File)) newFile := logic.GetAnimeEpFilepath(parsedFile.AnimeEpisode(), filepath.Ext(parsedFile.File))
//lockFile := logic.GetAnimeEpFilepath(parsedFile.AnimeEpisode(), "lock") lockFile := logic.GetAnimeEpFilepath(parsedFile.AnimeEpisode(), "lock")
b.WriteString(color.BlueString("\tmove file\n\t from: '%s'\n\t to: '%s'\n", oldFile, newFile)) b.WriteString(color.BlueString("\tmove file\n\t from: '%s'\n\t to: '%s'\n", oldFile, newFile))
// if err := os.MkdirAll(filepath.Dir(newFile), os.ModePerm); err != nil { if err := os.MkdirAll(filepath.Dir(newFile), os.ModePerm); err != nil {
// return err return err
// } }
// if err := os.Chown(filepath.Dir(newFile), Uid, Gid); err != nil { if err := os.Chown(filepath.Dir(newFile), Uid, Gid); err != nil {
// return err return err
// } }
// if _, err := os.Stat(newFile); !errors.Is(err, os.ErrNotExist) { if _, err := os.Stat(newFile); !errors.Is(err, os.ErrNotExist) {
// return err return err
// } }
// inputFile, err := os.Open(oldFile) inputFile, err := os.Open(oldFile)
// if err != nil { if err != nil {
// return err return err
// } }
// defer inputFile.Close() defer inputFile.Close()
// outputFile, err := os.Create(newFile) outputFile, err := os.Create(newFile)
// if err != nil { if err != nil {
// return err return err
// } }
// defer outputFile.Close() defer outputFile.Close()
// if err := os.Chown(newFile, Uid, Gid); err != nil { if err := os.Chown(newFile, Uid, Gid); err != nil {
// return err return err
// } }
// _, err = io.Copy(outputFile, inputFile) _, err = io.Copy(outputFile, inputFile)
// if err != nil { if err != nil {
// return err return err
// } }
// if err = os.Remove(oldFile); err != nil { if err = os.Remove(oldFile); err != nil {
// return err return err
// } }
// if err = os.Remove(lockFile); err != nil { if err = os.Remove(lockFile); err != nil {
// return err return err
// } }
b.WriteString(color.BlueString("\t done (took %s)\n", time.Since(start))) b.WriteString(color.BlueString("\t done (took %s)\n", time.Since(start)))