{ "info": { "author": "Matthew Russell", "author_email": "astromars42@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Spomato\n\nWelcome!\n\nThis project is intended to be a way to generate playlists through the Spotify API. The main purpose was to create a number of Tomato Timer length playlists through Spotify (hence the name Spomato, yeah, its silly). \n\n## Installation\n\nYou can pip install it straight from git:\n```\npip install git+git://github.com/pm8k/spomato.git\n```\n\nYou will also need to install the driver for chrome:\n```\nbrew install chromedriver\n```\n\n## Set up Spotipy\n\n### Create Spotify Application\n\nYou will need to create an application for your use as detailed in the [Spotipy](https://spotipy.readthedocs.io/en/latest/#authorized-requests) documentation.\n\n### Set Environment Variables\n\nThe token generation uses [Spotipy's](http://spotipy.readthedocs.io/en/latest/#authorization-code-flow) Authorization Code Flow from the Spotify API. Make sure to correctly set up Spotipy through their tutorial, and set the following environment variables:\n```\nexport SPOTIPY_CLIENT_ID='your-spotify-client-id'\nexport SPOTIPY_CLIENT_SECRET='your-spotify-client-secre'\nexport SPOTIPY_REDIRECT_URI='your-app-redirect-url'\n```\n\n## Set Up Spomato\n\n### Set Environment Variables\n\nAs Spomato logs into your Spotify account information to log in, you will need to set these as environment variables.\n```\nexport SPOMATO_USERNAME='your@email.com'\nexport SPOMATO_PASSWORD='password'\n```\nThis works for a Spotify account and a Facebook account. You need to make sure you declare which log in method you are using when you create your token.\n\n## Using Spomato\n\n### Create a Token and Connection\n\nCreating a connection to Spotify is easy:\n```\ntoken,token_info = get_token()\nsp = spotipy.Spotify(auth=token)\n```\n\n### Fetching Data\n\n\nThe first step you will need is a data source.\n\n```\ndf = get_data(sp=sp, profile_name='liked_songs', reset=False)\n ```\n\nYou can fetch the corresponding data and return it to a pandas DataFrame. The default source is ```savedtracks```, which pulls from songs you've saved through Spotify. You can also specify an `artist` (or multiple artists) by providing a list of artist_ids through the `sourcelist` argument or a `playlist` (or multiple playlists) by providing a list of playlist names through the `sourcelist` argument.\n\nYou can also specify a `profile_name` for your playlist. If that profile has not already been created, it will create a saved data set for you (so you do not need to fetch it from spotify every time). Every future call to that profile_name will locally read the data. If you wish to update your list (to include new saved songs or new albums for an artist) you can set `reset=True` in your `get_data` function call.\n\n\n ### Searching Data\n You can find an artist or playlist id you're looking for with a couple builtin functions.\n```\n playlist_df = get_playlists(sp)\n```\nThe `get_playlists()` function returns all of your playlists by name and id.\n```\nartist_search_df = artist_id_search(sp,artist='Foo Fighters')\n```\nThe `artist_id_search` function will search a given string for artists of that name, returning DataFrame of artists and their ids.\n\nYou can alternatively go through Spotify and find the corresponding id in the web url when you click on the corresponding playlist or artist.\n\n### Creating a Playlist\nHere is a sample piece of code to create a playlist:\n```\ntarget_playlist = 'Spomato Timer'\nuser_id = sp.current_user()['id']\nsongdf, df = pick_songs(df, time=55, extra=5)\nmake_playlist(sp, target_playlist, songdf, user_id)\n```\n\nThis does 3 things: it grabs the id of the current_user, it picks songs from the target list of songs you generated into a new DataFrame, then it will go and make that playlist with those songs.\n\nThe `time` argument specifies, in minutes, how long you want the playlist to be. The pick songs function will then go and grab songs to fill your playlist until the time is filled, ensuring that the playlist will not be longer than `time + extra`. You can also specify a maximum song length with the `time_limit` argument (the default is one-third of the time).\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/pm8k/spomato/archive/0.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pm8k/spomato", "keywords": "python", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "spomato", "package_url": "https://pypi.org/project/spomato/", "platform": "", "project_url": "https://pypi.org/project/spomato/", "project_urls": { "Download": "https://github.com/pm8k/spomato/archive/0.1.tar.gz", "Homepage": "https://github.com/pm8k/spomato" }, "release_url": "https://pypi.org/project/spomato/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "Tomato Timer with Spotify", "version": "0.1.1" }, "last_serial": 4543526, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "833188303f6497f82f30c9c0297f9455", "sha256": "fb124bb1d596ae53aa0f8b04dc6f0fef5993c46c1c6a86c05c22ddcac25596df" }, "downloads": -1, "filename": "spomato-0.1.0.tar.gz", "has_sig": false, "md5_digest": "833188303f6497f82f30c9c0297f9455", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6126, "upload_time": "2017-06-13T04:19:56", "url": "https://files.pythonhosted.org/packages/97/64/5733d2bd3f8cfb66574cef7a1e4c33ad0ce9213a8583b7dbbc204b310651/spomato-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "6a359ed8b488e37d2021a55e67792303", "sha256": "e7e8061cc340db19903169ce80225070d40b5c0b44c95c0592cf17e64415c7d6" }, "downloads": -1, "filename": "spomato-0.1.1.tar.gz", "has_sig": false, "md5_digest": "6a359ed8b488e37d2021a55e67792303", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6112, "upload_time": "2018-11-29T16:02:42", "url": "https://files.pythonhosted.org/packages/a1/bc/f0a6a7c09ce089300e38e2f1fc603d848d83f6f25e64966fee43c9e6ed7e/spomato-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6a359ed8b488e37d2021a55e67792303", "sha256": "e7e8061cc340db19903169ce80225070d40b5c0b44c95c0592cf17e64415c7d6" }, "downloads": -1, "filename": "spomato-0.1.1.tar.gz", "has_sig": false, "md5_digest": "6a359ed8b488e37d2021a55e67792303", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6112, "upload_time": "2018-11-29T16:02:42", "url": "https://files.pythonhosted.org/packages/a1/bc/f0a6a7c09ce089300e38e2f1fc603d848d83f6f25e64966fee43c9e6ed7e/spomato-0.1.1.tar.gz" } ] }