Giter Club home page Giter Club logo

scribbplyscrobbply's Introduction

scribbplyscrobbly

Note

I made scribbplyscrobbply as I thought a) lilnasy's scribblyscrobbly wasn't processing all of the entries, and b) I wanted to filter by date without manually editing files.

So I set out to do just that, with a working command-line program. This is where I learnt that no, scribblyscrobbly wasnt mysteriously skipping entries, but there was an error for extended history data requested in early 2023, resulting in many nulled entries.
https://community.spotify.com/t5/Other-Podcasts-Partners-etc/Extended-data-been-sent-to-me-Missing-data-from-October-to/m-p/5514697

Furthermore, the Flet framework's internal file handling library didn't fully support the web, making efforts for a web frontend futile, evaporating the only reason to use my tool over lilnasy's as the non-technologically-inclined may not want to use a CLI.

I may come back to this project to complete the GUI in the future, but how long said future is, is indeterminate at time of writing, as the file issue is not directly Flet's fault.

tl;dr This project was an accident and a semi-failure, and unless you a) need date filtering and b) are comfortable with the command-line, use lilnasy's scribblyscrobbly.

A pure Python script to process your Spotify Extended Streaming History JSONs into a single Last.fm Scrubbler-friendly JSON file.


Inspired by lilnasy/scribblyscrobbly

Usage

Command Line

Note
You will need Python 3.10 or later.

  1. Install scribbplyscrobbply as a package:

    pip install git+https://github.com/markjoshwel/scribbplyscrobbply
    
  2. Get date boundary:

    $ scribbplyscrobbply path-to-files/endsong_*.json --get-date-boundary
    note: processed 74043 plays (22888 failed)
    note: is in format [earliest, latest]
    ['2021-11-04', '2022-10-14']
    

    Change the dates as needed, especially if you want to exclude already scrobbled tracks. The date boundaries are inclusive. This means if you set the end boundary to 2023-01-01, scrobbles will filter out 2023-01-31 and beyond.

  3. Generate a JSON:

    scribbplyscrobbply.py data/endsong_*.json --output export.json
    

    If your environment supports pipes:

    $ scribbplyscrobbply path-to-files/endsong_*.json > export.json
    note: processed 74043 (22888 failed)
    note: takeout: exported 43171 scrobbles (filtered 30872)
    

    And voilà!

Developing

Setup

  1. Environment Setup

    You will need Python >=3.10 and Poetry.

    Also consider using Devbox (which uses Nix) to easily setup a reproducible development shell.

    [m@csp scribbplyscrobbply]$ devbox shell
    (scribbplyscrobbply-py3.10) [m@csp scribbplyscrobbply]$ which python
    /home/m/.cache/pypoetry/virtualenvs/scribbplyscrobbply-XkMn02HP-py3.10/bin/python
    (scribbplyscrobbply-py3.10) [m@csp scribbplyscrobbply]$ which poetry
    /nix/store/rad8y09y2dnn03igf053zwk3f0jmxczc-poetry-1.3.2/bin/poetry
    
  2. Project Setup

    poetry shell  # if you used devbox, skip this!
    poetry install
  3. You're all set!

Checking and Formatting

scribbplyscrobbply uses black, mypy and isort to check and format code.

isort scribbplyscrobbply*.py
black scribbplyscrobbply*.py
mypy scribbplyscrobbply*.py

Licence

scribbplyscrobbply is free and unencumbered software released into the public domain. For more information, please refer to the UNLICENCE file or http://unlicense.org/.

scribbplyscrobbply's People

Contributors

markjoshwel avatar

Watchers

 avatar  avatar

scribbplyscrobbply's Issues

List index out of range

I presume a check to ensure args.files was not empty needs to be implemented.

[m@csp ~]$ python3
Python 3.11.2 (main, Feb  8 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[m@csp ~]$ pip --version
pip 22.2.2 from /usr/lib/python3.11/site-packages/pip (python 3.11)
[m@csp ~]$ pip install git+https://github.com/markjoshwel/scribbplyscrobbply
Defaulting to user installation because normal site-packages is not writeable
Collecting git+https://github.com/markjoshwel/scribbplyscrobbply
  Cloning https://github.com/markjoshwel/scribbplyscrobbply to /tmp/pip-req-build-h9iorxvf
  Running command git clone --filter=blob:none --quiet https://github.com/markjoshwel/scribbplyscrobbply /tmp/pip-req-build-h9iorxvf
  Resolved https://github.com/markjoshwel/scribbplyscrobbply to commit f57d30094c0449ff132a037de6ef23641335a88d
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: scribbplyscrobbply
  Building wheel for scribbplyscrobbply (pyproject.toml) ... done
  Created wheel for scribbplyscrobbply: filename=scribbplyscrobbply-1.0.0-py3-none-any.whl size=5305 sha256=e813c40886e20aa6bafc695900e673ffb034516ed9136a657b5889f1da8449f7
  Stored in directory: /tmp/pip-ephem-wheel-cache-w_dmpco6/wheels/85/85/95/ab6b57a512c30e48e9d5e1a583106559d09ba3d9f97bc122f0
Successfully built scribbplyscrobbply
Installing collected packages: scribbplyscrobbply
Successfully installed scribbplyscrobbply-1.0.0
[m@csp ~]$ scribbplyscrobbply 
note: processed 0 plays (0 failed)
Traceback (most recent call last):
  File "/home/m/.local/bin/scribbplyscrobbply", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/m/.local/lib/python3.11/site-packages/scribbplyscrobbply.py", line 370, in cli
    if (ti_result := ss.takein(endsongs=endsongs)) is not None:
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/m/.local/lib/python3.11/site-packages/scribbplyscrobbply.py", line 179, in takein
    self.db_start = self.plays[0].time.date()
                    ~~~~~~~~~~^^^
IndexError: list index out of range

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.