bbye98 / minim

A collection of music service (iTunes, Qobuz, Spotify, TIDAL) APIs for media information retrieval and semi-automated music tagging.
https://bbye98.github.io/minim/
GNU General Public License v3.0
43 stars 4 forks source link

Some questions #1

Closed project-owner closed 1 year ago

project-owner commented 1 year ago

Hi,

Thanks a lot for this library! Here are some questions and proposals.

Best regards

bbye98 commented 1 year ago

Hello! Thanks for opening an issue.

  1. Python 3.7 has reached end-of-life on June 27, 2023. As such, I do not have any plans on adding support for it. I realize the pyproject.toml file incorrectly has requires-python = ">=3.7"; this will be updated to requires-python = ">=3.8" (Python 3.8 and above supports type hints) in a later update when I get some sort of continuous integration up and running.
  2. Currently, the Qobuz app ID and secret are "static" in that only one pair generated from bundle.js is valid. This is apparently by design, as the obfuscated functions in bundle.js used to extract the pair operate fundamentally the same as how I implemented it in Python. However, this behavior may change in the future, so the current dynamic implementation is likely best practice. Based on some quick testing, it looks like this extraction step takes around 3 seconds. If this is somehow a bottleneck for your uses, you should pass in the authentication token directly.
  3. "ReleaseName" should be used if you're querying for albums by name, and "MainArtist" if you're searching for artists.
  4. The search endpoint in the Qobuz API is inherently flawed and will always return all results that match a query, including albums, tracks, artists, etc. However, getting to the desired items is only one dict index away (i.e., results = session.search("taylor swift"); albums = results["albums"];), so there really isn't a need for a specialized function for each return type.
project-owner commented 1 year ago

Thank you for detailed answers!

  1. Unfortunately in many cases people cannot easily switch to a newer Python version. Anyway, you have a valid point.
  2. pass token? I thought you use app_id and app_secret for unauthenticated session. I think time varies depending on your Internet connection. In most cases it takes longer than 3 seconds for me.
  3. OK, I searched for 'ABBA' and specified 'artist' parameter which you convert into 'MainArtist' and the search result didn't have any entries in the 'artists' section. Though it has 'albums'. Is it what I'm supposed to do - derive artists from albums? I tried 'performer' and 'composer' with the same result.
  4. I'm not sure that users of your library should know the structure of the search result and how many indexes away is the result which they are looking for. Anyway, it's your choice.
project-owner commented 1 year ago

Regarding the question #3, it looks like if I don't specify any 'type' for the 'search' it returns the 'artists' section.

bbye98 commented 1 year ago
  1. I hadn't considered the unauthenticated case, as I have set up my environment to always automatically log me in. Perhaps I'll add keyword arguments to accept the app ID and secret to the qobuz.Session constructor.
  2. Yep, there are no results when I search for "ABBA" with "MainArtist". This matches what I get when I search for "ABBA" directly on play.qobuz.com (since it's the same API call). Looks like I was incorrect earlier in my assumptions on how the search endpoint works. From what I can gather, if you want to search for an artist, you cannot specify any of the "types". Specifying #ByMainArtist only returns releases and tracks by artists that contain the search query. I'll probably update the documentation to be more clear about how the type parameter works, but there isn't anything to change to the implementation as it is working as intended.
  3. The design goal of Minim is to implement the APIs exactly as they are with no fluff. That's exactly what you get when you use qobuz.Session. If you don't want to deal with the unformatted responses from the Qobuz API, you should use the experimental qobuz.User instead, as all responses in that class are actually qobuz.Artist, qobuz.Track, etc. objects with well defined attributes. See the Using the Qobuz API guide for more information.
project-owner commented 1 year ago

As I mentioned, unfortunately I cannot use the library directly because I need to support Python 3.7.4 for some time. More likely I'll just use some parts of the library and convert json into my own object structure. I'll probably create some kind of common top level "interface" on top of all services (Qobuz, Tidal, Deezer, Spotify etc) and have implementation specific for each service behind that common interface/API.