Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve library history parsing #27

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

FoxxMD
Copy link
Contributor

@FoxxMD FoxxMD commented Jul 14, 2023

* Check for list structure to avoid intermittent "undefined" structures
* Include all recently played regardless of time slice for a more complete list
@FoxxMD
Copy link
Contributor Author

FoxxMD commented Sep 18, 2023

Hey, can this get merged?

@Nikey646
Copy link

+1

@nickp10 nickp10 merged commit 82e02a2 into nickp10:master Sep 19, 2023
@nickp10
Copy link
Owner

nickp10 commented Sep 19, 2023

I have merged this as-is. I don't know how everyone intends to use this getLibraryHistory function, but it may be worth considering leaving the tracks split into the separate categories as opposed to joining them into one array. For now, it will be left as one combined array.

@FoxxMD
Copy link
Contributor Author

FoxxMD commented Sep 19, 2023

It may be worth adding an argument to allow user to define how they'd like the list returned.

The main motivation for this change, though, is that the structure (array/object) of the history is relative to the time it is queried at which makes it inconsistent unless your app is also keeping track of that relative time to account for it. As an example:

On Day 9/30 at 11:59 getLibraryHistory returns:

  • Today (empty)
  • Yesterday
    • Track 1
    • Track 2
  • Day 9/28
    • Track 3
    • Track 4
      ...
  • Last Week
    • Track 5
    • Track 6

On Day 10/1 at 00:00 getLibraryHistory returns:

  • Today (empty)
  • Yesterday (empty or possibly undefined)
  • Day 9/29
    • Track 1
    • Track 2
  • Day 9/28
    • Track 3
    • Track 4
      ...
  • Last Week (no longer defined)
  • Last Month
    • Track 5
    • Track 6

This is pretty hard to deal with and the root problem of FoxxMD/multi-scrobbler#86 . Changing this to return a flat list means returned results are consistent. I think it's better to have the consistent result as the default and if anyone really wants the relative-time sliced view in the future they can add a param to get that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants