diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c62c5c --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# spotify-data + +## About + +The purpose of this repository/project is to capture my liked songs from my Spotify account, and then create a stacked bar graph representing my explicit vs non explicit songs. + +Yes, the project is super simple and doesn't have that much usefulness, but it's the first time I've genuinely used `matplotlib` or `logger` in a serious context and it was definitely interesting. + +## Demonstration + +![Output Matplotlib Stacked Bar-graph](./graph.png) + +```python +> python main.py +INFO:root:Pulling data from Spotify +INFO:root:Authorizing with Spotify via Spotipy +WARNING:root:May require User Interaction to authenticate properly! +INFO:root:Authorized with Spotify via Spotipy +WARNING:root:Clearing all files in tracks folder for new files +INFO:root:Cleared folder, ready to download new track files +INFO:root:Requesting 0 to 50 +INFO:root:Received 0 to 50 +INFO:root:Saved at "\tracks\saved-tracks-0-50.json" (150K) +INFO:root:Requesting 50 to 100 +INFO:root:Received 50 to 100 +INFO:root:Saved at "\tracks\saved-tracks-50-100.json" (151K) +INFO:root:Requesting 100 to 150 +INFO:root:Received 100 to 150 +INFO:root:Saved at "\tracks\saved-tracks-100-150.json" (146K) +INFO:root:Requesting 150 to 200 +INFO:root:Received 150 to 200 +INFO:root:Saved at "\tracks\saved-tracks-150-200.json" (147K) +............................................................... +INFO:root:Requesting 850 to 900 +INFO:root:Received 850 to 900 +INFO:root:Saved at "\tracks\saved-tracks-850-900.json" (143K) +INFO:root:Requesting 900 to 950 +INFO:root:Received 900 to 919 +INFO:root:Saved at "\tracks\saved-tracks-900-919.json" (55K) +INFO:root:Requested and saved 919 tracks split over 19 files (2 MB) +INFO:root:Reading track files +INFO:root:Read and parse 19 track files +INFO:root:Combining into single track file for ease of access +INFO:root:File combined with 919 items +INFO:root:Processing file... +INFO:root:Processed data, creating plot from data +INFO:root:Saving the figure to the 'export' folder +INFO:root:Showing plot to User +INFO:root:Done +> +``` + +# Requirements + +The requirements for this project are outlined in the [requirements.txt](requirements.txt) file. + +You can use the `pip` tool to instantly download and install all required modules via `pip install -r requirements.txt`. + +## License + +This project uses the GNU General Public License, see the [LICENSE](./LICENSE) file for more information. \ No newline at end of file diff --git a/graph.png b/graph.png new file mode 100644 index 0000000..4fb051d Binary files /dev/null and b/graph.png differ diff --git a/main.py b/main.py index 7fc7675..c4b2a73 100644 --- a/main.py +++ b/main.py @@ -27,4 +27,5 @@ def refresh(): logging.info('Spotify data deemed to be recent enough (under {} seconds old)'.format(cache['expires_in'])) else: pull.main() + main() \ No newline at end of file diff --git a/process.py b/process.py index 66806a5..90c1535 100644 --- a/process.py +++ b/process.py @@ -104,7 +104,7 @@ def copy(months, safe, explicit): ])) def main(): - logging.basicConfig(level=logging.INFO) + # logging.basicConfig(level=logging.INFO) logging.info("Reading track files") files = get_files() logging.info(f"Read and parse {len(files)} track files") @@ -113,6 +113,4 @@ def main(): data.sort(key=lambda item : dateutil.parser.parse(item['added_at']).timestamp(), reverse=True) logging.info(f'File combined with {len(data)} items') logging.info('Processing file...') - process_data(data) - -main() \ No newline at end of file + process_data(data) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2603974..09af153 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -hurry.filesize==0.9 -pyperclip==1.7.0 -numpy==1.17.3 -spotipy==2.4.4 -matplotlib==3.1.1 -Pillow==6.2.1 -python_dateutil==2.8.0 -hurry==1.1 +hurry.filesize +pyperclip +numpy +spotipy +matplotlib +Pillow +python_dateutil +hurry \ No newline at end of file