Re: [mb-users] Track duration is None

Jeffrey Barish <[email protected]> Tue, 16 Apr 2013 15:37:11 -0600
Newsgroups gmane.comp.audio.musicbrainz.user
Message-ID <1523210.VWttmgeUG3@sextet>
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