# 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!
```python
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:
```python
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.
```python
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:
```python
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.
```python
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.
```python
import shuffleify.shuffler as shuffler
tracks = shuffler.fair_shuffle(tracks, 10)
```
| parameter | datatype |
| --- | --- |
| tracks | list |
| size | integer |
## Creating The List
```python
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 |
Raw data
{
"_id": null,
"home_page": null,
"name": "shuffleify",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, spotify, shuffling",
"author": "iamalreadynoob",
"author_email": "<sadikefe69@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/4f/bf/29a21d4e2f71a848b6b563a97b4dab529adef89c2f67e2a8d3decc495a53/shuffleify-1.0.0.tar.gz",
"platform": null,
"description": "\r\n# SHUFFLEIFY DOCUMENTATION\r\r\n\r\r\nWe 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!\r\r\n\r\r\nThis 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!\r\r\n\r\r\n## Installation\r\r\n\r\r\n```\r\r\npip install shuffleify\r\r\n```\r\r\n\r\r\n## Quick Start\r\r\n\r\r\nCopy, set things up, run!\r\r\n\r\r\n```python\r\r\nfrom shuffleify.core import ApiHandler\r\r\nimport shuffleify.shuffler as shuffler\r\r\n\r\r\nhandler = ApiHandler(\r\r\n client_id='your client id',\r\r\n client_secret='your client secret'\r\r\n)\r\r\n\r\r\nplaylist_id = handler.get_playlist_id('https://open.spotify.com/playlist/51gVMBShUWyqVcc3F65J2g?si=c8e60dc7f2494cc7')\r\r\ntracks = handler.get_playlist_tracks(playlist_id)\r\r\ntracks = shuffler.true_shuffle(tracks)\r\r\n\r\r\nhandler.create_playlist(tracks)\r\r\n```\r\r\n\r\r\n## Authentication\r\r\n\r\r\nFirst of all, get your client id and secret from (there)[https://developer.spotify.com/]. Then run this:\r\r\n\r\r\n```python\r\r\nfrom shuffleify.core import ApiHandler\r\r\n\r\r\nhandler = ApiHandler(\r\r\n client_id='your client id',\r\r\n client_secret='your client secret'\r\r\n)\r\r\n```\r\r\n## Getting Songs\r\r\n\r\r\nIn order to get songs from playlists and albums, you need their ID. With these functions, you can obtain the information from their URL.\r\r\n\r\r\n```python\r\r\nplaylist_id = handler.get_playlist_id('https://open.spotify.com/playlist/51gVMBShUWyqVcc3F65J2g?si=c8e60dc7f2494cc7')\r\r\nalbum_id = handler.get_album_id('https://open.spotify.com/album/00eiw4KOJZ7eC3NBEpmH4C?si=TWb4oQBEQqODOeTjpwBSqw')\r\r\ntrack_id = handler.get_track_id('https://open.spotify.com/track/76gcXhY3Zv6wW0BTe9nHJo?si=1f4f118a1fdf40fe')\r\r\n```\r\r\n\r\r\nThen, you can easily get all tracks from them:\r\r\n\r\r\n```python\r\r\ntracks = []\r\r\ntracks.append(track_id)\r\r\ntracks.extend(handler.get_album_tracks(album_id)) #getting songs from the album\r\r\ntracks.extend(handler.get_playlist_tracks(playlist_id)) #getting songs from the playlist\r\r\n```\r\r\n\r\r\n## Shuffling\r\r\n\r\r\nThere are two ways of shuffling in Shuffleify: True Shuffling and Fair Shuffling.\r\r\n\r\r\n### True Shuffling\r\r\n\r\r\nEach song in the 'tracks' list has the very same chance. The only **true** way of shuffling.\r\r\n\r\r\n```python\r\r\nimport shuffleify.shuffler as shuffler\r\r\n\r\r\ntracks = shuffler.true_shuffle(tracks)\r\r\n```\r\r\n\r\r\n| parameter | datatype | use case | default value |\r\r\n| --- | --- | --- | --- |\r\r\n| tracks | list | all songs that requested | |\r\r\n| limit | list | maximum size of shuffled list | None |\r\r\n\r\r\n**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.\r\r\n\r\r\n### Fair Shuffling\r\r\n\r\r\nIf 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.\r\r\n\r\r\n```python\r\r\nimport shuffleify.shuffler as shuffler\r\r\n\r\r\ntracks = shuffler.fair_shuffle(tracks, 10)\r\r\n```\r\r\n\r\r\n| parameter | datatype |\r\r\n| --- | --- |\r\r\n| tracks | list |\r\r\n| size | integer |\r\r\n\r\r\n## Creating The List\r\r\n\r\r\n```python\r\r\nhandler.create_playlist(\r\r\n tracks,\r\r\n playlist_name='Playlist name here',\r\r\n description='this is the description part',\r\r\n public=True\r\r\n)\r\r\n```\r\r\n\r\r\nExcept tracks, all the other parameters have default values, so configuring them is **optional**.\r\r\n\r\r\n| parameter | default value | \r\r\n| --- | --- |\r\r\n| playlist_name | 'Shuffled!' |\r\r\n| description | 'created by shuffleify' |\r\r\n| public | True |\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Spotify Shuffle Assistant",
"version": "1.0.0",
"project_urls": null,
"split_keywords": [
"python",
" spotify",
" shuffling"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "189ca88aa9cf2c26dc21d7cdf3d1bd516284e85e7228d1fb7fc4354c9a26a40b",
"md5": "218d59e28416a1429beefa946325225d",
"sha256": "6856a23a1c2adb86695abfcee65c2e4a72fd25f57aca6507cdc00891aec607d7"
},
"downloads": -1,
"filename": "shuffleify-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "218d59e28416a1429beefa946325225d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4704,
"upload_time": "2024-12-17T18:09:37",
"upload_time_iso_8601": "2024-12-17T18:09:37.030569Z",
"url": "https://files.pythonhosted.org/packages/18/9c/a88aa9cf2c26dc21d7cdf3d1bd516284e85e7228d1fb7fc4354c9a26a40b/shuffleify-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4fbf29a21d4e2f71a848b6b563a97b4dab529adef89c2f67e2a8d3decc495a53",
"md5": "a3b167ca5d6dd9e8bd85076a8e40c406",
"sha256": "92d0b8a3a8b49ac151bb6138bb4558c9ee62d7c25a53faf4a7e67c2121745002"
},
"downloads": -1,
"filename": "shuffleify-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "a3b167ca5d6dd9e8bd85076a8e40c406",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4526,
"upload_time": "2024-12-17T18:09:41",
"upload_time_iso_8601": "2024-12-17T18:09:41.837282Z",
"url": "https://files.pythonhosted.org/packages/4f/bf/29a21d4e2f71a848b6b563a97b4dab529adef89c2f67e2a8d3decc495a53/shuffleify-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-17 18:09:41",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "shuffleify"
}