1
0
Fork 0
mirror of https://git.sr.ht/~phw/scotty synced 2025-04-29 05:17:04 +02:00

Restructured code, moved all modules into internal

For now all modules are considered internal. This might change later
This commit is contained in:
Philipp Wolfer 2023-11-24 00:07:47 +01:00
parent f94e0f1e85
commit 857661ebf9
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
76 changed files with 121 additions and 68 deletions

View file

@ -23,10 +23,10 @@ import (
"github.com/cli/browser" "github.com/cli/browser"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/backends"
"go.uploadedlobster.com/scotty/internal/auth" "go.uploadedlobster.com/scotty/internal/auth"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/backends"
"go.uploadedlobster.com/scotty/storage" "go.uploadedlobster.com/scotty/internal/models"
"go.uploadedlobster.com/scotty/internal/storage"
"golang.org/x/oauth2" "golang.org/x/oauth2"
) )

View file

@ -21,7 +21,7 @@ import (
"strings" "strings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"go.uploadedlobster.com/scotty/backends" "go.uploadedlobster.com/scotty/internal/backends"
) )
// backendsCmd represents the backends command // backendsCmd represents the backends command

View file

@ -23,9 +23,9 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/backends" "go.uploadedlobster.com/scotty/internal/backends"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
"go.uploadedlobster.com/scotty/storage" "go.uploadedlobster.com/scotty/internal/storage"
) )
// listensCmd represents the listens command // listensCmd represents the listens command

View file

@ -23,9 +23,9 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/backends" "go.uploadedlobster.com/scotty/internal/backends"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
"go.uploadedlobster.com/scotty/storage" "go.uploadedlobster.com/scotty/internal/storage"
) )
// lovesCmd represents the loves command // lovesCmd represents the loves command

View file

@ -24,7 +24,7 @@ import (
"github.com/fatih/color" "github.com/fatih/color"
"github.com/vbauerster/mpb/v8" "github.com/vbauerster/mpb/v8"
"github.com/vbauerster/mpb/v8/decor" "github.com/vbauerster/mpb/v8/decor"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
func progressBar(wg *sync.WaitGroup, exportProgress chan models.Progress, importProgress chan models.Progress) *mpb.Progress { func progressBar(wg *sync.WaitGroup, exportProgress chan models.Progress, importProgress chan models.Progress) *mpb.Progress {

View file

@ -22,8 +22,8 @@ import (
"strings" "strings"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
"go.uploadedlobster.com/scotty/storage" "go.uploadedlobster.com/scotty/internal/storage"
) )
func BuildRedirectURL(config *viper.Viper, backend string) (*url.URL, error) { func BuildRedirectURL(config *viper.Viper, backend string) (*url.URL, error) {

View file

@ -23,7 +23,7 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends" "go.uploadedlobster.com/scotty/internal/backends"
) )
func TestBuildRedirectURL(t *testing.T) { func TestBuildRedirectURL(t *testing.T) {

View file

@ -23,16 +23,16 @@ import (
"strings" "strings"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/backends/deezer" "go.uploadedlobster.com/scotty/internal/backends/deezer"
"go.uploadedlobster.com/scotty/backends/dump" "go.uploadedlobster.com/scotty/internal/backends/dump"
"go.uploadedlobster.com/scotty/backends/funkwhale" "go.uploadedlobster.com/scotty/internal/backends/funkwhale"
"go.uploadedlobster.com/scotty/backends/jspf" "go.uploadedlobster.com/scotty/internal/backends/jspf"
"go.uploadedlobster.com/scotty/backends/listenbrainz" "go.uploadedlobster.com/scotty/internal/backends/listenbrainz"
"go.uploadedlobster.com/scotty/backends/maloja" "go.uploadedlobster.com/scotty/internal/backends/maloja"
"go.uploadedlobster.com/scotty/backends/scrobblerlog" "go.uploadedlobster.com/scotty/internal/backends/scrobblerlog"
"go.uploadedlobster.com/scotty/backends/spotify" "go.uploadedlobster.com/scotty/internal/backends/spotify"
"go.uploadedlobster.com/scotty/backends/subsonic" "go.uploadedlobster.com/scotty/internal/backends/subsonic"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
type BackendInfo struct { type BackendInfo struct {

View file

@ -23,15 +23,15 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"go.uploadedlobster.com/scotty/backends" "go.uploadedlobster.com/scotty/internal/backends"
"go.uploadedlobster.com/scotty/backends/dump" "go.uploadedlobster.com/scotty/internal/backends/dump"
"go.uploadedlobster.com/scotty/backends/funkwhale" "go.uploadedlobster.com/scotty/internal/backends/funkwhale"
"go.uploadedlobster.com/scotty/backends/jspf" "go.uploadedlobster.com/scotty/internal/backends/jspf"
"go.uploadedlobster.com/scotty/backends/listenbrainz" "go.uploadedlobster.com/scotty/internal/backends/listenbrainz"
"go.uploadedlobster.com/scotty/backends/maloja" "go.uploadedlobster.com/scotty/internal/backends/maloja"
"go.uploadedlobster.com/scotty/backends/scrobblerlog" "go.uploadedlobster.com/scotty/internal/backends/scrobblerlog"
"go.uploadedlobster.com/scotty/backends/subsonic" "go.uploadedlobster.com/scotty/internal/backends/subsonic"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
func TestResolveBackend(t *testing.T) { func TestResolveBackend(t *testing.T) {

View file

@ -29,7 +29,7 @@ import (
"github.com/jarcoal/httpmock" "github.com/jarcoal/httpmock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/deezer" "go.uploadedlobster.com/scotty/internal/backends/deezer"
"golang.org/x/oauth2" "golang.org/x/oauth2"
) )

View file

@ -24,7 +24,7 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/internal/auth" "go.uploadedlobster.com/scotty/internal/auth"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
"golang.org/x/oauth2" "golang.org/x/oauth2"
) )

View file

@ -24,7 +24,7 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/deezer" "go.uploadedlobster.com/scotty/internal/backends/deezer"
) )
func TestFromConfig(t *testing.T) { func TestFromConfig(t *testing.T) {

View file

@ -22,7 +22,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/deezer" "go.uploadedlobster.com/scotty/internal/backends/deezer"
) )
func TestUserTracksResult(t *testing.T) { func TestUserTracksResult(t *testing.T) {

View file

@ -18,7 +18,7 @@ package dump
import ( import (
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
type DumpBackend struct{} type DumpBackend struct{}

View file

@ -28,7 +28,7 @@ import (
"github.com/jarcoal/httpmock" "github.com/jarcoal/httpmock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/funkwhale" "go.uploadedlobster.com/scotty/internal/backends/funkwhale"
) )
func TestNewClient(t *testing.T) { func TestNewClient(t *testing.T) {

View file

@ -21,7 +21,7 @@ import (
"time" "time"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
const FunkwhaleClientName = "Funkwhale" const FunkwhaleClientName = "Funkwhale"

View file

@ -23,8 +23,8 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/funkwhale" "go.uploadedlobster.com/scotty/internal/backends/funkwhale"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
func TestFromConfig(t *testing.T) { func TestFromConfig(t *testing.T) {

View file

@ -23,7 +23,7 @@ import (
"time" "time"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
type JSPFBackend struct { type JSPFBackend struct {

View file

@ -22,7 +22,7 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"go.uploadedlobster.com/scotty/backends/scrobblerlog" "go.uploadedlobster.com/scotty/internal/backends/scrobblerlog"
) )
func TestFromConfig(t *testing.T) { func TestFromConfig(t *testing.T) {

View file

@ -27,7 +27,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/jspf" "go.uploadedlobster.com/scotty/internal/backends/jspf"
) )
func TestUnmarshalSimple(t *testing.T) { func TestUnmarshalSimple(t *testing.T) {

View file

@ -29,7 +29,7 @@ import (
"github.com/jarcoal/httpmock" "github.com/jarcoal/httpmock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/listenbrainz" "go.uploadedlobster.com/scotty/internal/backends/listenbrainz"
) )
func TestNewClient(t *testing.T) { func TestNewClient(t *testing.T) {

View file

@ -22,7 +22,7 @@ import (
"time" "time"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
type ListenBrainzApiBackend struct { type ListenBrainzApiBackend struct {

View file

@ -23,8 +23,8 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/listenbrainz" "go.uploadedlobster.com/scotty/internal/backends/listenbrainz"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
func TestFromConfig(t *testing.T) { func TestFromConfig(t *testing.T) {

View file

@ -28,7 +28,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/listenbrainz" "go.uploadedlobster.com/scotty/internal/backends/listenbrainz"
) )
func TestTrackDurationMillisecondsInt(t *testing.T) { func TestTrackDurationMillisecondsInt(t *testing.T) {

View file

@ -0,0 +1,53 @@
{
"inserted_at": 1700580352,
"listened_at": 1700580273,
"recording_msid": "0a3144ea-f85c-4238-b0e3-e3d7a422df9d",
"track_metadata": {
"additional_info": {
"artist_names": [
"Dool"
],
"discnumber": 1,
"duration_ms": 413826,
"isrc": "DES561620801",
"music_service": "spotify.com",
"origin_url": "https://open.spotify.com/track/2JKUgGuXK3dEvyuIJ4Yj2V",
"recording_msid": "0a3144ea-f85c-4238-b0e3-e3d7a422df9d",
"release_artist_name": "Dool",
"release_artist_names": [
"Dool"
],
"spotify_album_artist_ids": [
"https://open.spotify.com/artist/101HSR6JTJqe3DBh6rb8kz"
],
"spotify_album_id": "https://open.spotify.com/album/5U1umzRH4EONHWsFgPtRbA",
"spotify_artist_ids": [
"https://open.spotify.com/artist/101HSR6JTJqe3DBh6rb8kz"
],
"spotify_id": "https://open.spotify.com/track/2JKUgGuXK3dEvyuIJ4Yj2V",
"submission_client": "listenbrainz",
"tracknumber": 5
},
"artist_name": "Dool",
"mbid_mapping": {
"artist_mbids": [
"24412926-c7bd-48e8-afad-8a285b42e131"
],
"artists": [
{
"artist_credit_name": "Dool",
"artist_mbid": "24412926-c7bd-48e8-afad-8a285b42e131",
"join_phrase": ""
}
],
"caa_id": 15991300316,
"caa_release_mbid": "d7f22677-9803-4d21-ba42-081b633a6f68",
"recording_mbid": "c0a1fc94-5f04-4a5f-bc09-e5de0c49cd12",
"recording_name": "Oweynagat",
"release_mbid": "aa1ea1ac-7ec4-4542-a494-105afbfe547d"
},
"release_name": "Here Now, There Then",
"track_name": "Oweynagat"
},
"user_name": "outsidecontext"
}

View file

@ -28,7 +28,7 @@ import (
"github.com/jarcoal/httpmock" "github.com/jarcoal/httpmock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/maloja" "go.uploadedlobster.com/scotty/internal/backends/maloja"
) )
func TestNewClient(t *testing.T) { func TestNewClient(t *testing.T) {

View file

@ -23,7 +23,7 @@ import (
"time" "time"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
type MalojaApiBackend struct { type MalojaApiBackend struct {

View file

@ -22,7 +22,7 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"go.uploadedlobster.com/scotty/backends/maloja" "go.uploadedlobster.com/scotty/internal/backends/maloja"
) )
func TestFromConfig(t *testing.T) { func TestFromConfig(t *testing.T) {

View file

@ -17,7 +17,7 @@ Scotty. If not, see <https://www.gnu.org/licenses/>.
package backends package backends
import "go.uploadedlobster.com/scotty/models" import "go.uploadedlobster.com/scotty/internal/models"
func ProcessListensImports(importer models.ListensImport, results chan models.ListensResult, out chan models.ImportResult, progress chan models.Progress) { func ProcessListensImports(importer models.ListensImport, results chan models.ListensResult, out chan models.ImportResult, progress chan models.Progress) {
defer close(out) defer close(out)

View file

@ -31,7 +31,7 @@ import (
"strings" "strings"
"time" "time"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
type ScrobblerLog struct { type ScrobblerLog struct {

View file

@ -30,8 +30,8 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/scrobblerlog" "go.uploadedlobster.com/scotty/internal/backends/scrobblerlog"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
var testScrobblerLog = `#AUDIOSCROBBLER/1.1 var testScrobblerLog = `#AUDIOSCROBBLER/1.1

View file

@ -23,7 +23,7 @@ import (
"time" "time"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
type ScrobblerLogBackend struct { type ScrobblerLogBackend struct {

View file

@ -21,7 +21,7 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"go.uploadedlobster.com/scotty/backends/scrobblerlog" "go.uploadedlobster.com/scotty/internal/backends/scrobblerlog"
) )
func TestFromConfig(t *testing.T) { func TestFromConfig(t *testing.T) {

View file

@ -29,7 +29,7 @@ import (
"github.com/jarcoal/httpmock" "github.com/jarcoal/httpmock"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/spotify" "go.uploadedlobster.com/scotty/internal/backends/spotify"
"golang.org/x/oauth2" "golang.org/x/oauth2"
) )

View file

@ -29,7 +29,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/spotify" "go.uploadedlobster.com/scotty/internal/backends/spotify"
) )
func TestRecentlyPlayedResult(t *testing.T) { func TestRecentlyPlayedResult(t *testing.T) {

View file

@ -26,7 +26,7 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/internal/auth" "go.uploadedlobster.com/scotty/internal/auth"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
"golang.org/x/oauth2" "golang.org/x/oauth2"
"golang.org/x/oauth2/spotify" "golang.org/x/oauth2/spotify"
) )

View file

@ -26,7 +26,7 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/backends/spotify" "go.uploadedlobster.com/scotty/internal/backends/spotify"
) )
func TestFromConfig(t *testing.T) { func TestFromConfig(t *testing.T) {

View file

@ -23,7 +23,7 @@ import (
"github.com/delucks/go-subsonic" "github.com/delucks/go-subsonic"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
type SubsonicApiBackend struct { type SubsonicApiBackend struct {

View file

@ -23,7 +23,7 @@ import (
go_subsonic "github.com/delucks/go-subsonic" go_subsonic "github.com/delucks/go-subsonic"
"github.com/spf13/viper" "github.com/spf13/viper"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"go.uploadedlobster.com/scotty/backends/subsonic" "go.uploadedlobster.com/scotty/internal/backends/subsonic"
) )
func TestFromConfig(t *testing.T) { func TestFromConfig(t *testing.T) {

View file

@ -18,7 +18,7 @@ package backends
import ( import (
"context" "context"
"go.uploadedlobster.com/scotty/storage" "go.uploadedlobster.com/scotty/internal/storage"
"golang.org/x/oauth2" "golang.org/x/oauth2"
) )

View file

@ -28,7 +28,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/models" "go.uploadedlobster.com/scotty/internal/models"
) )
func TestTrackArtistName(t *testing.T) { func TestTrackArtistName(t *testing.T) {

View file

@ -23,7 +23,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"go.uploadedlobster.com/scotty/storage" "go.uploadedlobster.com/scotty/internal/storage"
"golang.org/x/oauth2" "golang.org/x/oauth2"
) )