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

TypeError with DiscID "Rl7E4c2SbxEwLh9gwYX57V6pR6I-" (stubs) #23

Closed
Freso opened this issue Nov 17, 2012 · 6 comments
Closed

TypeError with DiscID "Rl7E4c2SbxEwLh9gwYX57V6pR6I-" (stubs) #23

Freso opened this issue Nov 17, 2012 · 6 comments
Assignees
Milestone

Comments

@Freso
Copy link
Collaborator

Freso commented Nov 17, 2012

Getting TypeError with DiscID "Rl7E4c2SbxEwLh9gwYX57V6pR6I-":

freso@kotake> isrcsubmit.py --debug Freso
isrcsubmit 0.4.2 by JonnyJD for MusicBrainz

using python-musicbrainz2 0.7.4
using Cdrdao 1.2.3

DiscID:     Rl7E4c2SbxEwLh9gwYX57V6pR6I-
Tracks on Disc: 20
Traceback (most recent call last):
  File "/usr/bin/isrcsubmit.py", line 616, in <module>
    release = query.getReleaseById(releaseId, include=include)
  File "/usr/bin/isrcsubmit.py", line 314, in getReleaseById
    return self._query.getReleaseById(releaseId, include=include)
  File "/usr/lib/python2.7/site-packages/musicbrainz2/webservice.py", line 1044, in getReleaseById
    result = self._getFromWebService('release', uuid, include)
  File "/usr/lib/python2.7/site-packages/musicbrainz2/webservice.py", line 1186, in _getFromWebService
    stream = self._ws.get(entity, id_, includeParams, filterParams)
  File "/usr/lib/python2.7/site-packages/musicbrainz2/webservice.py", line 274, in get
    url = self._makeUrl(entity, id_, include, filter, version)
  File "/usr/lib/python2.7/site-packages/musicbrainz2/webservice.py", line 244, in _makeUrl
    path = '/'.join((self._pathPrefix, version, entity, id_))
TypeError: sequence item 3: expected string, NoneType found
@JonnyJD
Copy link
Owner

JonnyJD commented Nov 17, 2012

I can verify this with setting the discID to this value (with any disc in the drive):

diff --git a/isrcsubmit.py b/isrcsubmit.py
index 2b92db7..46c406d 100755
--- a/isrcsubmit.py
+++ b/isrcsubmit.py
@@ -331,7 +331,8 @@ class Disc(object):

     @property
     def id(self):
-        return self._disc.getId()
+        return "Rl7E4c2SbxEwLh9gwYX57V6pR6I-"
+        #return self._disc.getId()

     @property
     def trackCount(self):

I can also verify the problem with isrcsubmit 0.4 (setting discID to this id).

It looks like a problem in the python-musicbrainz2 library. This would be bad, because python-musicbrainz2 is deprecated and might not receive bugfixes.

The "-" at the end of the id doesn't seem to be the problem. That is quite common and i tested another disc with such an id.

@Freso
Copy link
Collaborator Author

Freso commented Nov 17, 2012

Looking it up (via Picard) shows that the release has a stub. Perhaps this is what is throwing things off? (E.g., it's finding a (stub) release but no releaseId?)

https://musicbrainz.org/cdtoc/attach?id=Rl7E4c2SbxEwLh9gwYX57V6pR6I-&tracks=20&toc=1+20+296340+150+14760+30827+46300+60862+72887+86030+104495+121460+134050+149780+169217+185267+200284+211002+228445+240005+250897+265872+279385&tport=8000

@Freso
Copy link
Collaborator Author

Freso commented Nov 17, 2012

Oh, didn't see your comment. :)

@JonnyJD
Copy link
Owner

JonnyJD commented Nov 17, 2012

The problem in python-musicbrainz2 is, that the musicbrainz id (!= disc id) is "None". Possibly because this is a stub.

Bare test for pymb2:

#!/usr/bin/env python2

from musicbrainz2.webservice import Query, WebService, ReleaseFilter

agent = "isrcsubmit-test"
ws = WebService(userAgent=agent)
q = Query(ws, clientId=agent)
discId_filter = ReleaseFilter(discId="Rl7E4c2SbxEwLh9gwYX57V6pR6I-")
# working id
#discId_filter = ReleaseFilter(discId="KvJdT.MxfPnKhhaa8STa2MhBoWk-")
results = q.getReleases(filter=discId_filter)
release = results[0].release
print release.getArtist().getName(),
print "-", release.getTitle(),
#print "(" + release.getTypes()[1].rpartition('#')[2] + ")"
print "(" + ", ".join(release.getTypes()) + ")"
print "id: ", release.getId()

# this is the part that will error out
results = q.getReleaseById(release.getId())

@JonnyJD
Copy link
Owner

JonnyJD commented Nov 17, 2012

Oh boy..
After writing the bare test for pymb2 I relize, that I can just check for release.getId() is not None in my script..

@ghost ghost assigned JonnyJD Nov 17, 2012
@JonnyJD
Copy link
Owner

JonnyJD commented Nov 17, 2012

Stubs are now ignored (since they are no "real" musicbrainz releases), but I show some information about the stub with d8f8c3c.

Thanks for the report.

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

No branches or pull requests

2 participants