Re: [mb-users] Track duration is None
Ian McEwen <[email protected]> Tue, 16 Apr 2013 14:52:12 -0700
| Newsgroups | gmane.comp.audio.musicbrainz.user |
|---|---|
| Message-ID | <[email protected]> |
The documentation is not completely good for that, no -- you'll need to provide some include parameters; if you look at musicbrainz.VALID_INCLUDES further down on that page you'll see the valid things to include for each endpoint (in this case, 'discid'). To get recording information, you'll want to probably include at least 'media', 'artist-credits', and 'recordings'). python-musicbrainz-ngs is also a pretty small wrapper around the webservice itself, so you may want to look at https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2 which gives a basic overview of the webservice. Specifically, https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#discid is the section you'll care about here, of course. On Tue, Apr 16, 2013 at 03:37:11PM -0600, Jeffrey Barish wrote: > Thanks. Your reply helps very much. > > I am changing my code to use python-musicbrainzngs. I figured that the change > wouldn't be too hard because I am using MB only for simple operations. > However, the documentation for musicbrainzngs seems incomplete. I found > get_releases_by_discid -- which looks relevant -- but I have not been able to > figure out how to get a list of the tracks (release.tracks, previously). > > I am looking at the documentation on this page: > > https://python-musicbrainz-ngs.readthedocs.org/en/latest/api/#getting-data > > Is that the right place to be looking? Are there any examples other than > query.py, collection.py, and releasesearch.py? All I need to know is how to > get information about the recording (artist, title) and the tracks (title, > duration). > > On Tuesday, 16 April 2013 11:33:51 Ian McEwen wrote: > > Okay, so, first of all, python-musicbrainz2 is deprecated, since the > > webservice version it uses (/ws/1) is deprecated. So I'd suggest moving > > away from that. However: > > > > https://musicbrainz.org/ws/1/release/?discid=Uet7Ne0jNNwhz206YC0rPlDJELw- is > > the url it constructs initially. You can see the result it found. > > > > Issue: that endpoint includes CDStubs[1] by default. As you can see, > > https://musicbrainz.org/ws/1/release/?discid=Uet7Ne0jNNwhz206YC0rPlDJELw-&c > > dstubs=no does not include that result. Also, CDStubs don't support many of > > the various ?inc parameters, and they don't have much info. > > > > The CDStub is: https://musicbrainz.org/cdstub/Uet7Ne0jNNwhz206YC0rPlDJELw- > > > > I'm not sure why it's not including durations, but I'd bet it's because it's > > a CDStub. > > > > In general, I'd recommend a.) moving away from python-musicbrainz2 and > > /ws/1, b.) if you must, figure out the proper way to exclude CDStubs, and > > c.) sometimes things just don't have durations even after all that. So > > you'll just have to account for that somewhere :) > > > > Hopefully this helps. > > > > [1]: http://wiki.musicbrainz.org/CD_Stub > > > > On Tue, Apr 16, 2013 at 11:32:16AM -0600, Jeffrey Barish wrote: > > > When I look up the track duration for a particular recording using the API > > > thusly: > > > > > > rel_filter = mbws.ReleaseFilter(discId='Uet7Ne0jNNwhz206YC0rPlDJELw-') > > > result = query.getReleases(rel_filter) > > > release = result[0].release > > > release.tracks[0].title > > > u'Adagio \u2013 Allegro molto' > > > print release.tracks[0].duration > > > > > > I get None. > > > > > > I figured that I should check the duration using the web interface, but I > > > cannot find the recording. It must be in the database -- right? -- > > > because I get a result when I search using the API. Is there a way to > > > look up a recording using the disc ID? How does it happen that the > > > duration of the tracks on this recording are all None? Is this record > > > erroneous, or do I have to protect against this value? > > > > > > Jeffrey Barish > > > > > > _______________________________________________ > > > MusicBrainz-users mailing list > > > [email protected] > > > http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-users > > > > -- > > Ian McEwen <[email protected]> <[email protected]> > > A262 D5C4 40CB 0E1C 5F24 C3A1 ABED 1ABD 7131 A76F > > http://ianmcorvidae.net/ > -- > Jeffrey Barish 303-775-9550 > 612 Wild Ridge Ln > Lafayette, CO 80026 > > > _______________________________________________ > MusicBrainz-users mailing list > [email protected] > http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-users -- Ian McEwen <[email protected]> <[email protected]> A262 D5C4 40CB 0E1C 5F24 C3A1 ABED 1ABD 7131 A76F http://ianmcorvidae.net/ _______________________________________________ MusicBrainz-users mailing list [email protected] http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-users
signature.asc
(application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlFtyAwACgkQq+0avXExp288EACbB5itSj3gqzFIJHnw5DhRQXd7 +NsAoK5Nhho/1F8Csu6AA4vj5Db3hfRZ =8f5B -----END PGP SIGNATURE-----