File tree Expand file tree Collapse file tree 6 files changed +17
-3
lines changed Expand file tree Collapse file tree 6 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ services:
45
45
- SPOTIFY_PASSWORD=
46
46
- DISCORD_USER_ID= # Discord user ID of the user you want Aoede to follow
47
47
- SPOTIFY_BOT_AUTOPLAY= # Autoplay similar songs when your music ends (true/false)
48
+ - SPOTIFY_DEVICE_NAME=
48
49
` ` `
49
50
50
51
### Docker:
@@ -55,6 +56,7 @@ SPOTIFY_USERNAME=
55
56
SPOTIFY_PASSWORD=
56
57
DISCORD_USER_ID=
57
58
SPOTIFY_BOT_AUTOPLAY=
59
+ SPOTIFY_DEVICE_NAME=
58
60
```
59
61
60
62
``` bash
Original file line number Diff line number Diff line change @@ -2,4 +2,5 @@ DISCORD_TOKEN="the discord bot token"
2
2
SPOTIFY_USERNAME =" your spotify email"
3
3
SPOTIFY_PASSWORD =" your spotify password"
4
4
DISCORD_USER_ID =" your discord id here"
5
- SPOTIFY_BOT_AUTOPLAY =true
5
+ SPOTIFY_BOT_AUTOPLAY =true
6
+ SPOTIFY_DEVICE_NAME =" custom device name in spotify, optional"
Original file line number Diff line number Diff line change @@ -16,6 +16,13 @@ pub struct Config {
16
16
pub discord_user_id : u64 ,
17
17
#[ serde( alias = "SPOTIFY_BOT_AUTOPLAY" ) ]
18
18
pub spotify_bot_autoplay : bool ,
19
+ #[ serde( alias = "SPOTIFY_DEVICE_NAME" ) ]
20
+ #[ serde( default = "default_spotify_device_name" ) ]
21
+ pub spotify_device_name : String ,
22
+ }
23
+
24
+ fn default_spotify_device_name ( ) -> String {
25
+ "Aoede" . to_string ( )
19
26
}
20
27
21
28
impl Config {
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ pub struct SpotifyPlayer {
38
38
pub event_channel : Option < Arc < tokio:: sync:: Mutex < PlayerEventChannel > > > ,
39
39
mixer : Box < SoftMixer > ,
40
40
pub bot_autoplay : bool ,
41
+ pub device_name : String ,
41
42
}
42
43
43
44
pub struct EmittedSink {
@@ -208,6 +209,7 @@ impl SpotifyPlayer {
208
209
quality : Bitrate ,
209
210
cache_dir : Option < String > ,
210
211
bot_autoplay : bool ,
212
+ device_name : String ,
211
213
) -> SpotifyPlayer {
212
214
let credentials = Credentials :: with_password ( username, password) ;
213
215
@@ -259,12 +261,13 @@ impl SpotifyPlayer {
259
261
event_channel : Some ( Arc :: new ( tokio:: sync:: Mutex :: new ( rx) ) ) ,
260
262
mixer,
261
263
bot_autoplay,
264
+ device_name,
262
265
}
263
266
}
264
267
265
268
pub async fn enable_connect ( & mut self ) {
266
269
let config = ConnectConfig {
267
- name : "Aoede" . to_string ( ) ,
270
+ name : self . device_name . clone ( ) ,
268
271
device_type : DeviceType :: AudioDongle ,
269
272
initial_volume : None ,
270
273
has_volume_ctrl : true ,
Original file line number Diff line number Diff line change @@ -305,6 +305,7 @@ async fn main() {
305
305
Bitrate :: Bitrate320 ,
306
306
cache_dir,
307
307
config. spotify_bot_autoplay ,
308
+ config. spotify_device_name . clone ( ) ,
308
309
)
309
310
. await ,
310
311
) ) ;
You can’t perform that action at this time.
0 commit comments