{ "info": { "author": "Madhan Balaji", "author_email": "madhanbalaji2000@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# lfmxtractplus\n\n## Description\nlfmxtractplus is a library for extracting [Last.fm](https://last.fm) scrobbles along with spotify [audio features](https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-features/) for use with [Pandas](https://pandas.pydata.org/)\n\n## Working \nThe user's scrobbles are retrieved using last.fm's API with the [user.getRecentTracks](https://www.last.fm/api/show/user.getRecentTracks) endpoint.\nAs last.fm's API doesn't provide a method to directly retrieve Spotify [audio features](https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-features/)\nwe use the [sp.search()](https://github.com/madhan001/lfmxtractplus/blob/76ccdd2a257bc1f39d9d5b6e34bf0c67a18f50ce/lfmxtractplus/export_data.py#L207) method to search Spotify for the track's spotifyID (trackID) and use the spotifyID to retrieve the audio feature of each track using the [sp.audio_features()](https://github.com/madhan001/lfmxtractplus/blob/76ccdd2a257bc1f39d9d5b6e34bf0c67a18f50ce/lfmxtractplus/export_data.py#L270) method.\n\n## Installation\nIf you already have [Python](http://www.python.org/) on your system you can install the library simply by downloading the distribution, unpack it and install in the usual fashion:\n\n## Changelog\n\n - v1.2 \n - Encapsulate methods inside a class\n - Added token refreshing for get_playlist()\n - Optimized imports\n\n - v1.1 \n - Added support for outputting logs to a file instead of the console\n - Fixed progress bars\n - Move timezone out of config.yaml\n\n - v1.0 \n - Initial version\n\n\n\n```bash\npython setup.py install\n```\n\nYou can also install it using a popular package manager with\n\n```bash\npip install lfmxtractplus\n```\n\nor\n\n```bash\neasy_install lfmxtractplus\n```\n\n## Dependencies\n\n- [spotipy](https://spotipy.readthedocs.io/en/latest/) >= 2.4.4\n- [pandas](https://pandas.pydata.org/) >= 0.22.0\n- [PyYAML](https://pyyaml.org/) >= 5.1.1\n- [numpy](https://www.numpy.org/) >= 1.14.0\n- [requests](https://2.python-requests.org/en/master/) >= 2.22.0\n- [tqdm](https://tqdm.github.io/) >= 4.31.1\n\n## Quick Start\n\nTo get started,simply install lfmxtractplus, initialize with config.yaml, visit the link displayed and login with your Spotify account, copy and paste the redirect url back into the Python prompt\n and call methods:\n\n```python\nimport lfmxtractplus as lxp\nimport pandas as pd\n\nlf = lxp.lfmxtractplus('config.yaml') #path to config.yaml\nscrobbles_dict = lf.generate_dataset(lfusername='madhan_001', pages=0)\nscrobbles_df = scrobbles_dict['complete']\n```\n### config.yaml\n\nThis file must contain the API keys for last.fm and spotify.\n\n```yaml\n#spotify api credentials (visit https://developer.spotify.com)\nsp_cid: #spotify client ID\nsp_secret: #spotify client secret\n#last.fm api key (visit https://www.last.fm/api)\nlf_key: #last.fm API key\n#filepath for log file\nlog_path: '\\logs\\\\output.log' #path for output.log\n```\n## Documentation \n\n### initialize(cfgPath)\nCalls functions needed for initialization, handles loading config file,\ninitializing logger object, initializing Spotipy object.\n\nVisit the link displayed and login with your Spotify account, copy and paste the redirect url back into the Python prompt.\n\nTo be called before calling other functions.\n\n :param cfgPath: filepath for config.yaml\n\n### generate_dataset(lfusername, timezone='Asia/Kolkata', pages=0)\nGets user's listening history and enriches it with Spotify audio features.\n\n :param lfusername: last.fm username\n :param timezone: timezone of the user (must correspond with the timezone in user's settings)\n :param pages: number of pages to retrieve, use pages = 0 to retrieve full listening history\n\n :return scrobblesDFdict: dictionary with two dataframes ('complete' with timestamps and 'library' with library contents)\n\nWarning : Does not support multiple timezones for scrobbles \n\n### get_playlist(user='billboard.com', playlist_id='6UeSakyzhiEt4NB3UAd6NQ')\n\nRetrieves audio features of a playlist (Billboard Hot 100 is the default playlist)\n\n :param user: username of the playlist owner\n :param playlist_id: playlist id (found at the end of a playlist url)\n\n :return: a dataframe with audio features of a playlist\n\n### unmapped_tracks(scrobblesDF)\n\nReturns a dataframe tracks that couldn't be mapped to spotify.\n\n :param scrobblesDF: dataframe with scrobbled tracks and trackIDs\n\n :return scrobblesDF: dataframe containing tracks with no trackIDs\n\n## Examples\n\n - [Music Listening History Analysis](https://github.com/madhan001/lfmxtractplus-examples/blob/master/music_listening_history_analysis.ipynb)\n\n## Reporting issues\n\nIf you have suggestions, bugs or other issues specific to this library, file an issue on GitHub. Or just send me a pull request.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/madhan001/lfmxtractplus", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "lfmxtractplus", "package_url": "https://pypi.org/project/lfmxtractplus/", "platform": "", "project_url": "https://pypi.org/project/lfmxtractplus/", "project_urls": { "Homepage": "https://github.com/madhan001/lfmxtractplus" }, "release_url": "https://pypi.org/project/lfmxtractplus/1.2/", "requires_dist": [ "PyYAML (>=5.1.1)", "numpy (>=1.14.0)", "pandas (>=0.22.0)", "requests (>=2.22.0)", "spotipy (>=2.4.4)", "tqdm (>=4.31.1)" ], "requires_python": "", "summary": "lfmxtractplus is a library for extracting last.fm scrobbles along with spotify audio features for use with pandas", "version": "1.2" }, "last_serial": 5522772, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "1f4484726428bcb4eb18eeeca3a6a64d", "sha256": "ef510f7f98848b2f248256d9899556599a1b3b1006b6b6171f0b74d52df8c827" }, "downloads": -1, "filename": "lfmxtractplus-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1f4484726428bcb4eb18eeeca3a6a64d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6978, "upload_time": "2019-06-24T15:50:49", "url": "https://files.pythonhosted.org/packages/1e/93/a7e012d5c780d6843469a5e5909f8b1d005154b6f223fbefa64bca1b921a/lfmxtractplus-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7d38b3f159380c0514326647e32702fc", "sha256": "81a223d172805fa1c898f420cff59133f0c745c52ed77d710b090e051c7e0775" }, "downloads": -1, "filename": "lfmxtractplus-1.0.tar.gz", "has_sig": false, "md5_digest": "7d38b3f159380c0514326647e32702fc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5542, "upload_time": "2019-06-24T15:50:52", "url": "https://files.pythonhosted.org/packages/23/9c/d781691fbc1084f157e49dad039bf3d4b394ac221d20dab9173c0547c1b7/lfmxtractplus-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "e5cb9001673d5389e68d9a98d6c9c545", "sha256": "aa2081c1df43160ac565f8ed1b5c5d2013d8268dc965de61d7fb3cf8a4847349" }, "downloads": -1, "filename": "lfmxtractplus-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e5cb9001673d5389e68d9a98d6c9c545", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7405, "upload_time": "2019-07-04T15:08:56", "url": "https://files.pythonhosted.org/packages/5a/91/543e47b0fc69685ed02b2272585fa87ab9d37cb1a21160fc09f4d7ecc454/lfmxtractplus-1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cb913dc2a41134d0fcff3e84d6481db1", "sha256": "6bc10ffdb067973f59aedb3031b21f11755f0cc17851e611688807ccab84735a" }, "downloads": -1, "filename": "lfmxtractplus-1.1.tar.gz", "has_sig": false, "md5_digest": "cb913dc2a41134d0fcff3e84d6481db1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6020, "upload_time": "2019-07-04T15:08:58", "url": "https://files.pythonhosted.org/packages/51/1f/dd1289e69247b555d8077d246e0d825c653036d3eb05eae27f73117b9bac/lfmxtractplus-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "6c3308babd979333b3cf017bb7ef63a7", "sha256": "62669deaa23cbdb84e56ad88374677e44e71f30960c5ed4c816a680af716dddd" }, "downloads": -1, "filename": "lfmxtractplus-1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "6c3308babd979333b3cf017bb7ef63a7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9433, "upload_time": "2019-07-12T11:17:04", "url": "https://files.pythonhosted.org/packages/97/92/00031369d97cfcd725a16454bb1ca4a54efcdcdadbec8ff0192b65bbb512/lfmxtractplus-1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4353c55f679e2f8a84c1788752c01b38", "sha256": "7d956f398fa6359402f5891089c4b109a281a4b444ab6434380bfa69576d5478" }, "downloads": -1, "filename": "lfmxtractplus-1.2.tar.gz", "has_sig": false, "md5_digest": "4353c55f679e2f8a84c1788752c01b38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7865, "upload_time": "2019-07-12T11:17:06", "url": "https://files.pythonhosted.org/packages/c0/dd/bf0b720de4c8a01747849aa725be1f00852b55fc90a72cba54e78804cccd/lfmxtractplus-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6c3308babd979333b3cf017bb7ef63a7", "sha256": "62669deaa23cbdb84e56ad88374677e44e71f30960c5ed4c816a680af716dddd" }, "downloads": -1, "filename": "lfmxtractplus-1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "6c3308babd979333b3cf017bb7ef63a7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9433, "upload_time": "2019-07-12T11:17:04", "url": "https://files.pythonhosted.org/packages/97/92/00031369d97cfcd725a16454bb1ca4a54efcdcdadbec8ff0192b65bbb512/lfmxtractplus-1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4353c55f679e2f8a84c1788752c01b38", "sha256": "7d956f398fa6359402f5891089c4b109a281a4b444ab6434380bfa69576d5478" }, "downloads": -1, "filename": "lfmxtractplus-1.2.tar.gz", "has_sig": false, "md5_digest": "4353c55f679e2f8a84c1788752c01b38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7865, "upload_time": "2019-07-12T11:17:06", "url": "https://files.pythonhosted.org/packages/c0/dd/bf0b720de4c8a01747849aa725be1f00852b55fc90a72cba54e78804cccd/lfmxtractplus-1.2.tar.gz" } ] }