Commit graph

157 commits

Author SHA1 Message Date
Adrian Sampson
0051bdb506 lyrics: Avoid a spurious warning 2016-06-02 21:33:33 -07:00
Adrian Sampson
581fba6288 lyrics: Avoid crash when enabling google
If you *both* haven't set an API key *and* BeautifulSoup wasn't
installed, the list.remove() call would crash. (This came up when
running the tests on a fresh machine without many dependencies.)
2016-06-02 11:58:14 -07:00
wordofglass
1dd6739218 lyrics: fix a bug where the lyricswiki fetcher would try to unescape an empty (None) response and crash 2016-04-30 01:25:02 +02:00
wordofglass
c3c7da8061 lyrics: simplify source handling a little 2016-04-28 18:31:22 +02:00
wordofglass
2928a16bd5 lyrics: actually disable translation when there's no langdetect 2016-04-28 17:22:55 +02:00
wordofglass
c4b11f889f lyrics: clean up import handling and source removal 2016-04-28 17:15:25 +02:00
Jack Wilsdon
c5e2334fb5 Remove useless unescape
Remove useless unescape as _scrape_script_cruft does it for us.
2016-04-25 19:24:26 +01:00
Jack Wilsdon
1be9c3003e 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.
2016-04-25 19:14:30 +01:00
wordofglass
607f41be43 Fix the previous fix... 2016-04-24 00:42:31 +02:00
wordofglass
4a5b886944 Fix two non-guarded import statements in the lyrics plugin
These could make the import process crash with a traceback.
2016-04-24 00:35:15 +02:00
Guilherme Danno
bf1b06f0c7 don't print entire lyrics during import 2016-04-22 17:30:06 -03:00
Fabrice Laporte
05970e8a93 re-query token when it has expired 2016-04-14 22:57:41 +02:00
Fabrice Laporte
56d7e5dfa0 send as little text as possible to bing api
Bing API has a limit of 2M chars/month. It’s common to have repeating
sentences in lyrics so to reduce number of chars sent per song, store
sentences in a set and send it, instead of sending the whole lyrics.
2016-04-14 22:57:17 +02:00
Fabrice Laporte
6cfc106b8a better docs and debug msg 2016-04-14 08:31:55 +02:00
Fabrice Laporte
58df77e2cb langdetect conditional import 2016-04-14 08:31:14 +02:00
Fabrice Laporte
e03c3af91f don't translate lyrics already in the target language 2016-04-14 01:11:14 +02:00
Fabrice Laporte
66a627fed8 restore module docstring 2016-04-14 00:58:42 +02:00
Fabrice Laporte
3c2479ab49 translate lyrics using Bing API
By subscribing to Microsoft Translator API, one can now activate the
translation of lyrics from one set of source langages to a target
langage.
Translations are appended to each original sentence using ‘/‘ as
separator.
2016-04-14 00:53:58 +02:00
Fabrice Laporte
d67950cdcc pep8 2016-04-14 00:45:55 +02:00
Adrian Sampson
d1753b341e lyrics: Some comments and better naming 2016-03-21 10:28:30 -07:00
Adrian Sampson
f684f29a25 lyrics: Tolerate pages without text (fix #1914) 2016-03-21 10:24:13 -07:00
Adrian Sampson
c9be5bc7d1 Merge pull request #1911 from jackwilsdon/fix-musixmatch-url
Fix MusixMatch issues
2016-03-18 11:51:27 -04:00
Jack Wilsdon
60148918d9 Fix LyricsWiki scraping code
LyricsWiki now escapes song lyrics using HTML entities (presumably to
prevent scraping), so we now unescape these before parsing.

LyricsWiki has also added a script tag inside the div we are scraping,
so we have to remove this using `scrape_lyrics_from_html`.
2016-03-17 17:49:41 +00:00
Jack Wilsdon
c417003184 Add missing newline 2016-03-16 21:07:28 +00:00
Jack Wilsdon
1ec06e14c5 Fix lyrics extraction from MusiXmatch
Remove "lyrics_" prefix from extract_text_between arguments to reflect
changes made to the MusiXmatch website.
2016-03-16 20:48:57 +00:00
Jack Wilsdon
44c799320f Improve URL generation in lyrics plugin
Allow custom replacements to be defined in subclasses of
SymbolsReplaced.

Replace spaces with a hyphens when the source is MusiXmatch, instead of
(incorrectly) using underscores. This fixes #1880.
2016-03-16 20:46:36 +00:00
Adrian Sampson
e54c7eec3d Standardize __future__ imports without parentheses
Since the list is short enough now, we don't need parentheses for the line
wrap. This is a little less ugly.
2016-02-28 15:03:51 -08:00
Adrian Sampson
d53019f9db Further whitespace fiddling
Most commonly, this sticks with:

    log.debug(
        'some long message here'
    )

instead of placing the closing ) at the end of the string literal.
2016-02-28 14:48:10 -08:00
Peter Kessen
f2fc1a78bf Removed import of unicode_literals from plugins
* keyfinder
* lastimport
* lyrics
2016-02-20 13:59:58 +01:00
Adrian Sampson
60888274c4 lyrics: Re-disable Genius backend
As #1854 pointed out, the Genius API service is down *again*.
2016-02-02 08:14:22 -08:00
Adrian Sampson
36ad0cf70d lyrics: Re-enable genius backend (#1770) 2016-01-06 14:29:51 -08:00
Jack Wilsdon
12cd5306b7 Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
Adrian Sampson
a976c371f6 lyrics: Disable Genius backend by default (#1770) 2015-12-28 16:35:39 -08:00
Adrian Sampson
1a2ffd0426 lyrics: Catch errors in Genius backend (fix #1770)
The HTTP requests had no error handling. Now they have lots.
2015-12-28 16:32:28 -08:00
Adrian Sampson
5a285cc11f Fix #1673: Escape regex terms in lyrics 2015-12-12 18:09:24 -08:00
Adrian Sampson
d11fe020ce snake_case variable names 2015-12-12 18:03:12 -08:00
Peter Kessen
3eb8008b11 added encoding as comment in files
added line like
# -*- coding: utf-8 -*-
to all files with correct license in header
2015-11-19 18:41:01 +01:00
Adrian Sampson
9f7aa866bd Use ui.should_write everywhere
There sure are a lot of plugins that want to write metadata!
2015-11-07 13:20:09 -08:00
Joe LaSala
3ab9932059 Add Genius as a lyric source
Makes use of the Genius API and genius-api.com, a separate resource that
provides readable lyrics.
2015-10-13 19:14:08 -05:00
Adrian Sampson
b477f4a53f Merge pull request #1376 from tomjaspers/config-redacted-fields
Config: new option -r redacts sensitive fields

Conflicts:
	beets/util/confit.py
2015-03-27 22:11:24 -04:00
Tom Jaspers
944d38064d Config: implement redacted fields more idiomatic
- `add_redacted_fields(self, *field_names)` to use argument unpacking
- foo =| bar instead of foo = foo | bar
2015-03-25 14:55:29 +01:00
Tom Jaspers
f4ed3e16b1 Config: Add redacted fields from included plugins 2015-03-24 17:01:33 +01:00
Adrian Sampson
e7f8a627e9 Style fixes for pep8 1.6 2015-02-07 12:51:54 -08:00
Adrian Sampson
b8dab9cf9f Merge pull request #1247 from brunal/future
Use all __future__ imports in beets core

Conflicts:
	beetsplug/web/__init__.py
	test/test_embedart.py
2015-01-26 17:02:07 -08:00
Bruno Cauet
8165dec985 Delete manual formattings of album & item 2015-01-25 21:32:22 +01:00
Bruno Cauet
438044c6ae Fix bytes/str with unicode-nazi
Further cleaning will require setting unicode_literals on plugins
2015-01-20 15:25:12 +01:00
Bruno Cauet
02d8e88ef1 Replace all mentions of 'str' with 'bytes' 2015-01-20 12:48:15 +01:00
Bruno Cauet
90b388b775 Use __future__ imports but unicode_literals everywhere
Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.

Goal is smoothing the transition to python 3.
2015-01-19 12:25:16 +01:00
Bruno Cauet
b49cd3b73b Lyrics plugin: fix google backend
Give config on backends init so the Google backend can get the API key
and Engine Id.
Fix #1226
2015-01-15 11:28:04 +01:00
Bruno Cauet
4babc40fd8 Delete useless "config['mypluginname']" mentions
Replace with self.config where this is painless.
More plugins would benefit from this update but that requires turning
functions into methods.
2015-01-12 10:55:59 +01:00