Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.

Commit 4ad50ce

Browse files
committed
opt lastfm, docs
1 parent 695e490 commit 4ad50ce

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ func configDefaults(v *viper.Viper) {
306306

307307
v.SetDefault("Fanart.ProjectKey", "93ede276ba6208318031727060b697c8")
308308

309-
v.SetDefault("LastFM.Key", "none")
310-
v.SetDefault("LastFM.Secret", "none")
309+
v.SetDefault("LastFM.Key", "")
310+
v.SetDefault("LastFM.Secret", "")
311311

312312
v.SetDefault("Music.ArtistRadioBreadth", "10")
313313
v.SetDefault("Music.ArtistRadioDepth", "3")

doc/actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Actions
22

33
Note - this will stop working June 13, 2023 due to
4-
(Converstational Actions Sunset)[https://developers.google.com/assistant/ca-sunset]
4+
[Converstational Actions Sunset](https://developers.google.com/assistant/ca-sunset)
55

66
Takeout optionally supports a Google Assistant webhook to play music using the
77
Google Assistant app, Nest Audio, Nest Hub, Google Home, and related products

doc/setup.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
This setup assumes the use of a UNIX system such as Linux. Takeout is written
66
in Go, so most systems will work just fine. Please adjust commands below as
7-
needed. You can setup on a virtual system in the cloud such as EC2, GCE,
8-
Digital Ocean, Linode, or use your spiffy computer at home.
7+
needed. You can setup on a virtual private server (VPS) in the cloud such as
8+
EC2, GCE, Digital Ocean, Linode, or use your spiffy computer at home.
99

1010
You need to have media stored in an S3 bucket somewhere. Some common services
1111
are AWS S3, Wasabi, Backblaze, and Minio. And if you're using that spiffy home
@@ -14,15 +14,25 @@ available via S3 to your home network. The other bucket services cost money,
1414
however you have the added benefit of having your media securely available
1515
wherever you go.
1616

17+
General VPS requirements:
18+
* Network - monthly 8GB in / 300MB out (depends on usage)
19+
* Storage - 500MB for databases and search index
20+
* CPU - Shared CPU with 1 core, 1GB RAM
21+
22+
A recommended cloud setup would be:
23+
* Linode (Nanode 1GB $5/mo) for running Takeout
24+
* Wasabi ($5.99 TB/mo) for S3 media
25+
26+
Remember that Takeout indirectly streams media and instead redirects
27+
clients/apps to the S3 bucket using pre-signed time-based URLs for
28+
streaming. Any media streaming network costs are only related to the S3 bucket
29+
provider and not the VPS.
30+
1731
Please see [bucket.md](bucket.md) for further details on how you should
1832
organize your media in S3. [rclone](https://rclone.org) is an excellent tool to
1933
manage S3 buckets from the command line. Once that's all done, proceed with the
2034
steps below.
2135

22-
One recommended cloud setup would be:
23-
* Linode (Nanode 1GB $5/mo) for running Takeout
24-
* Wasabi ($5.99 TB/mo) for S3 media
25-
2636
## Steps
2737

2838
Download and install Go from [https://go.dev/](https://go.dev/) as needed. Run

lib/lastfm/lastfm.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ type TopTrack struct {
4848
}
4949

5050
func (m *Lastfm) ArtistTopTracks(arid string) []TopTrack {
51+
if m.config.LastFM.Key == "" || m.config.LastFM.Secret == "" {
52+
return make([]TopTrack, 0)
53+
}
54+
5155
client.RateLimit("last.fm")
5256
api := lfm.New(m.config.LastFM.Key, m.config.LastFM.Secret)
5357

@@ -68,6 +72,10 @@ func (m *Lastfm) ArtistTopTracks(arid string) []TopTrack {
6872
}
6973

7074
func (m *Lastfm) SimilarArtists(arid string) map[string]float64 {
75+
if m.config.LastFM.Key == "" || m.config.LastFM.Secret == "" {
76+
return make(map[string]float64)
77+
}
78+
7179
client.RateLimit("last.fm")
7280
api := lfm.New(m.config.LastFM.Key, m.config.LastFM.Secret)
7381
result, _ := api.Artist.GetSimilar(lfm.P{"mbid": arid})
@@ -94,6 +102,10 @@ func (m *Lastfm) SimilarArtists(arid string) map[string]float64 {
94102
}
95103

96104
func (m *Lastfm) ArtistSearch(name string) (string, string) {
105+
if m.config.LastFM.Key == "" || m.config.LastFM.Secret == "" {
106+
return "", ""
107+
}
108+
97109
client.RateLimit("last.fm")
98110
api := lfm.New(m.config.LastFM.Key, m.config.LastFM.Secret)
99111
result, _ := api.Artist.Search(lfm.P{"artist": name})

0 commit comments

Comments
 (0)