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

Website Search plugin: KeyError: '~filename' when using a conditional tag with comparisons #2762

Closed
marcelpaulo opened this Issue Feb 5, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@marcelpaulo

marcelpaulo commented Feb 5, 2018

I configured this search URL pattern in the Website Search plugin:

https://google.com/search?q=<~dirname = /Various Artists/|<album>|<artist~album>>

and this exception is thrown when I select it:

KeyError: '~filename'
------
Traceback (most recent call last):

  File "/usr/lib/python3/dist-packages/quodlibet/qltk/songsmenu.py", line 203, in __handle
    ret = plugin.plugin_songs(songs)

  File "/usr/lib/python3/dist-packages/quodlibet/ext/songsmenu/website_search.py", line 144, in plugin_songs
    url = str(pat.format(subs))

  File "/usr/lib/python3/dist-packages/quodlibet/pattern/_pattern.py", line 247, in format
    value = u"".join(self.__func(self.SongProxy(song, self._format)))

  File "<string>", line 6, in f

  File "/usr/lib/python3/dist-packages/quodlibet/query/_match.py", line 543, in search
    if search(fsn2text(data(name, fs_default))):

  File "/usr/lib/python3/dist-packages/quodlibet/pattern/_pattern.py", line 218, in __call__
    return self.__song(key, *args)

  File "/usr/lib/python3/dist-packages/quodlibet/formats/_audio.py", line 387, in __call__
    return os.path.dirname(self["~filename"]) or self["~filename"]

KeyError: '~filename'

I keep albums with multiple artists under directory Various Artists, so when I search one of these albums, I don't wanna use the artist name, only the album name.

@declension declension added the bug label Mar 17, 2018

@declension

This comment has been minimized.

Member

declension commented Mar 17, 2018

Thanks, replicated on latest(ish) master

@marcelpaulo

This comment has been minimized.

marcelpaulo commented Mar 17, 2018

Wow, that was quick ! I guess I'll wait for the next update in ppa:lazka/dumpingplace to test it. Thanks !

@marcelpaulo

This comment has been minimized.

marcelpaulo commented Mar 17, 2018

I've just read the Development Guide and learned I could clone the git repo and run QL from the source without installing. So, yes, it's working, problem solved ! Once again, thanks @declension !

@declension

This comment has been minimized.

Member

declension commented Mar 17, 2018

No worries 😄

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