-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from dvdmuckle/dev
Release 1.2.0
- Loading branch information
Showing
29 changed files
with
151 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
|
@@ -29,6 +29,7 @@ var pauseCmd = &cobra.Command{ | |
helper.SetClient(&conf) | ||
helper.Pause(&conf) | ||
}, | ||
Aliases: []string{"stop"}, | ||
} | ||
|
||
func init() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
@@ -67,16 +67,16 @@ only save the current playlist`, | |
break | ||
} | ||
} | ||
discoverPlaylistTracks := func() spotify.PlaylistTrackPage { | ||
playlistTracks, err := conf.Client.GetPlaylistTracks(ctx, discoverPlaylist) | ||
discoverPlaylistTracks := func() spotify.PlaylistItemPage { | ||
playlistTracks, err := conf.Client.GetPlaylistItems(ctx, discoverPlaylist) | ||
if err != nil { | ||
helper.LogErrorAndExit(err) | ||
} | ||
return *playlistTracks | ||
} | ||
var discoverPlaylistTrackIDs []spotify.ID | ||
for _, track := range discoverPlaylistTracks().Tracks { | ||
discoverPlaylistTrackIDs = append(discoverPlaylistTrackIDs, track.Track.ID) | ||
for _, track := range discoverPlaylistTracks().Items { | ||
discoverPlaylistTrackIDs = append(discoverPlaylistTrackIDs, track.Track.Track.ID) | ||
} | ||
conf.Client.AddTracksToPlaylist(ctx, newPlaylist.ID, discoverPlaylistTrackIDs...) | ||
fmt.Printf("Discover Weekly saved as %s\n", playlistName) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/dvdmuckle/spc/cmd/helper" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// shuffleCmd represents the shuffle command | ||
var shuffleCmd = &cobra.Command{ | ||
Use: "shuffle", | ||
Short: "Toggle Spotify shuffle", | ||
Long: `Will toggle shuffle on or off depending on its previous state`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
helper.SetClient(&conf) | ||
ctx := context.Background() | ||
forceSetShuffle, _ := cmd.Flags().GetBool("set") | ||
if forceSetShuffle { | ||
conf.Client.Shuffle(ctx, true) | ||
return | ||
} | ||
state, err := conf.Client.PlayerState(ctx) | ||
if err != nil { | ||
helper.LogErrorAndExit("Error getting player state: ", err) | ||
} | ||
conf.Client.Shuffle(ctx, !state.ShuffleState) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(shuffleCmd) | ||
shuffleCmd.Flags().BoolP("set", "s", false, "Set the shuffle state to on regardless of current state") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
@@ -67,7 +67,7 @@ and can also switch playback to the already configured device.`, | |
transferPlayback(&conf, shouldPlay) | ||
} | ||
if err := viper.WriteConfigAs(cfgFile); err != nil { | ||
helper.LogErrorAndExit("Error writing config:", err) | ||
helper.LogErrorAndExit("Error writing config: ", err) | ||
} | ||
fmt.Println("Switched to", conf.DeviceID.String()) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright © 2021 David Muckle <[email protected]> | ||
Copyright © 2024 David Muckle <[email protected]> | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
spc (1.2.0-1) jammy; urgency=medium | ||
|
||
* Add shuffle command | ||
* Update copyright | ||
* Update dependencies | ||
|
||
-- David Muckle <[email protected]> Sun, 28 Jan 2024 16:17:28 -0500 | ||
|
||
spc (1.1.7-1) jammy; urgency=medium | ||
|
||
* Update dependencies | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## spc shuffle | ||
|
||
Toggle Spotify shuffle | ||
|
||
### Synopsis | ||
|
||
Will toggle shuffle on or off depending on its previous state | ||
|
||
``` | ||
spc shuffle [flags] | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for shuffle | ||
-s, --set Set the shuffle state to on regardless of current state | ||
``` | ||
|
||
### Options inherited from parent commands | ||
|
||
``` | ||
--config string Config file (default is $HOME/.config/spc/config.yaml) | ||
-v, --verbose verbose error logging | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [spc](spc.md) - Command line tool to control Spotify | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.