Discofy allows control of Spotify playback through Discord API, offering features like play/pause, track skipping, volume control, and device management.
Project description
Discofy
Wanna control Spotify playback API but you don't want to pay for a Spotify Premium? No problem!
Discofy is a Python library that allows you to control Spotify playback for free, without a premium subscription — just by using your Discord account.
Requirements
- Your Spotify account have to be connected to your Discord account (in Discord settings under "Connections").
- You must enable "Display Spotify as your status" in Discord.
- You need your Discord account token (check online resources on how to get it).
- Discofy will stop working shortly after you close the Discord app.
Features
- Spotify Integration: Control your Spotify playback through your Discord connection.
- Playback Control: Pause, resume, skip tracks, or go back to the previous one.
- Track Management: Play a specific song or add it to the queue.
- Volume Adjustment: Set the volume between 0 and 100.
- Shuffle & Repeat Modes: Enable or disable shuffle and repeat functions.
- Playback Monitoring: Get information about the currently playing track.
- Device Management: Transfer playback to another linked device.
- Seek to Position: Jump to a specific time in a track.
- Add to Queue: Queue tracks for playback.
Installation
To install Discofy, simply use pip:
pip install discofy
Available Commands
- pause_track() - Pauses the currently playing track.
- resume_track() - Resumes playback if paused.
- next_track() - Skips to the next track.
- previous_track() - Goes back to the previous track.
- play_track(track_uri: str) - Plays a specific track. Example:
client.play_track("spotify:track:PASTE_TRACK_ID") - set_volume(volume: int) - Changes the playback volume (0-100%). Example:
client.set_volume(10)# Sets volume to 10% - get_current_track() - Returns information about the currently playing track.
- shuffle(state: bool) - Toggles shuffle mode.
- repeat(state: str) - Changes the repeat mode ('track', 'context', or 'off').
- is_playing() - Returns True if music is playing, otherwise False.
- get_playback_state() - Retrieves information about the user's current playback state (track, progress, active device, etc.).
- transfer_playback(device_id: str, play: bool) - Moves playback to another device.
- get_available_devices() - Lists available Spotify Connect devices (some may not be supported).
- seek_to_position(position_ms: int) - Moves playback to a specific position in milliseconds.
- add_to_playback_queue(track_uri: str) - Adds a track to the queue. Example:
client.add_to_playback_queue("spotify:track:PASTE_TRACK_ID")
Example Usage
Basic Python script to control Spotify playback with Discofy:
from discofy import Discofy
# Set your Discord token
discord_token = "PASTE_YOUR_TOKEN_HERE"
client = Discofy(discord_token)
# Set volume to 10%
client.set_volume(10)
# Pause playback
client.pause_track()
# Print info about the currently playing track
print(client.get_current_track())
# Shows if something is being played
if judeify.is_playing():
print("Something is being played")
else:
print("Nothing is being played!")
License
Discofy is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
For more details, visit: https://creativecommons.org/licenses/by-sa/4.0/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discofy-1.3.tar.gz.
File metadata
- Download URL: discofy-1.3.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f42276b194e75ace66f21af0d6615399a9089ac9b1791c9dff8780aa577807e4
|
|
| MD5 |
4f0b9dbcfad223b4c73c5c3ace3e95a0
|
|
| BLAKE2b-256 |
d8e511d3c3fd652d550aae54dda440d57bb404d516bd24e44c7bf5ef807571b4
|
File details
Details for the file discofy-1.3-py3-none-any.whl.
File metadata
- Download URL: discofy-1.3-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73fda608dd61caaeccf76724758b753d32627e9a8e5cb843befdd8d45c299624
|
|
| MD5 |
7f112829f37d7f03ea6b84023781258a
|
|
| BLAKE2b-256 |
3c183e9f9129a5f33ef61bb80975492066a021374e4e2ea0efdf9823adb874f6
|