Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Spotify playlist generator #140

Merged
merged 7 commits into from
Oct 26, 2020

Conversation

sandyjswl
Copy link
Contributor

@sandyjswl sandyjswl commented Oct 2, 2020

Spotify Playlist Generator

Generate multiple playlists of a given size from a large Spotify playlist.

Fixes (#140 )

Type of change

Choosing one or more options from the following as per the nature of your Pull request.

  • NOTE: These boxes can be checked using [X]

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Documentation Update

Checklist:

Please tick all the boxes that are fulfilled by your Pull Request.

  • I have named my files and folder, according to this project's guidelines.
  • My code follows the style guidelines of this project.
  • My Pull Request has a descriptive title. (not a vague title like Update index.md)
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have created a helpful and easy to understand README.md, according to the given README_TEMPLATE.
  • I have included a requirements.txt file (if external libraries are required.)
  • My changes do not produce any warnings.
  • I have added a working sample/screenshot of the script.

@sandyjswl
Copy link
Contributor Author

@AdityaJ7 Can you please review this?

Copy link
Member

@AdityaJ7 AdityaJ7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment your code everything else looks good to me

@sandyjswl
Copy link
Contributor Author

sandyjswl commented Oct 2, 2020

Please comment your code everything else looks good to me

@AdityaJ7 Added comments, can you please merge the PR?

@AdityaJ7
Copy link
Member

AdityaJ7 commented Oct 2, 2020

Please comment your code everything else looks good to me

@AdityaJ7 Added comments, can you please merge the PR?

Will be merged automatically when two approved reviews are received

Copy link
Member

@tusharnankani tusharnankani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove unnecessary blank lines from the code?

Also, add id, a playlist for testing purposes.

Comment on lines +12 to +17
1. [Create Spotify Developers Account and create a new app](https://developer.spotify.com/)
2. Export Client Id, Client Secret and Redirect URI
* `export SPOTIPY_CLIENT_ID='your-spotify-client-id'`
* `export SPOTIPY_CLIENT_SECRET='your-spotify-client-secret'`
* `export SPOTIPY_REDIRECT_URI='your-app-redirect-url'`
3. `python main.py -p [playlist_id] -l [size_of_each_playlist]`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Can you add a test id and playlist? For viewers to test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I don't have a test account on Spotify, i tested these on my personal account.


### Screenshot/GIF showing the sample use of the script
<!--Remove the below lines and add yours -->
![alt text](/screenshots/screenshot.png)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove /

Suggested change
![alt text](/screenshots/screenshot.png)
![alt text](screenshots/screenshot.png)

spotipy_instance = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope, cache_path=os.getcwd()))


# Method to read the command line arguments and parse them
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of adding comments outside from functions make doc string inside in functions

Suggested change
# Method to read the command line arguments and parse them
def get_args():
"""Method to read the command line arguments and parse them
Input:
Output:
"""

def get_track_ids_for_playlist(playlist):
res = []
for song in playlist:
#Extract the ID of the track
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when you are writing single line command use after you statement

Suggested change
#Extract the ID of the track
res.append(song['track']['id']) # Extract the ID of the track

# This method generates smaller playlists from the input playlist
def generate_playlists(playlist_size, playlist_songs, user_id):
# Create the smaller playlists from the given large playlist
smaller_playlists = [playlist_songs[x:x + playlist_size] for x in range(0, len(playlist_songs), playlist_size)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Limit all lines to a maximum of 79 characters.

Suggested change
smaller_playlists = [playlist_songs[x:x + playlist_size] for x in range(0, len(playlist_songs), playlist_size)]
smaller_playlists = [playlist_songs[x:x + playlist_size] for x in
range(0, len(playlist_songs), playlist_size)]

@tusharnankani
Copy link
Member

Are you working on it? @sandyjswl

@sandyjswl
Copy link
Contributor Author

Hi, I'll fix the changes tommorow. I won't be able to the ID and Playlist because I don't to expose my personal playlist. But I can make the other changes.

@sandyjswl
Copy link
Contributor Author

@tusharnankani @AdityaJ7 Can you merge this now?

@mergify mergify bot merged commit 251d79f into Python-World:master Oct 26, 2020
@AdityaJ7
Copy link
Member

@allcontributors please add @sandyjswl for code

@allcontributors
Copy link
Contributor

@AdityaJ7

I've put up a pull request to add @sandyjswl! 🎉

@github-actions
Copy link

Python World does not accept pull requests on this repository anymore.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 10, 2022
@mergify mergify bot added the nice-job label Jun 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants