-
Hi, Just starting a new thread after posting in #64 I'm still fairly new to Python and reading developer documentation is sometimes still confusing. As a quick introduction, I use to write a lot of use documentation for the GNOME desktop on Linux, but not a lot of developer docs. Writing docs is how I learned Linux and I find writing it down helps me learn, and more importantly, retain it. But enough about me! @AnssiAhola asked what kind of app I'm building. I'm big into music and have a large record collection (as most people probably using this API!) In the first phase, I'm building a FastAPI web app that will query my collection via the Discogs API and show me a random record to play when I can't decide. I'm also adding the ability to choose a specific record and the web app will in both cases display the album art, some info about the release, etc. In the second phase, I'm going to connect the app to MQTT and it will send a message to an Adafruit LED Matrix that will display the album art. My record player and stereo are in a different room on the opposite side of the wall from my home office, so I don't have to walk too far to flip a record, but I thought it would be cool to see the album art digitally. This is all just a way for me to have a hobby and keep learning Python. :) With all that said, I'll be asking some pretty basic questions and I'll fork the repo and start working on some docs while I'm learning. Thanks in advance for anyone taking the time to help answer them! --Paul |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 7 replies
-
Hi, thanks from my end as well. As you noticed already some basics are missing in our docs. Simple examples about iterating through the collection woul indeed be a good start. Somethin like this would do: #64 (comment) |
Beta Was this translation helpful? Give feedback.
-
So I'm replacing one of the methods I've written with one using the API instead. I want to query my collection (folder 0), have it pick a random release, and return the release ID. How do I parse a paginated list? My function looks like this:
And returns this:
So I have a Thinking it was a list I tried this instead, but got a 404: I'm guessing some of my questions are more about still learning Python, but any pointers are appreciated. Thanks! Paul |
Beta Was this translation helpful? Give feedback.
-
Hi, sorry I was wrong, you can pass an id but to the .releases already:
So this is kind of the id in the paginated list I guess. This could be your random number. Use the dir() function to find out how to see what attributes are possible. |
Beta Was this translation helpful? Give feedback.
-
Your help got me on the right track and I was able to refactor about half my code today using the API. I have a few notes filled with API calls to start writing some docs around it that might help some folks in the future, too. I think the only question I have at this point is why release.artists returns a list of one item, but includes the artist ID and name:
Returns:
Thanks again and I'll have a PR in the next few days after I update a couple more things. Paul |
Beta Was this translation helpful? Give feedback.
-
Thanks again - that makes a lot more sense. I was looking at a couple records in my collection the wrong way. For example, I thought The Traveling Wilburys might list the individual artists, but it doesn't. But now that you point out that example, I see it and with records in my collection like https://www.discogs.com/master/1316036-Poli%C3%A7a-And-Stargaze-Music-For-The-Long-Emergency. I also didn't realize I could call Once again, thanks for the quick reply! |
Beta Was this translation helpful? Give feedback.
-
One last question (I hope): For the master release, is it possible to query the year? If I do a dir on
Looking at that last line of artists through title, I'm guessing not? I can do a query on the Master ID from the Client: print(my_data.release(20017387).master.id) and get back the Master ID of 2272042, but I like to get the master release year because reissues year field are the date of the reissue. What am I missing this time? :) Thanks in advance (again). --P |
Beta Was this translation helpful? Give feedback.
-
Thanks for the clarification! I need to dig into Once again, thank you. |
Beta Was this translation helpful? Give feedback.
Hi, sorry I was wrong, you can pass an id but to the .releases already: