Skip to content

gungurbuz/SpotifyListeningHistoryPython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note

Most of the code in this repository is AI generated. I just wanted to see if the program I wrote in the SpotifyHistory repo would work better on python. I may or may not update this in the future

Spotify Listening History Analyzer

This Python program processes Spotify listening history data from multiple JSON files, aggregates statistics about song, album, and artist playtimes, ranks platforms and countries based on listening times, and generates both a detailed and human-readable output.

Features

  • Load multiple JSON files containing Spotify streaming history data.
  • Process and analyze data to calculate total playtimes for songs, albums, and artists.
  • Rank songs, albums, artists, platforms, and countries based on total playtime.
  • Categorize platforms (e.g., iOS, Android, PlayStation, etc.).
  • Calculate total time spent listening online vs offline.
  • Save processed data in JSON format for further use.
  • Provide a human-readable output with summarized statistics.

Requirements

  • Python 3.x

Setup

  1. Clone this repository to your local machine:
    git clone https://github.com/gungurbuz/SpotifyListeningHistory.git

Usage

File Structure

  • file_paths.txt - A text file containing the file paths to your Spotify streaming history JSON files. Each line should represent a single file path.

Running the Program

To run the program, use the following command: python main.py The program will:

  • Load the file paths listed in file_paths.txt.
  • Process the data by calculating the total playtime for songs, albums, and artists.
  • Rank the songs, albums, artists, platforms, and countries based on playtime.
  • Save the summarized output in combined_output.json and detailed processed data in processed_output.json.

Example Input (file_paths.txt)

    C:\path\to\Spotify\Streaming_History_Audio_2021.json
    C:\path\to\Spotify\Streaming_History_Audio_2022.json
    C:\path\to\Spotify\Streaming_History_Audio_2023.json

Example Output (combined_output.json)

{
    "top_song": {
        "song": "Song Name",
        "playtime": "02:15:34"
    },
    "top_album": {
        "album": "Album Name",
        "playtime": "05:23:10"
    },
    "top_artist": {
        "artist": "Artist Name",
        "playtime": "15:04:22"
    },
    "ranked_platforms": [
        ["iOS", "12:15:10"],
        ["Android", "10:03:40"]
    ],
    "ranked_countries": [
        ["US", "14:10:15"],
        ["Germany", "08:45:30"]
    ],
    "online_time": "25:34:45",
    "offline_time": "12:15:30"
}

Contributing

If you would like to contribute to the development of this project, feel free to open an issue or submit a pull request.

License

This project is licensed under the GNU General Public License - see the LICENSE file for details.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages