fix: remove spotiflac libraries

This commit is contained in:
2026-02-15 17:10:08 +01:00
parent 30c86752b6
commit fc4b29b3eb
7 changed files with 22 additions and 24 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,3 @@
lib/
app/
build/
downloads/
Unknown/

2
go.mod
View File

@@ -2,8 +2,6 @@ module github.com/Superredstone/spotiflac-cli
go 1.24.4
replace github.com/Superredstone/spotiflac-cli/app => ./app
require (
github.com/bogem/id3v2/v2 v2.1.4 // indirect
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect

7
lib/app.go Normal file
View File

@@ -0,0 +1,7 @@
package pkg
type App struct {
}

View File

@@ -4,8 +4,6 @@ import (
"errors"
"fmt"
"strconv"
"github.com/Superredstone/spotiflac-cli/app"
)
const (
@@ -13,7 +11,7 @@ const (
DEFAULT_DOWNLOAD_OUTPUT_FOLDER = "."
)
func Download(application *app.App, url string, output_folder string, service string) error {
func Download(app *App, url string, output_folder string, service string) error {
if output_folder == "" {
output_folder = DEFAULT_DOWNLOAD_OUTPUT_FOLDER
}
@@ -23,7 +21,7 @@ func Download(application *app.App, url string, output_folder string, service st
}
if service == "amazon" || service == "qobuz" {
isInstalled, err := application.CheckFFmpegInstalled()
isInstalled, err := app.CheckFFmpegInstalled()
if err != nil {
return err
}
@@ -37,7 +35,7 @@ func Download(application *app.App, url string, output_folder string, service st
switch url_type {
case UrlTypeTrack:
metadata, err := GetMetadata[MetadataSong](application, url)
metadata, err := GetMetadata[MetadataSong](app, url)
if err != nil {
return err
}
@@ -55,10 +53,10 @@ func Download(application *app.App, url string, output_folder string, service st
SpotifyID: track.SpotifyID,
}
_, err = application.DownloadTrack(downloadRequest)
_, err = app.DownloadTrack(downloadRequest)
return err
case UrlTypePlaylist:
metadata, err := GetMetadata[MetadataPlaylist](application, url)
metadata, err := GetMetadata[MetadataPlaylist](app, url)
if err != nil {
return err
}
@@ -80,7 +78,7 @@ func Download(application *app.App, url string, output_folder string, service st
PlaylistName: metadata.Info.Owner.Name,
}
_, err = application.DownloadTrack(downloadRequest)
_, err = app.DownloadTrack(downloadRequest)
if err != nil {
fmt.Println("Unable to download " + track.Name + " - " + track.Artists)
}

View File

@@ -4,8 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/Superredstone/spotiflac-cli/app"
)
type MetadataSong struct {
@@ -53,7 +51,7 @@ type MetadataPlaylistOwner struct {
Images string `json:"images"`
}
func GetMetadata[T MetadataPlaylist | MetadataSong](application *app.App, url string) (T, error) {
func GetMetadata[T MetadataPlaylist | MetadataSong](app *App, url string) (T, error) {
var result T
metadataRequest := app.SpotifyMetadataRequest{
@@ -62,7 +60,7 @@ func GetMetadata[T MetadataPlaylist | MetadataSong](application *app.App, url st
Timeout: 5,
}
metadata, err := application.GetSpotifyMetadata(metadataRequest)
metadata, err := app.GetSpotifyMetadata(metadataRequest)
if err != nil {
return result, err
}
@@ -75,10 +73,10 @@ func GetMetadata[T MetadataPlaylist | MetadataSong](application *app.App, url st
return result, nil
}
func PrintMetadata(application *app.App, url string) error {
func PrintMetadata(app *App, url string) error {
switch GetUrlType(url) {
case UrlTypeTrack:
metadata, err := GetMetadata[MetadataSong](application, url)
metadata, err := GetMetadata[MetadataSong](app, url)
if err != nil {
return err
}
@@ -98,7 +96,7 @@ Images: %s`
return nil
case UrlTypePlaylist:
metadata, err := GetMetadata[MetadataPlaylist](application, url)
metadata, err := GetMetadata[MetadataPlaylist](app, url)
if err != nil {
return err
}

View File

@@ -5,15 +5,14 @@ import (
"log"
"os"
"github.com/Superredstone/spotiflac-cli/app"
"github.com/Superredstone/spotiflac-cli/pkg"
"github.com/Superredstone/spotiflac-cli/lib"
"github.com/urfave/cli/v3"
)
func main() {
var output_folder, service string
application := app.NewApp()
app := lib.NewApp()
cmd := &cli.Command{
Name: "spotiflac-cli",
@@ -41,7 +40,7 @@ func main() {
},
Action: func(ctx context.Context, cmd *cli.Command) error {
song_url := cmd.Args().First()
err := pkg.Download(application, song_url, output_folder, service)
err := pkg.Download(app, song_url, output_folder, service)
return err
},
},
@@ -51,7 +50,7 @@ func main() {
Usage: "view song metadata",
Action: func(ctx context.Context, cmd *cli.Command) error {
url := cmd.Args().First()
return pkg.PrintMetadata(application, url)
return pkg.PrintMetadata(app, url)
},
},
},