From 55c68536c2adcc75216e2e2f9c76f08d6fb4fb56 Mon Sep 17 00:00:00 2001 From: Dave Hayes Date: Wed, 13 Feb 2013 09:59:58 -0600 Subject: [PATCH 1/4] Fix removal of suffixes for values that have them --- beets/mediafile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beets/mediafile.py b/beets/mediafile.py index 71e429864..927cb389b 100644 --- a/beets/mediafile.py +++ b/beets/mediafile.py @@ -547,7 +547,7 @@ class MediaField(object): # Remove suffix. if style.suffix and isinstance(out, (str, unicode)): if out.endswith(style.suffix): - out = out[:len(style.suffix)] + out = out[:-len(style.suffix)] # MPEG-4 freeform frames are (should be?) encoded as UTF-8. if obj.type == 'mp4' and style.key.startswith('----:') and \ From 2f1dd9451b9b189a6518ec775363fe9283245200 Mon Sep 17 00:00:00 2001 From: Dave Hayes Date: Mon, 25 Apr 2016 13:04:05 -0500 Subject: [PATCH 2/4] Add notes for installing the ZSH completion script --- docs/reference/cli.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/reference/cli.rst b/docs/reference/cli.rst index fcef6d23f..faae67ee6 100644 --- a/docs/reference/cli.rst +++ b/docs/reference/cli.rst @@ -435,7 +435,10 @@ later on you will want to re-generate the script. zsh ``` -If you use zsh, take a look at the included `completion script`_. +If you use zsh, take a look at the included `completion script`_. The script +should be placed in a directory that is part of your ``fpath``, and `not` +sourced in your ``.zshrc``. Running ``echo $fpath`` will give you a list of +valid directories. Another approach is to use zsh's bash completion compatibility. This snippet defines some bash-specific functions to make this work without errors:: From 1be9c3003ef297374abd9dfc6bee00811286570f Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Mon, 25 Apr 2016 19:14:30 +0100 Subject: [PATCH 3/4] Use different method to remove junk from LyricsWiki Use `_scrape_strip_cruft` instead of `scrape_lyrics_from_html` so that LyricsWiki does not depend on Beautiful Soup. --- beetsplug/lyrics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index de9e1b313..70ce9c38b 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -335,7 +335,7 @@ class LyricsWiki(SymbolsReplaced): # Get the HTML fragment inside the appropriate HTML element and then # extract the text from it. html_frag = extract_text_in(unescape(html), u"
") - lyrics = scrape_lyrics_from_html(html_frag) + lyrics = _scrape_strip_cruft(html_frag, True) if lyrics and 'Unfortunately, we are not licensed' not in lyrics: return lyrics From c5e2334fb523052693669b71f49fb9443e74acbb Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Mon, 25 Apr 2016 19:24:26 +0100 Subject: [PATCH 4/4] Remove useless unescape Remove useless unescape as _scrape_script_cruft does it for us. --- beetsplug/lyrics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index 70ce9c38b..afd536394 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -334,7 +334,7 @@ class LyricsWiki(SymbolsReplaced): # Get the HTML fragment inside the appropriate HTML element and then # extract the text from it. - html_frag = extract_text_in(unescape(html), u"
") + html_frag = extract_text_in(html, u"
") lyrics = _scrape_strip_cruft(html_frag, True) if lyrics and 'Unfortunately, we are not licensed' not in lyrics: