mirror of
https://github.com/cgzirim/seek-tune.git
synced 2025-12-17 08:54:19 +00:00
Move functions to utils package
This commit is contained in:
parent
0cae3a7c51
commit
be91117a39
2 changed files with 2 additions and 18 deletions
|
|
@ -146,10 +146,10 @@ func dlTrack(tracks []Track, path string) (int, error) {
|
|||
return
|
||||
}
|
||||
|
||||
DeleteFile(filepath.Join(path, fileName+".m4a"))
|
||||
utils.DeleteFile(filepath.Join(path, fileName+".m4a"))
|
||||
|
||||
if DELETE_SONG_FILE {
|
||||
DeleteFile(filepath.Join(path, fileName+".wav"))
|
||||
utils.DeleteFile(filepath.Join(path, fileName+".wav"))
|
||||
}
|
||||
|
||||
fmt.Printf("'%s' by '%s' was downloaded\n", track.Title, track.Artist)
|
||||
|
|
|
|||
|
|
@ -39,22 +39,6 @@ func GetFileSize(file string) (int64, error) {
|
|||
return size, nil
|
||||
}
|
||||
|
||||
func DeleteFile(filePath string) {
|
||||
if _, err := os.Stat(filePath); err == nil {
|
||||
if err := os.RemoveAll(filePath); err != nil {
|
||||
fmt.Println("Error deleting file:", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func CreateFolder(folderPath string) error {
|
||||
err := os.MkdirAll(folderPath, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func SongKeyExists(key string) (bool, error) {
|
||||
db, err := utils.NewDbClient()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue