Commit graph

3081 commits

Author SHA1 Message Date
Rahul Ahuja
4a552595df Simplify regex match 2019-09-02 14:27:51 -07:00
Rahul Ahuja
9babce582d Fix track data enumeration idx 2019-09-01 21:24:56 -07:00
Rahul Ahuja
2ab883a20e Fix track.index assignment 2019-09-01 21:23:16 -07:00
Rahul Ahuja
70264ee6ee Handle empty deezer_id upfront 2019-09-01 21:18:08 -07:00
Rahul Ahuja
cd1aa3e8aa Avoid empty deezer_id string 2019-09-01 20:10:34 -07:00
Rahul Ahuja
43f09296c9 Fix AlbumInfo.album_credit assignment 2019-09-01 19:50:55 -07:00
Rahul Ahuja
2177c7695a Stringify Deezer ID 2019-09-01 19:44:27 -07:00
Rahul Ahuja
790ca805d5 Formatting 2019-09-01 18:34:06 -07:00
Rahul Ahuja
2cf55ee893 Add deezer.rst doc, remove unused options 2019-09-01 18:33:27 -07:00
Rahul Ahuja
804397bb12 Appease flake8 2019-09-01 18:13:19 -07:00
Rahul Ahuja
6e5e8a9cb0 Add Deezer plugin 2019-09-01 17:53:56 -07:00
Vexatos
7aab50b7b8
convert: Reduce amount of duplicate code for linking.
Also slightly reworded documentation.
2019-08-21 12:19:47 +02:00
Vexatos
aeb7d8846e
convert: disable album-art embedding for linked files.
Fixed flag precedence of link and hardlink over their options.
Fixed formatting issue.
2019-08-20 16:40:02 +02:00
Vexatos
a61aa74061
convert: add option to hardlink instead of copying.
Overrides the --link option.

As proposed in #2324.
2019-08-20 16:07:01 +02:00
Kier Davis
4820cee35c
convert: add option to symlink instead of copying
As proposed in #2324.

Updated commit from #2326.

Co-authored-by: Vexatos <stuarzt@gmx.de>
2019-08-20 14:50:44 +02:00
Sebastian Pucilowski
a2ee8da8d6 Refactor magic values in discogs_client 2019-08-11 11:21:22 +10:00
Rahul Ahuja
7ec3632309 Fix year assignment with year-only release date 2019-08-03 19:07:56 -07:00
Samuel Nilsson
6e24669d61 Fix #3341 2019-08-03 22:51:40 +02:00
Guilherme Danno
4908028985
Use the 'resource_url' from discogs_client 2019-07-30 16:46:59 -03:00
Samuel Nilsson
60c174101f ffmpeg replaygain backend: Only calculate replaygain for audio stream. Fixed documentation for backend option. 2019-07-29 10:32:19 +02:00
Zsin Skri
e3645dfd59
Merge branch 'master' into r128-targetlevel-config 2019-07-25 23:22:32 +02:00
Zsin Skri
a9f70f8151 apply suggested improvements
Apply improvements suggested in GitHub PullRequest #3065:
- be idiomatic
  - 0 is falsy
  - check enum equality, not identity
  - mutate list by constructing a new one
- improve documentation
  - fix a typo
  - do not mention deprecation of a config option
2019-07-26 01:02:03 +02:00
Adrian Sampson
84032e56e2 Merge pull request #3334 from MartyLake/martylake_add_forward_slash_option
Add option to force forward slashes in paths
2019-07-24 22:11:59 -04:00
Paul Malcolm
5f9a394ca9 Issue #2860 Fetch more acousticbrainz fields 2019-07-23 20:25:26 -04:00
MartyLake
076a82daa6 Review: Rename method 2019-07-24 00:09:52 +02:00
MartyLake
ee7f939336 Review: Remove stray blank line 2019-07-23 23:53:50 +02:00
MartyLake
aa1da3166f Review: Remove unnecessary parens 2019-07-23 23:53:17 +02:00
MartyLake
dd9de05968 Review: Remove unnecessary split of concat 2019-07-23 23:50:20 +02:00
MartyLake
da864402d5 Review: Remove unnecessary get 2019-07-23 23:49:17 +02:00
MartyLake
d1ba309f36 Add a new method that copied pathlib.path.as_posix 2019-07-23 17:17:40 +02:00
Zsin Skri
e7e2c424e7 replaygain: targetlevel and peak_method depends on tag format
Allow to configure the target level for R128_* tags separately from REPLAYGAIN_*
tags and skip peak calculation for R128_* tags if possible.
2019-07-22 13:42:22 +02:00
Zsin Skri
0c8eead459 replaygain: pass target_level and peak to backends
Configure the replaygain analysis by passing arguments to the Backends. This
avoids the difference between ReplayGain and EBU r128 backends; every Backend
can now fulfil both tasks. Additionally it eases Backend development as the
difference between the two tag formats is now completely handled in the main
Plugin, not in the Backends.
2019-07-22 12:58:54 +02:00
Zsin Skri
e5f2fe6fd3 avoid test failure
Use the POSIX character class instead of `\s` to match all whitespace in a
regular expression describing the language of valid inputs, in order to avoid a
test failure for the invalid escape sequence `\s` in Python strings.
2019-07-21 01:28:16 +02:00
Zsin Skri
f9ff56f496 improve wording in the ffmpeg replaygain backend
This commit mostly addresses feedback:
- remove some unused parenthesis
- fix a typo
- expand some docstrings
- document that ffmpeg is usually easy to install
2019-07-21 01:18:49 +02:00
Zsin Skri
271a3c980c replaygain: ffmpeg: increase parser readability
Use keyword arguments to make the ffmpeg parser more readable.
2019-07-19 21:54:47 +02:00
Zsin Skri
c3af5b3763 replaygain: add ffmpeg backend
Add replaygain backend using ffmpeg's ebur128 filter.

The album gain is calculated as the mean of all BS.1770 gating block powers.
Besides differences in gating block offset, this should be equivalent to a
BS.1770 analysis of a proper concatenation of all tracks.

Just calculating the mean of all track gains (as implemented by the bs1770gain
backend) yields incorrect results as that would:
- completely ignore track lengths
  - just using length in seconds won't work either (e.g. BS.1770 ignores
    passages below a threshold)
- take the mean of track loudness, not power

When using the ffmpeg replaygain backend to create R128_*_GAIN tags, the
targetlevel will be set to -23 LUFS. GitHub PullRequest #3065 will make this
configurable.
It will also skip peak calculation, as there is no R128_*_PEAK tag.

It is checked if the libavfilter library supports replaygain calculation. Before
version 6.67.100 that did require the `--enable-libebur128` compile-time-option,
after that the ebur128 library is included in libavfilter itself. Thus we
require either a recent enough libavfilter version or the `--enable-libebur128`
option.
2019-07-19 21:54:47 +02:00
Zsin Skri
7a7314ee3f Allow other ReplayGain backends to support R128.
Previously using EBU R128 forced the use of the bs1770gain backend.
This change adds a whitelist of backends supporting R128. When the configured
backend is in that list it will also be used for R128 calculations. Otherwise
bs1770gain is still used as a default.

This should not change the overall behaviour of the program at all, but allow
for further R128-supporting backends to be added.
2019-07-19 21:54:47 +02:00
Zsin Skri
30395911e2 util.command_output: return stderr, too
Return a namedtuple CommandOutput(stdout, stderr) instead of just stdout from
util.command_ouput, allowing separate access to stdout and stderr.

This change is required by the ffmpeg replaygain backend (GitHub
PullRequest #3056) as ffmpeg's ebur128 filter outputs only to stderr.
2019-07-14 18:32:59 +02:00
Adrian Sampson
e39341b282 Merge pull request #3322 from thedevilisinthedetails/master
465 discogs: Fetch a few more metadata fields
2019-07-01 17:22:50 -04:00
Peter
0cd46dab77 fixing per review comments 2019-07-01 21:04:35 +02:00
Peter
dd7e932a9a removing print log 2019-06-30 14:34:13 +02:00
Peter
e196c1dae6 fixing test 2019-06-30 13:54:38 +02:00
Peter
510276f653 fixing test 2019-06-30 13:44:13 +02:00
Adrian Sampson
73f8edd116 Simplify force check (#3318) 2019-06-27 22:44:57 -04:00
Adrian Sampson
0726123e41 Move PROBE_FIELD to module scope (#3318) 2019-06-27 22:43:18 -04:00
Susanna Maria
b20516e552 Small improvement of code doc 2019-06-26 20:29:17 +02:00
Susanna Maria
cab97c58d4 Pep8 drives me sometimes crazy 2019-06-25 20:57:43 +02:00
Susanna Maria
932d18a838 Pep8 error ... 2019-06-25 20:37:12 +02:00
Susanna Maria
f254b33c6e Findings from PR 2019-06-25 20:22:26 +02:00
Susanna Maria
6e179d86e6 Pep8 bugfix 2019-06-23 17:43:40 +02:00
Susanna Maria
0242176b40 Why binary import of json? 2019-06-23 16:59:33 +02:00
Susanna Maria
1643eea3f5 Parameter handling 2019-06-23 13:04:17 +02:00
Zsin Skri
f645400c5e replaygain: adapt to mediafile commit 95e569a
Since commit 95e569a, mediafile takes care of the float -> Q7.8 conversion in
R128 GAIN tags by itself.

From `store_album_r128_gain` this conversion was already missing, remove it from
`store_track_r128_gain`, too.

fixes #3311
2019-06-18 23:17:38 +02:00
Peter
90cf579ee3 adding genre, released_date and discogs_release_id 2019-06-16 21:55:35 +02:00
Adrian Sampson
7dd0ed77f9 Merge pull request #3302 from Holzhaus/fix-3301
beetsplug/importadded: Add missing path kwarg to update_after_write_time()
2019-06-11 11:50:36 -04:00
Adrian Sampson
ed30a7aed2 Merge pull request #3251 from thedevilisinthedetails/master
#2579 Adding styles to discogs plugin
2019-06-10 13:26:09 -04:00
Peter
7ec1fc934b removing unneeded condition 2019-06-10 15:54:19 +02:00
Peter
9bdadc5c73 removing extra line 2019-06-10 09:33:10 +02:00
Peter
55e003a3d4 fixing per review comments 2019-06-10 09:11:38 +02:00
Peter
f0c91b8f45 fixing per review comments 2019-06-09 20:01:55 +02:00
Peter
2c49c12166 fixing per review comments 2019-06-09 15:44:37 +02:00
Peter
5fc21a1e21 fixing per review comments 2019-06-09 15:39:49 +02:00
Peter
851c413976 adding config option for seperator and addressing review comments 2019-06-09 10:37:33 +02:00
Adrian Sampson
9fcb66b3c8 Nicer string wrap 2019-06-08 21:35:56 -04:00
Adrian Sampson
c2fdf04539 Merge pull request #3279 from dosoe/beets_parentwork_3
add parentwork plugin
2019-06-08 21:35:05 -04:00
Dorian Soergel
9d184e3cad docstrings and style 2019-06-08 22:58:05 +02:00
Dorian Soergel
fd14b5b649 docstrings and style 2019-06-08 22:55:05 +02:00
Dorian Soergel
c96dcfffb6 docstrings and style 2019-06-08 22:44:33 +02:00
Adrian Sampson
f865fc00cd replaygain: Fix py3 crash in audiotools backend
Fixes #3305.
2019-06-08 16:23:49 -04:00
Samuel Nilsson
b8b99d9396 Merge branch 'master' into replaygain 2019-06-08 16:15:27 +02:00
Dorian Soergel
070f50e1e7 docstring 2019-06-07 17:16:03 +02:00
Dorian Soergel
eacdb0d0e4 refetching works moved to new PR 2019-06-07 17:15:04 +02:00
Dorian Soergel
9c3c538dfb alternative way to refetch parent works 2019-06-07 16:51:33 +02:00
Dorian Soergel
765f7dc12d first try to implement event handler 2019-06-07 14:57:38 +02:00
Jan Holthuis
2b00e1de24 beetsplug/importadded: Add missing path kwarg to update_after_write_time()
This resolves #3301.
2019-06-07 14:17:39 +02:00
FichteFoll
728203e15a
beets.io now supports HTTPS
See https://github.com/beetbox/beets/pull/3297.
2019-06-06 15:34:15 +02:00
FichteFoll
9631616b53
Replace a couple URLs that don't point to anything
I'm unsure regarding the pygst tutorial, so I just added another URL
of the best resource I could find with a quick web search.
2019-06-05 23:08:18 +02:00
FichteFoll
c144141e9a
Update a few more http URLs to https that I missed
Should really be all now (pending the next commit).
2019-06-05 23:07:11 +02:00
FichteFoll
1a23eab8b6
Use https for lyrics.wikia.com, when supported 2019-06-05 23:00:52 +02:00
FichteFoll
670046dd9a
Build https URLS for beatport releases
I'm not sure where these are used, but the website supports https and
the API url already uses https, so this should be a safe call and not
require a util.SNI_SUPPORTED check.
2019-06-05 22:55:12 +02:00
Dorian Soergel
1d9e42567b flake8 2019-06-05 13:40:04 +02:00
Dorian Soergel
fae0656935 still dealing with cases where no parent composer 2019-06-05 13:39:13 +02:00
Dorian Soergel
8363dedaeb logging and minor comments 2019-06-05 11:10:11 +02:00
FichteFoll
aa31fea037
Update a lot of URLs to use HTTPS
*All* URLs were checked manually, but only once per domain!

I mostly concerned myself with URLs in documentation rather than source
code because the latter may or may not have impactful changes, while the
former should be straight forward.

Changes in addition to simply adding an s:

- changed pip and pypi references as their location has changed
- MPoD (iOS app) url redirects to Regelian, so I replaced those
- updated homebrew references

Notable observations:

- beets.io does have HTTPS set up properly (via gh-pages)
- beatport.py uses the old HTTP url for beatport
- as does lyrics.py for lyrics.wikia.com
- https://tomahawk-player.org/ expired long ago, but the http page
  redirects to https regardless
- none of the sourceforge subdomains have https (in 2019!)
2019-06-05 03:11:49 +02:00
Dorian Soergel
92d005ab30 renaming functions 2019-06-03 20:05:34 +02:00
Dorian Soergel
1177222c6f flake8 2019-06-03 17:45:57 +02:00
Dorian Soergel
369629bea5 clarifying docstrings 2019-06-03 17:20:36 +02:00
Dorian Soergel
feafc66f96 fixing parentwork but no parent composer 2019-06-03 16:58:07 +02:00
Carl Suster
62aa358ce7 bpd: bump protocol version to 0.16 2019-06-02 23:37:07 +10:00
Carl Suster
d8be83bc0d bpd: support ranges in playlistid 2019-06-02 23:37:07 +10:00
Carl Suster
dc7e3b9b6a bpd: support nextsong in status 2019-06-02 23:37:07 +10:00
Carl Suster
fdd809fd36 bpd: support more tagtypes 2019-06-02 23:37:07 +10:00
Carl Suster
cc2c35221d bpd: avoid sending playlist events on navigation 2019-06-02 23:37:07 +10:00
Carl Suster
5187100294 bpd: accept all idle events 2019-06-02 23:37:07 +10:00
Carl Suster
27c462d287 bpd: make noidle a no-op outside idle mode
The real MPD ignores `noidle` when the client is not idle. It doesn't
even send a successful response, just ignores the command. Although
I don't understand why a client would fail to keep track of its own
state, it seems that this is necessary to get ncmpcpp working.
2019-06-02 23:37:07 +10:00
Carl Suster
e708d28f85 bpd: allow fractional seconds in seek
The documented type is float, not integer, and clients like mpDris2 send
fractional seconds, causing them to crash if these values ar enot
accepted.
2019-06-02 23:37:07 +10:00
Carl Suster
1a5263b68f bpd: support volume command for real 2019-06-02 23:37:07 +10:00
Carl Suster
59c506990a bpd: fix bug in playlistid
The playlistid command is supposed to list the whole playlist if no
argument is provided, but we were accidentally trying to look up an
impossible negative id in that case causing an error to always be
returned.
2019-06-02 23:37:07 +10:00
Carl Suster
64ed54330b bpd: mention control socket address in log 2019-06-02 23:37:07 +10:00
Adrian Sampson
81b1faa053 inline: Fix a ridiculously subtle flexattr bug
As detailed here:
https://github.com/beetbox/beets/issues/2406#issuecomment-274423601

In a *function-style* definition, we didn't properly *un-define* the
values for a given item after each function invocation. So when a field
wasn't defined, it would get the value for the previously-formatted
object instead. It now properly throws a NameError.
2019-06-01 12:28:47 -04:00
Carl Suster
6382c364e2 confit: replace with confuse in plugins 2019-06-01 10:03:41 +10:00
Dorian Soergel
a10ad548c9 logging if no parent composer 2019-05-31 20:54:15 +02:00
Dorian Soergel
e6da3e1498 move _command into command 2019-05-31 18:28:53 +02:00
Dorian Soergel
acf447b4b0 adapt tests, correct docstrings 2019-05-31 17:52:39 +02:00
Dorian Soergel
638e9d5dc8 style changes, docstrings 2019-05-31 17:17:06 +02:00
Dorian Soergel
6d6c1a1647 fixes for disambiguation 2019-05-31 15:04:00 +02:00
Dorian Soergel
080680c950 add parentwork plugin, first try 2019-05-31 14:35:51 +02:00
Carl Suster
546bf3af7e mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
Adrian Sampson
d77a13eb34 gmusic: Fix compatibility with gmusicapi>=12.0.0
Fixes #3270.
2019-05-18 16:32:56 -04:00
Adrian Sampson
d6dc1b7c4e gmusic: Use as_filename for oauth_file (#3270) 2019-05-18 16:27:13 -04:00
Peter
6ffbd5af45 adding styles to hook and returning Style not Defined if no style set 2019-05-05 11:44:24 +02:00
Peter Koondial
8fcff5ddc7 Adding styles to discogs plugin 2019-05-05 11:11:27 +02:00
Jack Wilsdon
f09088df43
replaygain: Handle invalid XML output from bs1770gain 2019-05-02 01:24:19 +01:00
Rainer Hihn
62c1d37bcc Formatting 2019-04-27 17:58:48 +02:00
Rainer Hihn
941dd6e48f Formatting 2019-04-27 17:58:26 +02:00
Rainer Hihn
36dc105dc9 undid quotes in log messages 2019-04-27 17:57:48 +02:00
Rainer Hihn
55fe077e54 Removed PaddedFloat in favour of adding a constructor parameter 2019-04-24 20:39:05 +02:00
Rainer Hihn
07b617b307 Converted all float types to PaddedFloat 2019-04-24 19:55:44 +02:00
Rainer Hihn
7676d2ae5a PaddingInt -> PaddingFloat 2019-04-24 19:54:12 +02:00
Rainer Hihn
3f3b102885 added PaddingFloat 2019-04-24 19:53:01 +02:00
Rainer Hihn
76e333c054 Added item_types 2019-04-23 19:20:55 +02:00
Rainer Hihn
a60935ed1c Prevent scientific notation 2019-04-22 19:50:11 +02:00
Adrian Sampson
5f9b28124d Merge pull request #3220 from rain0r/3219
Update __init__.py
2019-04-21 20:39:46 -04:00
Rainer Hihn
b7d3ef6274 - Improved doc and changelog
- Cleaner implementation of mutual excursion of the command line
arguments.
2019-04-21 18:32:41 +02:00
Jack Wilsdon
f5f9aed641
Add loadext plugin 2019-04-21 15:10:28 +01:00
Carl Suster
063e4f259b
Merge pull request #3222 from arcresu/bpd-decoders
bpd: support decoders command
2019-04-21 09:20:42 +10:00
Adrian Sampson
1edd21fab1
Merge pull request #3223 from arcresu/mpd-port
mpdupdate, mpdstats: use MPD_PORT env variable
2019-04-20 14:21:20 -04:00
Louis Sautier
4d98088cc1
Replace more instances of unsafe calls to yaml.load 2019-04-20 01:14:15 +02:00
Rainer Hihn
ddd7b4b3b4 Removed empty line 2019-04-19 21:17:15 +02:00
Rainer Hihn
5c643a8f16 Removed ipdb import 2019-04-19 21:08:26 +02:00
Rainer Hihn
e4b2e7b476 Made -a and -A mutually exclusive. 2019-04-19 20:58:13 +02:00
Carl Suster
21cba304bd mpdupdate: use MPD_PORT env variable 2019-04-19 17:35:42 +10:00
Carl Suster
dc5f110844 mpdstats: use MPD_PORT env variable 2019-04-19 17:35:42 +10:00
Carl Suster
3da23167ca bpd: support decoders command
This uses GStreamer APIs to extract a list of audio decoders and the
relevant MIME types and file extensions. Some clients like ncmpcpp use
this command to fetch a list of supported file extensions.
2019-04-19 16:08:05 +10:00
Rainer Hihn
0b2334f8e8 Added command line options to query explicit for albums and / or tracks. 2019-04-18 22:31:49 +02:00
rain0r
fc95fb86a1
Update __init__.py
Also fetch genres for single tracks via query.
2019-04-17 20:57:58 +02:00
Carl Suster
9182f18e6f bpd: support short form of list command for albums
Some clients list the albums belonging to an artist by issuing the
command `list album <ARTIST NAME>`. This change inserts the tag `artist`
before the artist name so that this succeeds. Fixes #3007
2019-04-15 13:25:02 +10:00
Carl Suster
826244777e bpd: minor control socket refactor 2019-04-10 15:52:47 +10:00
Carl Suster
d55f061f0b bpd: add control socket
A new `ControlConnection` is created each time a client connects over
a new control socket. This is used to forward events from the player,
and also for debugging utilities that are not part of the real MPD
protocol.

This new feature reuses as much infrastructure from the normal protocol
handling as possible (e.g. `Command` for parsing messages). While the
normal connection delegates to server `cmd_*` methods which are string
generators, the control connections delegate to `ctrl_*` methods defined
on the connection itself that are full coroutines.
2019-04-09 12:19:15 +10:00
Carl Suster
fa3813844c bpd: reimplement idle without polling 2019-04-08 16:33:34 +10:00
Carl Suster
6fbf3853f2 bpd: bump protocol version to 0.14.0 2019-04-08 11:40:24 +10:00
Carl Suster
699de94f4f bpd: send all relevant idle events 2019-04-08 11:40:24 +10:00
Carl Suster
7105c800aa bpd: implement the idle command
Getting this command puts the connection into a special mode where it
awaits MPD events (like the player changing state or the playlist
changing due to other clients interacting with the server.

The MPD specification states that events should queue while a client is
connected, and when it issues the `idle` command any matching events
should be sent immediately if there are any, or as soon as they happen
otherwise.
2019-04-08 11:40:24 +10:00
Carl Suster
ee0c31ba6a bpd: track and log client session details
Keep track of a list of currently-connected clients.

Use `socket.getpeername()` to get an identifier for each connection and
include this in each log message. This function is documented as not
being available on all systems, but it's unclear which systems this
involves.

Also log a message on client connect and disconnect events. If the
disconnection reason is because the client sent a blank line, match MPD
by returning a protocol error then hanging up. Escape curly braces.
2019-04-08 11:28:56 +10:00
Carl Suster
5b0a02eb31 bpd: don't send volume if zero in status 2019-04-08 10:52:15 +10:00
Carl Suster
f8a2c22e8d bpd: fix typo in comment 2019-04-08 10:52:15 +10:00
Adrian Sampson
362722c87c
Merge pull request #3206 from arcresu/random-util
random: move functionality into beets.random
2019-04-07 11:59:39 -04:00
Carl Suster
9147fabb97 random: beets.util.random -> beets.random 2019-04-07 18:46:11 +10:00
gdtwst
c41197cc5c Re-add fixes from #2707 2019-04-07 10:07:38 +07:00
Adrian Sampson
ebed21f319 Merge pull request #3207 from arcresu/mpd-currentsong
mpdstats: use currentsong instead of playlist
2019-04-06 13:51:18 -04:00
Adrian Sampson
63b7ede4f7 Merge pull request #3054 from discopatrick/2704-lastgenre-force
WIP: Remove `default` arg for `lastgenre --force` flag
2019-04-06 13:49:07 -04:00
Rainer Unseld
ce5981b885 mpdstats: use currentsong instead of playlist
Improved the method to get the path of the current song. Before, the complete playlist was fetched from the server. Now, the command "currentsong" is used for this purpose. This improves performance when a huge playlist is active.
2019-04-06 15:23:34 +11:00
Carl Suster
f35944f49c random: move implementation to beets.util.random 2019-04-06 11:06:19 +11:00
Carl Suster
95dd513b25 bpd: add flake8 exception for test command 2019-04-02 14:25:56 +11:00
Carl Suster
20e2f8beec bpd: output an info-level message when ready 2019-04-02 13:38:43 +11:00
Carl Suster
d074dac771 bpd: add comments to the error handling code 2019-04-02 13:37:40 +11:00
Carl Suster
28db7d3d33 bpd: provide precision time in status 2019-04-02 11:15:00 +11:00
Carl Suster
4be2e1b5e6 Remove beets.util.inspect wrapper 2019-04-02 10:22:47 +11:00
Carl Suster
36c85a8aeb Fix beets.util.inspect for Python 3
Under the original compatibility shim we weren't correctly inclusing
`self` in the argument list for bound methods.
2019-04-02 10:11:43 +11:00
Carl Suster
9622e7433b bpd: return real audio data 2019-04-02 09:44:34 +11:00
Carl Suster
e839e4ea19 bpd: improve exception handling
Check function signature instead of using TypeError to crudely guess
that the wrong number of arguments were provided.

Prevent bpd from crashing when trying to log a traceback. The
`traceback.format_exc` function takes an optional argument which is
supposed to be an integer restricting the length of the backtrace to
show. Instead we were passing the exception object to this function and
causing a new exception to be raised.
2019-04-02 09:39:07 +11:00
Carl Suster
146c5f5e13 bpd: fix repeat, consume and single in reverse
These flags are all relevant to the 'previous' command as well as the
'next' command.
2019-04-01 18:05:10 +11:00
Carl Suster
12e49b3c88 bpd: skipping backwards through zero keeps playing
Previously issuing the 'previous' command when at position 0 on the
playlist would cause bpd to stop playing. MPD instead just restarts the
currently playing song instead, so we now match this behaviour.
2019-04-01 17:51:21 +11:00
Carl Suster
a4fe6875a1 bpd: fix bug in bounds check of current song index
The songs are indexed starting from zero for the play command, however
the bound check was off by one. An index matching the length of the
playlist would crash the server instead of responding with an error
message over the protocol.
2019-04-01 17:41:25 +11:00
Carl Suster
0c3a63ef9f bpd: fix repeat mode behaviour
The repeat flag indicates that the entire playlist should be repeated.
If both the repeat and single flags are set then this triggers the old
behaviour of looping over a single track.
2019-04-01 17:39:35 +11:00
Carl Suster
b245c0e755 bpd: test fields returned by status command 2019-04-01 16:42:39 +11:00
Carl Suster
bae9c40600 bpd: support the single command
This command instructs bpd to stop playing when the current song
finishes. In the MPD 0.20 protocol this flag gains a value 'oneshot' but
for now we just support its older version with a boolean value.
2019-04-01 16:30:02 +11:00
Carl Suster
71e7621642 bpd: no-op support for persistent playlists
The real MPD offers persistent playlist manipulation, storing the
playlists in a directory set in the config file. If that directory is
not available then the feature is disabled and the relevant commands all
respond with errors. Based on this, the initial support in bpd just
returns errors matching the MPD server in the disabled mode.

For playlistadd, extend the _bpd_add helper to work with playlists other
than the queue in order to support testing the real implementations of
these commands in the future.
2019-04-01 16:30:02 +11:00
Carl Suster
859e16d1e3 bpd: support consume command 2019-04-01 16:30:02 +11:00
Carl Suster
e5851866d7 bpd: add replay_gain_* commands
There's a special status command for checking the replay gain mode,
which can be set to one of a short list of possible values. For now at
least we can ignore this feature, but track the setting anyway.
2019-04-01 14:49:27 +11:00
Carl Suster
67a0b38d20 bpd: add dummy command for volume
MPD supports a deprecated command 'volume' which was used to change the
volume by a relative amount unlike its replacement 'setvol' which uses
an absolute amount. As far as I can tell 'volume' always responds with a system
error message "No mixer".
2019-04-01 14:49:27 +11:00
Carl Suster
1511e313f7 bpd: add mixramp commands
These are a more sophisticated version of crossfade so we're free to
ignore them, at least for now. We now track the values of the two
settings, and show them in the status output. Like MPD, we suppress the
mixrampdb value if it's set to nan, which is how it signals that the
feature should be turned off.
2019-04-01 14:49:27 +11:00
Carl Suster
0f53ae9a87 bpd: error instead of crashing on extra argument
If an MPC client is expecting a command to take an argument that bpd
isn't expecting (e.g. because of a difference in protocol versions) then
bpd currently crashes completely. Instead, do what the real MPD does and
return an error message over the protocol.
2019-04-01 14:49:27 +11:00
Carl Suster
d94a5393b2 bpd: fix crossfade command
Although crossfade is not implemented in bpd, we can store the setting
and repeat is back to clients. Also log a warning that the operation is
not implemented.

The real MPD doesn't show the crossfade in status if it's zero since
that means no crossfade, so now we don't either.
2019-04-01 14:49:27 +11:00
Adrian Sampson
c74a7059b4 Merge pull request #3192 from translit/yaml-safe-load
Fix PyYAML yaml.load(input) Deprecation
2019-03-31 21:46:29 -04:00
Adrian Sampson
0208ec69ef Merge pull request #3197 from arcresu/deprecation
Fix several deprecation warnings
2019-03-31 21:44:37 -04:00
Adrian Sampson
0042f3205e Merge pull request #3196 from arcresu/bpd-log
bpd: use plugin logger instead of global logger
2019-03-31 21:41:22 -04:00
Carl Suster
b4c4f3ca19 bpd: use plugin logger instead of global logger 2019-03-31 22:06:43 +11:00
Carl Suster
a6305c36e1 Fix deprecated plistlib function
https://docs.python.org/3.7/library/plistlib.html#plistlib.readPlist
2019-03-31 19:53:17 +11:00
Carl Suster
e4c03fd63f Fix deprecated placement of inline regex flags
https://bugs.python.org/issue22493
2019-03-31 19:44:49 +11:00
Carl Suster
ca60555ffa Fix deprecated call log.warn -> log.warning
https://bugs.python.org/issue13235
2019-03-31 19:44:40 +11:00
Carl Suster
7557bb06d6 bpd: use log instead of stdout 2019-03-31 18:43:18 +11:00
Carl Suster
0b4293de6e
the: log a debug only when text is changed
Previously the `the` plugin would log a debug message when the text _didn't_ get changed by the plugin, whereas I think what was intended was the opposite. With this change the logged messages show the actual transformations made by the plugin.
2019-03-31 18:19:09 +11:00
Alexei Datskevich
be12a89372 Fix PyYAML yaml.load(input) Deprecation 2019-03-30 08:34:13 +01:00
Adrian Sampson
6ee824fb0f Fix #3184: AttributeError in error handler 2019-03-14 09:53:32 -04:00
Jack Wilsdon
9bb6c29d22
Always use custom formatter for formatting hook commands 2019-02-25 14:41:59 +00:00
Adrian Sampson
80f4f0a0f2 badfiles: Fix decoding for command output
Probably fixes #3165. There were several things going wrong here:

1. For some reason, this was using the *filesystem* encoding, which is
   what you use to decode filenames. But this was general command
   output, not filenames.
2. Errors in decoding threw exceptions, even though all we do with this
   output is show it to the user.
3. The prints were using `displayable_path`, even though the lines are
   *already* Unicode strings.

Hopefully this cleans up that mess.
2019-02-24 16:06:36 -05:00
Jan Holthuis
3e10d5d39f badfiles: Fix #3158 by calling superclass __init__ method 2019-02-21 12:40:54 +01:00
Adrian Sampson
be118b922a
Merge pull request #3155 from Holzhaus/fetchart-error-handling
fetchart: Add some error handling to prevent crashes
2019-02-20 08:45:22 -05:00
Bernardo Meurer
9374983e9d
Fixed import order 2019-02-19 18:49:29 -08:00
Bernardo Meurer
e209fe5886
Parallelized beet bad 2019-02-19 18:47:47 -08:00
Jan Holthuis
c07903ed66 fetchart: Add some error handling to prevent crashes
Today I had some network problems regarding dbpedia.org, which made
beets crash because a requests.exceptions.ConnectionError was raised
("[Errno 113] No route to host"). This commits adds some error handling
around network requests to prevent further crashes in the future.
2019-02-19 16:16:56 +01:00
Bernardo Meurer
1dad5ded03
Move absubmit plugin parallelization to util.par_map 2019-02-18 22:42:20 -08:00
Adrian Sampson
81c5ae3fdf
Merge pull request #3151 from Holzhaus/playlist-plugin-additions
playlist: Add auto-update functionality and more tests
2019-02-18 08:40:55 -05:00
Jan Holthuis
4ba5dfaa43 playlist: Remove leftover print call and fix 'auto' option access style 2019-02-18 09:13:39 +01:00
Jan Holthuis
7bca5cf549 playlist: Don't use syspath() when checking if path is absolute 2019-02-17 22:28:39 +01:00
Jan Holthuis
ee2cce4280 playlist: Work around Windows' Mandatory File Locking on playlist updates 2019-02-17 22:12:13 +01:00
Jan Holthuis
d991e2a7d8 playlist: Normalize path before lookup in changes dict 2019-02-17 21:51:09 +01:00
Adrian Sampson
9320db21eb
Merge pull request #3150 from beetbox/named-query
Add support for "named queries" and use them in the playlist plugin
2019-02-17 15:08:31 -05:00
Adrian Sampson
55ef2ffd39 Add future imports to playlist plugin 2019-02-17 14:02:26 -05:00
Adrian Sampson
7efc67eb03 playlist: Use new "named query" functionality 2019-02-17 13:52:00 -05:00
Jan Holthuis
6d42028057 playlist: Add playlist auto-update functionality 2019-02-17 19:38:21 +01:00
Adrian Sampson
00667bda0f Merge pull request #3145 from Holzhaus/playlist-plugin
Playlist plugin
2019-02-17 13:16:26 -05:00
Jan Holthuis
4f1a468aa9 playlist: Restore case sensitivity in col_clause method 2019-02-17 17:34:36 +01:00
Jan Holthuis
055f2d3702 playlist: Also catch IOErrors to restore Python 2.7 compatiblity 2019-02-17 16:00:04 +01:00
Jan Holthuis
f9f2fa0e26 playlist: Restructure playlist reading code and add error handling 2019-02-17 15:17:10 +01:00
Jan Holthuis
19b92e1199 playlist: Improve speed in PlaylistQuery class
Implement the col_clause method for faster, sqlite-based querying. This
will only make a difference if the "fast" kwarg is set to True.
2019-02-17 14:38:36 +01:00
Jan Holthuis
a80a07f093 playlist: Add playlist plugin
Adds M3U playlist support as a query to beets and thus partially
resolves issue #123. The implementation is heavily based on #2380 by
Robin McCorkell.

It supports referencing playlists by absolute path:

    $ beet ls playlist:/path/to/someplaylist.m3u

It also supports referencing playlists by name. The playlist is then
seached in the playlist_dir and the ".m3u" extension is appended to the
name:

    $ beet ls playlist:anotherplaylist

The configuration for the plugin looks like this:

    playlist:
        relative_to: library
        playlist_dir: /path/to/playlists

The relative_to option specifies how relative paths in playlists are
handled. By default, paths are relative to the "library" directory. It
also possible to make them relative to the "playlist" or set the option
or set it to a fixed path.
2019-02-17 14:38:36 +01:00
Adrian Sampson
69fbba1eed
Merge pull request #3144 from Holzhaus/add-id3v23-to-convert
Add id3v23 option to convert plugin
2019-02-15 09:51:46 -07:00
Jan Holthuis
7afeb9b2ac convert: Add id3v23 config option to convert plugin 2019-02-14 23:42:36 +01:00
Adrian Sampson
f54042f194 Make a comment into a full sentence 2019-02-08 18:18:30 -08:00
jan
5ace667757 add forgotten request_finished 2019-02-08 01:09:07 +01:00
jan
9bc3898951 add request_finished function, rename wait_for_rate_limiter to request_start, add doc and changelog 2019-02-08 01:02:33 +01:00
jan
77fd5ee548 keep discogs requests below rate limit 2019-02-08 00:05:07 +01:00
Samuel Nilsson
93007bfdd5 ReplayGain: fixed error caused by per_disc option 2019-02-06 13:17:34 +01:00
Samuel Nilsson
24f02cb5cd ReplayGain refactoring 2019-02-06 10:12:06 +01:00
Samuel Nilsson
31326ebb20 Simplified album ReplayGain code 2019-02-06 10:06:48 +01:00
Samuel Nilsson
d910ed3ecf Merge branch 'master' of github.com:beetbox/beets into replaygain 2019-02-06 09:27:45 +01:00
Samuel Nilsson
3d842db8d8 Added per disc album_gain support 2019-02-06 09:27:24 +01:00
Adrian Sampson
c7c90a51c6
Merge pull request #3135 from wildthyme/master
Support ipfs add --nocopy in ipfs plugin
2019-02-01 10:04:00 -05:00
Jack Wilsdon
2bc04bb605
Use "==" when comparing strings 2019-01-31 00:15:55 +00:00
Jack Wilsdon
768770d561
Fix incorrect indentation 2019-01-31 00:15:42 +00:00
Iris Wildthyme
2b82831b7b added --nocopy support 2019-01-30 16:36:46 -05:00
Rahul Ahuja
5fbb28637d Set Spotify AlbumInfo.mediums 2019-01-23 19:54:14 -08:00
Rahul Ahuja
6a9b62a9c2 Specify None rtype in doscstrings 2019-01-22 20:54:46 -08:00
Rahul Ahuja
8c6cc6573c Unidecode query string 2019-01-22 19:42:25 -08:00
Rahul Ahuja
b91406b252 Backwords-compatible str/unicode 2019-01-22 18:59:15 -08:00
Rahul Ahuja
c6b8f6d143 Fix formatting/spelling 2019-01-22 18:09:10 -08:00
Rahul Ahuja
f7d20090e6 Fix _handle_response reauth bug and empty str query construction 2019-01-22 12:14:52 -08:00
Rahul Ahuja
7b57b0b608 Appease Flake8 2019-01-22 10:53:18 -08:00
Rahul Ahuja
3a67eae46d Use track attrs directly, better naming/docstrings 2019-01-22 10:41:18 -08:00
Rahul Ahuja
09fc53eaea Only parse Spotify ID when necessary 2019-01-21 23:53:19 -08:00
Rahul Ahuja
96fda0df0d Docstring formatting 2019-01-21 23:36:51 -08:00
Rahul Ahuja
77f9a930b7 Fix remaining test, use official doc wording 2019-01-21 23:15:08 -08:00
Rahul Ahuja
0527edbd48 Fix test index, add docstrings 2019-01-21 23:05:47 -08:00
Rahul Ahuja
f63beca39a Switch filter ordering in test 2019-01-21 22:35:12 -08:00
Rahul Ahuja
48401c60dc Switch query filter ordering for tests 2019-01-21 22:27:31 -08:00
Rahul Ahuja
42e852cc7e Clarify _search_spotify return type 2019-01-21 22:12:56 -08:00
Rahul Ahuja
aa18f9116d Refine doc wording 2019-01-21 22:01:30 -08:00
Rahul Ahuja
265fcc7cea utilize track_for_id in item_candidates 2019-01-21 21:45:50 -08:00
Rahul Ahuja
5472a49991 Add candidates and item_candidates, modularize Search API queries 2019-01-21 21:24:41 -08:00
Rahul Ahuja
dab62f2194 inline auth_header property 2019-01-21 09:23:38 -08:00
Rahul Ahuja
b50e148bec use official client ID/secret, remove usage from docs 2019-01-21 08:32:57 -08:00
Rahul Ahuja
cb8b0874d4 naming 2019-01-21 01:56:57 -08:00
Rahul Ahuja
415b21cbc1 fix var reference, add docstring 2019-01-21 01:30:37 -08:00
Rahul Ahuja
844b940832 capture TrackInfo.medium_total 2019-01-20 15:32:07 -08:00
Rahul Ahuja
dbf17f760e add TrackInfo.medium 2019-01-20 15:09:51 -08:00
Rahul Ahuja
78a46fd4d0 doc typo 2019-01-20 15:02:19 -08:00
Rahul Ahuja
b4d54b0950 set TrackInfo.index in track_for_id 2019-01-20 15:00:32 -08:00
Rahul Ahuja
082357b063 document new functionality, use Spotify ID for AlbumInfo.album_id 2019-01-20 12:40:11 -08:00