Skip to content

Commit 52fbbb7

Browse files
committed
Fix rebase
1 parent eaa26bb commit 52fbbb7

5 files changed

Lines changed: 47 additions & 73 deletions

File tree

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module explo
22

33
go 1.23.0
44

5-
toolchain go1.24.2
5+
toolchain go1.24.3
66

77
require (
88
github.com/ilyakaznacheev/cleanenv v1.5.0
@@ -16,9 +16,7 @@ require (
1616
github.com/aws/aws-sdk-go v1.38.20 // indirect
1717
github.com/jmespath/go-jmespath v0.4.0 // indirect
1818
github.com/joho/godotenv v1.5.1 // indirect
19-
github.com/stretchr/testify v1.10.0 // indirect
2019
github.com/u2takey/go-utils v0.3.1 // indirect
21-
golang.org/x/net v0.39.0 // indirect
2220
gopkg.in/yaml.v3 v3.0.1 // indirect
2321
olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 // indirect
2422
)

go.sum

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTd
3838
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
3939
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
4040
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
41+
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
4142
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
42-
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
43-
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
4443
github.com/u2takey/ffmpeg-go v0.5.0 h1:r7d86XuL7uLWJ5mzSeQ03uvjfIhiJYvsRAJFCW4uklU=
4544
github.com/u2takey/ffmpeg-go v0.5.0/go.mod h1:ruZWkvC1FEiUNjmROowOAps3ZcWxEiOpFoHCvk97kGc=
4645
github.com/u2takey/go-utils v0.3.1 h1:TaQTgmEZZeDHQFYfd+AdUT1cT4QJgJn/XVPELhHw4ys=
@@ -54,18 +53,18 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
5453
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
5554
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
5655
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
56+
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
5757
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
58-
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
59-
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
58+
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
59+
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
6060
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
6161
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
6262
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
6363
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
6464
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
6565
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
66+
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
6667
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
67-
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
68-
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
6968
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
7069
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
7170
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

src/downloader/downloader.go

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
package downloader
22

33
import (
4+
"fmt"
45
"log"
56
"os"
67
"path"
7-
<<<<<<< HEAD
8-
"log"
9-
"strings"
108
"regexp"
11-
"fmt"
9+
"strings"
10+
1211
"golang.org/x/sync/errgroup"
13-
=======
14-
>>>>>>> 3f855d8 (Implement initial support for Lidarr downloader)
1512

1613
cfg "explo/src/config"
1714
"explo/src/models"
@@ -35,53 +32,48 @@ func NewDownloader(cfg *cfg.DownloadConfig, httpClient *util.HttpClient) *Downlo
3532
switch service {
3633
case "youtube":
3734
downloader = append(downloader, NewYoutube(cfg.Youtube, cfg.Discovery, cfg.DownloadDir, httpClient))
38-
<<<<<<< HEAD
3935
case "slskd":
4036
slskdClient := NewSlskd(cfg.Slskd)
4137
slskdClient.AddHeader()
4238
downloader = append(downloader, slskdClient)
4339
default:
4440
log.Fatalf("downloader '%s' not supported", service)
45-
=======
46-
case "lidarr":
47-
downloader = append(downloader, NewLidarr(cfg.Lidarr, cfg.Discovery, cfg.DownloadDir, httpClient))
48-
>>>>>>> 3f855d8 (Implement initial support for Lidarr downloader)
4941
}
5042
}
5143
return &DownloadClient{
5244
Cfg: cfg,
5345
Downloaders: downloader}
5446
}
5547

56-
func (c *DownloadClient) StartDownload(tracks *[]*models.Track) {
57-
for _, d := range c.Downloaders {
58-
var g errgroup.Group
59-
g.SetLimit(5)
60-
61-
for _, track := range *tracks {
62-
if track.Present {
63-
continue
48+
func (c *DownloadClient) StartDownload(tracks *[]*models.Track) {
49+
for _, d := range c.Downloaders {
50+
var g errgroup.Group
51+
g.SetLimit(5)
52+
53+
for _, track := range *tracks {
54+
if track.Present {
55+
continue
56+
}
57+
58+
g.Go(func() error {
59+
60+
if err := d.QueryTrack(track); err != nil {
61+
log.Println(err.Error())
62+
return nil
6463
}
65-
66-
g.Go(func() error {
67-
68-
if err := d.QueryTrack(track); err != nil {
69-
log.Println(err.Error())
70-
return nil
71-
}
72-
if err := d.GetTrack(track); err != nil {
73-
log.Println(err.Error())
74-
return nil
75-
}
64+
if err := d.GetTrack(track); err != nil {
65+
log.Println(err.Error())
7666
return nil
77-
})
67+
}
68+
return nil
69+
})
7870
}
7971
if err := g.Wait(); err != nil {
8072
return
8173
}
82-
74+
8375
if err := d.MonitorDownloads(*tracks); err != nil {
84-
log.Printf("track monitoring failed: %s", err.Error())
76+
log.Printf("track monitoring failed: %s", err.Error())
8577
}
8678
}
8779
filterTracks(tracks)
@@ -113,14 +105,13 @@ func filterTracks(tracks *[]*models.Track) { // only keep tracks that were downl
113105
}
114106
*tracks = filteredTracks
115107
}
116-
<<<<<<< HEAD
117108

118109
func containsLower(str string, substr string) bool {
119110

120111
return strings.Contains(
121-
strings.ToLower(str),
122-
strings.ToLower(substr),
123-
)
112+
strings.ToLower(str),
113+
strings.ToLower(substr),
114+
)
124115
}
125116

126117
func sanitizeName(s string) string { // return string with only letters and digits
@@ -135,7 +126,5 @@ func getFilename(title, artist string) string {
135126
t := re.ReplaceAllString(title, "_")
136127
a := re.ReplaceAllString(artist, "_")
137128

138-
return fmt.Sprintf("%s-%s",t,a)
129+
return fmt.Sprintf("%s-%s", t, a)
139130
}
140-
=======
141-
>>>>>>> 3f855d8 (Implement initial support for Lidarr downloader)

src/main/main.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,11 @@ func main() {
3333

3434
cfg := config.ReadEnv()
3535
setup(&cfg)
36-
<<<<<<< HEAD
3736
httpClient := initHttpClient()
3837
client, err := client.NewClient(&cfg, httpClient)
3938
if err != nil {
4039
log.Fatal(err)
4140
}
42-
=======
43-
httpClient := initHttpClient(&cfg)
44-
client := client.NewClient(&cfg, httpClient)
45-
>>>>>>> 3f855d8 (Implement initial support for Lidarr downloader)
4641
discovery := discovery.NewDiscoverer(cfg.DiscoveryCfg, httpClient)
4742
downloader := downloader.NewDownloader(&cfg.DownloadCfg, httpClient)
4843

src/models/types.go

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,17 @@ package models
33
// for structs used across the project
44

55
type Track struct {
6-
Album string
7-
AlbumMBID string
8-
ID string
9-
Artist string // All artists as returned by LB
10-
ArtistMBID string
11-
MainArtist string
6+
Album string
7+
AlbumMBID string
8+
ID string
9+
Artist string // All artists as returned by LB
10+
ArtistMBID string
11+
MainArtist string
1212
MainArtistID string
13-
CleanTitle string // Title as returned by LB
14-
<<<<<<< HEAD
15-
Title string // Title as built in listenbrainz.go
16-
File string // File name
17-
Size int // File size
18-
Present bool // is track present in the system or not
19-
Duration int // Track duration in milliseconds (not available for every track)
13+
CleanTitle string // Title as returned by LB
14+
Title string // Title as built in listenbrainz.go
15+
File string // File name
16+
Size int // File size
17+
Present bool // is track present in the system or not
18+
Duration int // Track duration in milliseconds (not available for every track)
2019
}
21-
=======
22-
Title string // Title as built in BuildTracks()
23-
File string // File name
24-
Present bool // is track present in the system or not
25-
}
26-
>>>>>>> 3f855d8 (Implement initial support for Lidarr downloader)

0 commit comments

Comments
 (0)