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

API - queueAlbum: TypeError: argument of type 'NoneType' is not iterable #2205

Closed
josevh opened this issue May 3, 2015 · 2 comments
Closed

Comments

@josevh
Copy link

josevh commented May 3, 2015

Excuse me if known issue or duplicate, found some bugs reported that are similar but not the same.

Writing program which requires on API call to queueAlbum.
Example call:

http://{IP}:{PORT}/api?apikey={API_KEY}&cmd=queueAlbum&id=d924cd74-09be-3611-8816-bd4d4fc73049&lossless=False

The API call returns the following error:

500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Traceback (most recent call last):
  File "/usr/pbi/headphones-amd64/share/headphones/headphones/lib/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/pbi/headphones-amd64/share/headphones/headphones/lib/cherrypy/lib/encoding.py", line 217, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/pbi/headphones-amd64/share/headphones/headphones/lib/cherrypy/_cpdispatch.py", line 61, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/pbi/headphones-amd64/share/headphones/headphones/headphones/webserve.py", line 1317, in api
    return a.fetchData()
  File "/usr/pbi/headphones-amd64/share/headphones/headphones/headphones/api.py", line 83, in fetchData
    methodToCall(**self.kwargs)
  File "/usr/pbi/headphones-amd64/share/headphones/headphones/headphones/api.py", line 306, in _queueAlbum
    searcher.searchforalbum(self.id, new)
  File "/usr/pbi/headphones-amd64/share/headphones/headphones/headphones/searcher.py", line 213, in searchforalbum
    do_sorted_search(album, new, losslessOnly)
  File "/usr/pbi/headphones-amd64/share/headphones/headphones/headphones/searcher.py", line 231, in do_sorted_search
    results = searchNZB(album, new, losslessOnly, albumlength)
  File "/usr/pbi/headphones-amd64/share/headphones/headphones/headphones/searcher.py", line 448, in searchNZB
    if album['ArtistName'] in album['AlbumTitle'] or len(album['ArtistName']) < 4 or len(album['AlbumTitle']) < 4:
TypeError: argument of type 'NoneType' is not iterable

On my 'Wanted' albums I get the following:
image
and
image

On the Headphones logs via site I get:

2015-05-02 18:41:52 INFO    Searching for "None - None" since it was marked as wanted
2015-05-02 18:41:52 INFO    Searching for wanted albums
2015-05-02 18:41:52 INFO    Recieved API command: queueAlbum
2015-05-02 18:41:52 INFO    Searching for "None - None" since it was marked as wanted
2015-05-02 18:41:52 INFO    Searching for wanted albums
2015-05-02 18:41:52 INFO    Recieved API command: queueAlbum
2015-05-02 18:41:52 INFO    Searching for "None - None" since it was marked as wanted
2015-05-02 18:41:52 INFO    Searching for wanted albums
2015-05-02 18:41:52 INFO    Recieved API command: queueAlbum

This has been tested with numerous albums.

Tested:

id=9418e8f4-c5af-4354-8c24-bb7047ddc78d
id=7e1e88d2-e6a2-48cf-b364-097e8056b9a8
id=d924cd74-09be-3611-8816-bd4d4fc73049
id=9545a5e5-014e-3381-8d8a-32a780b450ae

Confirmed valid, ex. : http://musicbrainz.org/release/9545a5e5-014e-3381-8d8a-32a780b450ae

@rembo10
Copy link
Owner

rembo10 commented May 5, 2015

If you want to queue an album for download, it has to be in the database first. Off the top of my head I don't think there's an api call where you can download something right off the bat but it might be something I can look into

@josevh
Copy link
Author

josevh commented May 6, 2015

Hi rembo,

Thank you for taking the time to reply.

I played a little with the API and it seems that after adding the artist to the database (addArtist), Headphones fetches the albums. I also noticed that Headphones uses the album's 'rgid' and not the 'albumid' and now queueAlbum works after adding the artist. I will probably still check to make sure that the album is added.

I'll keep experimenting but thank you for solving the problem, appreciate it.

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