Commit graph

2434 commits

Author SHA1 Message Date
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é
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
Adrian Sampson
813cf97686 Better metavariable for lyrics --help output 2017-07-16 10:10:41 -04:00
Antoine Beaupré
5d8c15980e
fix flake8 warning 2017-07-15 16:24:07 -04:00
Antoine Beaupré
0bcd16f1ab
deal with encoding issues in python3
when we encode explicitly, we return bytes, so open files as binary
2017-07-15 16:21:41 -04:00
Antoine Beaupré
f667428758
write sphinx base files
we write the artists files in a subdirectory, to avoid infinite
recursions or flooding the current directory needlessly.

this way, the user has a good base structure and can just chain the
command into sphinx to continue building the next format, after
possible tweaks.
2017-07-15 15:43:16 -04:00
Antoine Beaupré
e6adb5e7da
cosmetic: do not use needless heredoc 2017-07-15 15:33:35 -04:00
Antoine Beaupré
91de8aac84
move rst writer to a different function
this simplifies and clarifies the code, although we need to call the writerst function twice to wrap up at the end of the loop
2017-07-15 15:33:35 -04:00
Antoine Beaupré
d330353e1c
rename the skip option to local
skip was a misnomer: we actually skip "unfetched" lyrics. this means
it's somewhat of a double-negative and really confusing.

--local is clearer, although less in opposition with --force
2017-07-15 14:19:25 -04:00
Antoine Beaupré
ac32ae574c
optimize: write only 3 times per file
this makes the code more readable and reduces the number of syscalls
to write files
2017-07-15 09:23:59 -04:00
Antoine Beaupré
469c03a7bf
deal properly with empty album titles 2017-07-15 09:23:59 -04:00
Antoine Beaupré
63aa3b3165
write to separate rst files
this makes the ePUB easier to parse by e-readers, because they do not
need to load one giant HTML file, but one per author. it also makes
sphinx rendering more efficient and interactive
2017-07-15 09:23:58 -04:00
Antoine Beaupré
0fbfa1feae
render RST instead of HTML
ReStructuredText has the advantage over HTML that it can be rendered
easily to multiple formats (HTML, ePUB, PDF) and it supports indexes.

the output needs to be fed into a file and integrated into an existing
Sphinx document, of course.
2017-07-14 17:34:55 -04:00
Antoine Beaupré
9f3e5b28b4
output lyrics in HTML, allow skipping
the idea here is to format the lyrics output a little better so that
it can (for example) be shown as a web page or an ebook.

the new skip option allows for faster generation of the output in the
(most common) case where not all lyrics are available.
2017-07-14 15:31:22 -04:00
Michal Koutenský
70a2ad354b fixes issue #2615 2017-07-04 15:53:02 +02:00
Adrian Sampson
f2b6801e6c Merge pull request #2596 from aranc23/metasync-fixes
do not quote the value in xml, use quoteattr to add quotes as needed
2017-06-15 21:01:46 -04:00
Adrian Sampson
8ba0060f44 Wrap a long line 2017-06-15 20:46:54 -04:00
Adrian Sampson
009c6a4f6d Slightly clearer layout for #2593, and comments 2017-06-15 17:51:14 -04:00
Aran Cox
f36c70c754 do not quote the value in xml, use quoteattr to add quotes as needed 2017-06-15 09:00:59 -05:00
robot3498712
cafbb2438e fixed failing test - line too long 2017-06-15 13:27:28 +02:00
robot3498712
bc8a8ecf5f fix /issues/2592: web: Use Unicode paths to send files on Windows under Python 2 2017-06-15 12:49:00 +02:00
Adrian Sampson
ace5656e36 Complete set of __future__ imports 2017-06-14 19:08:27 -04:00
Adrian Sampson
1f2b8cef97 Tiny code and docs fixes for gmusic (#2586) 2017-06-14 19:05:38 -04:00
Adrian Sampson
4563e3b6dd Merge pull request #2586 from tigranl/gmusic
Add Google Music plugin
2017-06-14 18:52:20 -04:00
Tigran Kostandyan
06f86c82e5 PEP8 2017-06-11 22:36:09 +03:00
Tigran Kostandyan
28ba733ebe Add custom exception and mark fields as redacted.
Remove Musicmanager global variable.
Update gmusic.rst
2017-06-11 22:27:44 +03:00
Adrian Sampson
290162a7eb Merge pull request #2294 from anshuman73/master
Fixed #2200 and a small typo
2017-06-10 20:50:50 -04:00
Adrian Sampson
15a7dfccff Merge pull request #2583 from yacoob/master
Fix a lastgenre crash
2017-06-10 20:47:19 -04:00
tigranl
b1d8321e40 Add Google Music plugin 2017-06-05 16:48:23 +03:00
Jakub Turski
ee46a5150f Don't crash if non-canonical genre and prefer_specific: yes.
Also, add a test for this.
2017-06-02 15:48:05 +01:00
Michal Koutenský
2685f13315 replaygain: support r128 2017-05-17 21:48:01 +02:00
Adrian Sampson
faf8be089b Merge pull request #2549 from Kraymer/drop-lyrics-com
Drop lyrics.com backend
2017-05-04 09:34:48 -04:00
Adrian Sampson
b57c49d738 Add a period to a comment, simplify one expression
w.r.t. #2542
2017-05-04 09:29:27 -04:00
Adrian Sampson
908b8dca97 Merge pull request #2542 from ocelotsloth/2532-web-serializer-bytes
web: #2532 - Decode bytes values to strings
2017-05-04 09:20:38 -04:00
Fabrice Laporte
409f070970 Remove lyrics.com source 2017-05-03 22:54:09 +02:00
Mark Stenglein
22f07b91e9 web: __init__: _rep: Make the looping more pythonic
As suggested, changes around the for loop to make it a bit more
pythonic by using an if loop inside a normal for loop.

Signed-off-by: Mark Stenglein <mark@stengle.in>
2017-05-03 16:36:40 -04:00
Mark Stenglein
9394e0ac63 web: __init__: _rep: change to base64 encoding
As suggested, this commit adds base64 encoding for the bytes
encoding.

Signed-off-by: Mark Stenglein <mark@stengle.in>
2017-05-03 16:34:30 -04:00
Fabrice Laporte
fc6b65d592 Merge pull request #2538 from Kraymer/lyrics-test
Tests to track whether lyrics websites are correctly fetched
2017-05-03 20:02:03 +02:00
Mark Stenglein
471d46d67e web: __init__: _rep: Filter all bytes for serializer
This commit fixes issue #2532 by filtering out any byte values
added by any other extensions and decoding them to strings for the
JSON serializer.

It does not remove any of the keys, instead opting to just convert
them.

Signed-off-by: Mark Stenglein <mark@stengle.in>
2017-05-03 00:03:05 -04:00
Fabrice Laporte
7dab9f339e Restore beets module import 2017-05-02 23:48:20 +02:00
Fabrice Laporte
07af27e44b Lyrics are last paragraph with class 'mxm-lyrics__content'
Remove ‘data-reactid’ from marker.
2017-05-02 23:40:25 +02:00