Skip to main content

Spotify Shuffle Assistant

Project description

SHUFFLEIFY DOCUMENTATION

We all use Spotify and we all love this software. But something is off inside it, especially shuffling... Have you ever felt that you were listening to the very same 10 songs every time you shuffled your hundreds song included playlist? Well, you are not alone... Which is why I started the 'Make Shuffle Great Again' campaign officially!

This package is about functionality, not other fancy UI/UX stuff. If you do some visual stuff, go ahead, the basic functionality is already ready for you!

Installation


pip install shuffleify

Quick Start

Copy, set things up, run!

from shuffleify.core import ApiHandler

import shuffleify.shuffler as shuffler



handler = ApiHandler(

    client_id='your client id',

    client_secret='your client secret'

)



playlist_id = handler.get_playlist_id('https://open.spotify.com/playlist/51gVMBShUWyqVcc3F65J2g?si=c8e60dc7f2494cc7')

tracks = handler.get_playlist_tracks(playlist_id)

tracks = shuffler.true_shuffle(tracks)



handler.create_playlist(tracks)

Authentication

First of all, get your client id and secret from (there)[https://developer.spotify.com/]. Then run this:

from shuffleify.core import ApiHandler



handler = ApiHandler(

    client_id='your client id',

    client_secret='your client secret'

)

Getting Songs

In order to get songs from playlists and albums, you need their ID. With these functions, you can obtain the information from their URL.

playlist_id = handler.get_playlist_id('https://open.spotify.com/playlist/51gVMBShUWyqVcc3F65J2g?si=c8e60dc7f2494cc7')

album_id = handler.get_album_id('https://open.spotify.com/album/00eiw4KOJZ7eC3NBEpmH4C?si=TWb4oQBEQqODOeTjpwBSqw')

track_id = handler.get_track_id('https://open.spotify.com/track/76gcXhY3Zv6wW0BTe9nHJo?si=1f4f118a1fdf40fe')

Then, you can easily get all tracks from them:

tracks = []

tracks.append(track_id)

tracks.extend(handler.get_album_tracks(album_id)) #getting songs from the album

tracks.extend(handler.get_playlist_tracks(playlist_id)) #getting songs from the playlist

Shuffling

There are two ways of shuffling in Shuffleify: True Shuffling and Fair Shuffling.

True Shuffling

Each song in the 'tracks' list has the very same chance. The only true way of shuffling.

import  shuffleify.shuffler as shuffler



tracks = shuffler.true_shuffle(tracks)

| parameter | datatype | use case | default value |

| --- | --- | --- | --- |

| tracks | list | all songs that requested | |

| limit | list | maximum size of shuffled list | None |

Important: If 'limit' is None or greater than size of tracks or less than 1 then it becomes equal to the length of the tracks list.

Fair Shuffling

If a song was randomly selected, it does not mean that it will be deleted from the tracks' selection pool. In other words, every song has the chance of being multiple times in the final list.

import  shuffleify.shuffler as shuffler



tracks = shuffler.fair_shuffle(tracks, 10)

| parameter | datatype |

| --- | --- |

| tracks | list |

| size | integer |

Creating The List

handler.create_playlist(

    tracks,

    playlist_name='Playlist name here',

    description='this is the description part',

    public=True

)

Except tracks, all the other parameters have default values, so configuring them is optional.

| parameter | default value |

| --- | --- |

| playlist_name | 'Shuffled!' |

| description | 'created by shuffleify' |

| public | True |

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shuffleify-1.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shuffleify-1.0.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file shuffleify-1.0.0.tar.gz.

File metadata

  • Download URL: shuffleify-1.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.0

File hashes

Hashes for shuffleify-1.0.0.tar.gz
Algorithm Hash digest
SHA256 92d0b8a3a8b49ac151bb6138bb4558c9ee62d7c25a53faf4a7e67c2121745002
MD5 a3b167ca5d6dd9e8bd85076a8e40c406
BLAKE2b-256 4fbf29a21d4e2f71a848b6b563a97b4dab529adef89c2f67e2a8d3decc495a53

See more details on using hashes here.

File details

Details for the file shuffleify-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: shuffleify-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.0

File hashes

Hashes for shuffleify-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6856a23a1c2adb86695abfcee65c2e4a72fd25f57aca6507cdc00891aec607d7
MD5 218d59e28416a1429beefa946325225d
BLAKE2b-256 189ca88aa9cf2c26dc21d7cdf3d1bd516284e85e7228d1fb7fc4354c9a26a40b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page