Commit graph

352 commits

Author SHA1 Message Date
Šarūnas Nejus
9d2b34d457
Create DirectBackend interface for MusiXmatch and Tekstowo
And replace some of the encoding logic by unidecode.
2024-10-12 01:29:55 +01:00
Šarūnas Nejus
f36bc497c8
Fix lint issues
- Fix imports
- Fix pytest issues
- Do not assign lambda as variable
- Use isinstance instead of type to check type
- Rename ambiguously named variables
- Name custom errors with Error suffix
2024-09-21 11:59:18 +01:00
Šarūnas Nejus
85a17ee503
Reformat the codebase 2024-09-21 11:57:48 +01:00
Serene-Arc
79449b0851
Filter ending newlines 2024-07-11 15:15:40 +10:00
HomerHaddock
50bfe6a179 Fix bug #4815 2024-07-06 23:10:33 -06:00
Lev Gorodetskiy
2130404217
Add timeout to all requests calls 2024-05-25 12:24:53 -03:00
wisp3rwind
a9423b7b2d lyrics: remove version switch that became obsolete when we dropped Python 3.5 2024-04-27 16:02:26 +02:00
jeff
7b0f5fb3f3 Add config option to prefer synced lyrics over plain 2023-11-05 11:26:33 -05:00
jeff
e14982cad7 Add LRCLIB as a provider for the lyrics plugin 2023-11-05 11:26:33 -05:00
Serene-Arc
a6e5201ff3 Apply formatting tools to all files
This is 'the big one', which touches every file so that it all conforms
to the given standard.
2023-10-22 09:53:18 +10:00
Adrian Sampson
49846e7851
lyrics: Bypass None values in Google backend
Fixes #4875.
2023-08-13 18:52:39 -04:00
luzpaz
8419149c7a
Fix various typos 2023-08-09 21:26:15 -04:00
Jack Wilsdon
dad9d2393d Remove Musixmatch from default enabled sources
Musixmatch are currently blocking all requests with the beets user
agent. See #4585.
2022-12-31 14:34:07 +00:00
Luke Harder
f155d3ba75 bug 4406 fix v5 (tests pass again) 2022-11-22 20:40:13 -05:00
Luke Harder
4a1f25e1b1 bug 4406 fix v4 (added configurable threshold) 2022-11-22 13:25:09 -05:00
Luke Harder
252121f537 bug 4406 fix 2022-11-10 12:54:45 -05:00
Adrian Sampson
8cb314350c
Avoid BeautifulSoup deprecation warning
The `text` parameter to `SoupStrainer` was renamed to `string` in 2015
(4.4.0) and started producing a warning this year (4.11.0).
https://bazaar.launchpad.net/%7Eleonardr/beautifulsoup/bs4/view/head:/CHANGELOG
2022-08-21 09:50:53 -07:00
olgarrahan
a26a530996 replace_br function added to reduce code duplication 2022-04-17 15:25:14 -04:00
olgarrahan
16d74bafc3 Genius lyrics header bug fixed and updated test case for lyrics plugin 2022-04-16 13:19:13 -04:00
olgarrahan
c0bb2ff2a1 Genius lyrics header bug fixed and updated test case for lyrics plugin 2022-04-15 16:37:05 -04:00
ybnd
414760282b Remove footer text from Genius lyrics 2022-01-10 22:09:03 +01:00
ybnd
3f896ab281 Make Tekstowo scraper more specific 2022-01-10 19:03:36 +01:00
Ramon Boss
69fe1d1baf
fix: use query param for genius search 2021-11-30 20:10:56 +01:00
Adrian Sampson
a0365e6f1c
Merge branch 'master' into pr_fix_lyrics_bs 2021-09-28 16:04:06 -04:00
wisp3rwind
a23857fc64 lyrics: fix crash when beautifulsoup4 is not installed
Fixes #4027
2021-09-28 00:31:42 +02:00
Andrew Rogl
fc4d65a387 Missed a few unicode strings 2021-09-26 16:51:01 +10:00
Andrew Rogl
ee4268dabb Remove unused imports
Fix imports
Fix formatting
2021-08-26 20:59:48 +10:00
Andrew Rogl
1ec87a3bdd pyupgrade beetsplug and tests
All tests working
More tidy up to be done
2021-08-26 19:12:51 +10:00
wisp3rwind
0c285753fb lyrics: Add some missing None-checks to the Tekstowo source
The previous code had the potential to crash if (when?) Tekstowo changes
their website structure sufficiently.

The new code is rather ugly due to the explicit checks after each and
every function call. Unfortunately, the alternative would be to catch a
bunch of very generic Exceptions (AttributeError, ...), since there's no
such thing as a `BeautifulSoupNotFoundError`.
2021-07-04 10:38:00 +02:00
wisp3rwind
09be82bd75 lyrics: slightly more consistent white space in Tekstowo source 2021-07-04 00:35:42 +02:00
Martin Atukunda
efcc5b3fae
return None for lyrics if Tekstowo fails to extract lyrics
I experienced a failure to parse Tekstowo for song lyrics. 

This patch allowed the lyrics plugin to fetch the lyrics from another provider as opposed to failing.
2021-07-01 09:39:42 +03:00
wisp3rwind
316b79f72f lyrics: slightly refactor beautifulsoup checks
instead of having a global list of sources that require the package,
indicate the dependency using an attribute of the source class
2021-06-18 17:16:04 +02:00
wisp3rwind
038cebfa9b lyrics: remove duplicate check for beautifulsoup
The plugin already disables these sources entirely when beautifulsoup is
not available
2021-06-18 17:16:04 +02:00
wisp3rwind
867d383544 lyrics: wrap BeautifulSoup() constructor to centralize error handling
also ensure that the return value is always checked for None
2021-06-18 17:16:04 +02:00
wisp3rwind
b34442f5d1 lyrics: always check for fetch_url() returning None 2021-06-18 17:16:04 +02:00
wisp3rwind
f8a4c661fa lyrics: return None explicitly 2021-06-18 17:16:04 +02:00
wisp3rwind
76aa97827d lyrics: rename html -> soup for consistency 2021-06-18 17:16:04 +02:00
Xavier Hocquet
8b979f2a50 Review comments 2021-04-11 18:38:01 -05:00
Xavier Hocquet
31f4df3ff3 Fix falso positive lyric pages for Tekstowo 2021-04-11 17:30:45 -05:00
Evgeniy Gurevich
afc072801c
Simplify Musixmatch multi-part lyrics parser 2021-04-02 10:35:53 +08:00
Evgeniy Gurevich
a8fe8ce9a7
Fix for Musixmatch multi-part lyrics
Sometimes Musixmatch lyrics come in 2 parts.
Also, sometime non-existent lyrics return some content
2021-04-01 14:21:49 +08:00
Xavier Hocquet
6081e6a8df CR comments 2021-03-28 13:08:00 -05:00
Xavier Hocquet
8c6530369d
Merge branch 'master' into tekstowo-lyrics 2021-03-28 12:05:42 -06:00
AnonTester
ecfafb5041 Adjust comment to pass lint test 2020-11-07 21:48:21 +00:00
AnonTester
176fa55bf6 lyrics: Strip \u2005 (four-per-em space) in lyrics (Issue 3789)
https://github.com/beetbox/beets/issues/3789
2020-11-07 21:41:16 +00:00
Jack Wilsdon
580495f1d6
Simplify MusiXmatch backend and remove unused code 2020-10-05 22:56:01 +01:00
Jack Wilsdon
d115f3679b
Remove LyricWiki source
LyricWiki was shut down on 2020/09/21 and no longer serves lyrics.
2020-10-05 22:15:40 +01:00
wisp3rwind
44e4d558c9 lyrics: fix bad_triggers in the google plugin
regression from 117d16f
2020-07-12 22:23:17 +02:00
jtpavlock
45abc9ed7a
Clean up code and tests for Genius Lyrics plugin backend (#3641)
* clean-up code & add tests for genius lyrics backend

* add genius fetch tests

* organize imports: standard lib -> pip -> local

* check in sample genius lyrics page

* fix mock import

* force utf-8 encoding for opened files

* use io.open to force utf-8 encoding w/ python2.7
2020-07-06 08:41:27 -05:00
Jacob Pavlock
7220c91d2a generalize genius artist matching to use slug() 2020-06-26 18:56:20 -07:00
Jacob Pavlock
bb5740d63c better debug message for no genius artist match 2020-06-26 16:41:20 -07:00
Jacob Pavlock
ae175e156b fix genius lyrics artist matching when artist contains a hyphen 2020-06-26 16:10:33 -07:00
Adrian Sampson
3aad6f42ce Merge pull request #3602 from jef/jef/github-actions
feat: added github actions
2020-06-05 09:56:59 -04:00
ybnd
d1f3d664d7 Implement comments & add to changelog 2020-06-04 16:43:42 +02:00
ybnd
b239a0b3d2 Fix item == None issues when writing lyrics ReST
* Skip ReST writing & sphinx info messages if query doesn't yield anything
* `writerest` into `appendrest` and `writerest`, don't call `writerest(item=None)` to flush state at the end.
2020-06-04 11:15:34 +02:00
Jef LeCompte
9f8bd4cd3f
style: flake8 linting 2020-05-25 20:06:43 -04:00
Jef LeCompte
0c3201930c
feat: added github actions
only working with linux for now. exact replica of travis basically.
should probably try to implement the rest of tox or deprecate some
functionality.
2020-05-25 19:35:15 -04:00
stlutz
5d306d6fd9 Remove debugging statement and conform to line length. 2020-05-16 17:48:56 +02:00
stlutz
15402f6aa7 Add alternative scraping algorithm to deal with Genius's new song page html layout. 2020-05-16 17:15:45 +02:00
stlutz
46143d9762 Remove unnecessary intermediate web request to genius.com when fetching lyrics.
The search results already include the correct song page url, making it superfluous to do another request via the /song api just to get it.
2020-05-16 16:28:17 +02:00
stlutz
ac043f9be0 When fetching lyrics from Genius, search for title and artist.
Searching only for the title and just verifying the artist afterwards leads to songs with very common titles not being found, since Genius limits the amount of returned hits.
An example would be 'Saviour' by 'Circa Waves'.
2020-05-16 13:26:09 +02:00
Ashhar Hasan
625e9253c0
Add tests for artist_sort as lyrics search fallback
Adjust doc comment to highlight that artist_sort is used as a fallback
2020-04-19 19:19:07 +05:30
Ashhar Hasan
45c8e51d6c
Fix redundant requests for artist == artist_sort 2020-04-19 19:14:00 +05:30
Ashhar Hasan
a5ef8c7b09
Add artist_sort as the last entry in the artists to search
This will handle cases where the artist name includes some
characters which can cause a search failure for some
websites - mainly unicode.

Fixes https://github.com/beetbox/beets/issues/3340.
2020-04-19 00:50:14 +05:30
Adrian Sampson
269e309513 Slight simplification for #3554 2020-04-17 18:28:21 -04:00
lijacky
9ec0d725e5 Changes given feedback on https://github.com/beetbox/beets/pull/3554 and trimmed sample html 2020-04-17 17:14:21 -04:00
lijacky
8e28f0b694 added null check for genius lyrics scrape 2020-04-16 19:06:17 -04:00
Xavier Hocquet
38ea35aa5e Lint 2020-03-28 11:44:56 -06:00
Xavier Hocquet
58bfe4567e Code review 2020-03-28 11:34:03 -06:00
Xavier Hocquet
1266a04998 Docs, lint, and cleanup beautifulsoup source check 2020-03-19 21:10:52 -06:00
Xavier Hocquet
306571883e Implement tekstowo lyrics provider 2020-03-18 23:00:51 -06:00
Adrian Sampson
95e0f54d7c Fix too-long lines (#3448) 2020-02-02 21:04:55 -05:00
Xavier Hocquet
9f43408f1b Changelog and cleanup 2020-02-02 15:57:43 -07:00
Xavier Hocquet
c8e8e587f8 Add debug logger for Genius lyrics no-match 2019-12-05 20:06:49 -07:00
Xavier Hocquet
d43cf35ad2 Strip and lowercase Genius lyrics artist comparison 2019-12-05 20:06:46 -07:00
FichteFoll
1a23eab8b6
Use https for lyrics.wikia.com, when supported 2019-06-05 23:00:52 +02:00
Carl Suster
e4c03fd63f Fix deprecated placement of inline regex flags
https://bugs.python.org/issue22493
2019-03-31 19:44:49 +11:00
Adrian Sampson
bac8faad78 Resolve W605: invalid escape sequence
This came up in lots of regexes that weren't using "raw" literals.
2018-08-13 10:41:01 -04:00
Abra
3348a466f4 Make lyrics plugin group songs by 'albumartist' rather than 'artist'
when writing ReST
2018-05-14 11:18:34 +04:00
rachmadaniHaryono
e90a547642 chg: dev: fix list item remove error 2018-05-03 09:46:03 +08:00
Adrian Sampson
224d782c2c Fix #2771: handle errors in genius lyrics source 2018-01-30 22:37:44 -05:00
Adrian Sampson
277d81b4d6 lyrics: Don't write ReST by default! 2018-01-30 22:33:32 -05:00
Adrian Sampson
e7417e3683 lyrics: Don't crash when BeautifulSoup isn't found 2018-01-30 22:31:15 -05:00
Lucas Magno
fc2d379fb5 Comply with PEP8 2017-10-09 06:22:42 -03:00
Lucas Magno
1b35a5df0d Fetch lyrics from Genius through scraper 2017-10-08 09:13:51 -03:00
Adrian Sampson
c06eca7e58 Merge pull request #2634 from anarcat/musixmatch-block-detect
lyrics: detect MusixMatch blocking
2017-07-18 17:13:31 -04:00
Antoine Beaupré
5ef68783a8
strip trailing and leading extra dashes
those are introduced if non-word characters are found, and are ugly
2017-07-18 16:33:22 -04:00
Antoine Beaupré
b4b5473093
add pointer to slugify in slug 2017-07-18 16:14:10 -04:00
Antoine Beaupré
a8afabea80
move slug utility function to top-level
it's a generic utility function that can be reused, there's nothing
class-specific about it.
2017-07-18 16:12:48 -04:00
Antoine Beaupré
5e8d17a4fc
lyrics: detect MusixMatch blocking
we just look for the bad string in the HTML. this has the downside
that we may consider songs that have those exact lyrics (you never
know, really) may trigger this warning as well and we would fail to
fetch those songs.

we also fail if lyrics contain another magic string that seems to come
up when you do fill in the CAPTCHA after being blocked.
2017-07-17 12:21:55 -04:00
Antoine Beaupré
458f3636f4
compare artists based on the slug
this is necessary because otherwise artists with different string
representations but the same slug would overwrite one another

this outlines more clearly the code duplication between the rst code
and the slugify function, something which can be fixed later.
2017-07-17 11:59:14 -04:00
Antoine Beaupré
9c36a41ea8
slight refactoring: strip album only once 2017-07-17 11:50:15 -04:00
Antoine Beaupré
9894e8752b
ignore trailing/leading whitespace when comparing artists 2017-07-17 11:49:35 -04:00
Antoine Beaupré
36f84bfedd
add missing trailing newline after lyrics block
this would yield a warning for every song
2017-07-17 11:44:06 -04:00
Adrian Sampson
b303d5beb0 Slightly more complete sentences in comments 2017-07-17 10:59:04 -04:00
Antoine Beaupré
93966ed4ee
strip whitespace in titles
this would cause problems with songs that had trailing spaces with the
index directive
2017-07-17 09:00:22 -04:00
Antoine Beaupré
b6e42ee2e8
fix another unicode error
the unicode strings are not binary - rely on Python to do the right
thing here instead of encoding a string we know is already properly
encoded
2017-07-17 08:55:09 -04:00
Antoine Beaupré
6d58110bd2
move heredocs to top-level globals 2017-07-17 08:50:19 -04:00
Antoine Beaupré
7e0a48a46d
s/rest/rest/ 2017-07-17 08:49:40 -04:00
Adrian Sampson
9de94378b9 An even shorter metavariable 2017-07-16 10:14:49 -04:00