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

Default value for link title for page searches. #1097

Merged
merged 1 commit into from Nov 16, 2014

Conversation

Projects
None yet
2 participants
@dashed
Contributor

dashed commented Nov 16, 2014

Google API may not return results with a title attribute.

I added log.debug(item) to line 395 for https://github.com/sampsyo/beets/blob/590b106ed0f43e84533d5f40f16b2692b21ac74b/beetsplug/lyrics.py to see what's going on.

Debug output:

...
Sending event: database_change
Sending event: database_change
{u'kind': u'customsearch#result', u'displayLink': u'www.maxilyrics.com', u'cacheId': u'1kGkPOSfpVQJ', u'snippet': u'', u'htmlSnippet': u'', u'link': u'http://www.maxilyrics.com/nine-muses-%ED%8B%B0%EC%BC%93(ticket)-lyrics-c8b8.html'}
Traceback (most recent call last):
  File "/usr/local/bin/beet", line 9, in <module>
    load_entry_point('beets==1.3.9', 'console_scripts', 'beet')()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beets/ui/__init__.py", line 935, in main
    _raw_main(args)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beets/ui/__init__.py", line 925, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beets/ui/commands.py", line 872, in import_func
    import_files(lib, paths, query)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beets/ui/commands.py", line 844, in import_files
    session.run()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beets/importer.py", line 299, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beets/util/pipeline.py", line 299, in run
    out = self.coro.send(msg)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beets/util/pipeline.py", line 181, in coro
    func(*(args + (task,)))
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beets/importer.py", line 1258, in plugin_stage
    func(session, task)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beetsplug/lyrics.py", line 458, in imported
    False, False)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beetsplug/lyrics.py", line 474, in fetch_item_lyrics
    lyrics = [self.get_lyrics(artist, title) for title in titles]
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beetsplug/lyrics.py", line 503, in get_lyrics
    lyrics = backend(artist, title)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beetsplug/lyrics.py", line 397, in fetch_google
    urlTitle = item['title'] or ''
KeyError: 'title'
Default value for link title for page searches.
Google API may not return results with a title attribute.
@sampsyo

This comment has been minimized.

Show comment
Hide comment
@sampsyo

sampsyo Nov 16, 2014

Member

Thanks! This looks like exactly the right fix. 😃 👍 🐟

Member

sampsyo commented Nov 16, 2014

Thanks! This looks like exactly the right fix. 😃 👍 🐟

sampsyo added a commit that referenced this pull request Nov 16, 2014

Merge pull request #1097 from Dashed/patch-1
Default value for link title for page searches.

@sampsyo sampsyo merged commit 40b1d51 into beetbox:master Nov 16, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

sampsyo added a commit that referenced this pull request Nov 16, 2014

@dashed dashed deleted the dashed:patch-1 branch Nov 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment