Repository: beetbox/beets

Issue:
TypeError: update_after_write_time() got an unexpected keyword argument 'path'
Beets crashes on the `after_write` signal.

### Problem

```sh
$ beet -v convert -y -d usb playlist:Soul
user configuration: /home/jan/.config/beets/config.yaml
data directory: /home/jan/.config/beets
plugin paths:
/data/jan/Projects/beets/beets/mediafile.py:21: UserWarning: beets.mediafile is deprecated; use mediafile instead
  warnings.warn("beets.mediafile is deprecated; use mediafile instead")
Sending event: pluginload
artresizer: method is (2, (7, 0, 8), False)
lyrics: Disabling google source: no API key configured.
library database: /home/jan/beets.db
library directory: /data/music
Sending event: library_opened
100 Proof (Aged in Soul) - Can You Dig It? The ’70s Soul Experience - Somebody’s Been Sleeping
[...]
Charles Wright & The Watts 103rd Street Rhythm Band - Can You Dig It? The ’70s Soul Experience - Express Yourself
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/01-18 - 100 Proof (Aged in Soul) - Somebody's Been Sleeping.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/02-23 - The 8th Day - She's Not Just Another Woman.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/05-16 - Average White Band - Pick Up the Pieces.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/06-03 - Average White Band - Cut the Cake.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/05-10 - B.T. Express - Do It ('til You're Satisfied).flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/06-02 - B.T. Express - Express.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/01-21 - The Beginning of the End - Funky Nassau, Part I.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/01-05 - Brook Benton - Rainy Night in Georgia.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/05-18 - The Blackbyrds - Walking in Rhythm.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/06-08 - Brass Construction - Movin'.flac
convert: Encoding /data/music/Various Artists/Darker Than Blue_ Soul From Jamdown, 1973-1980/01 - The Boris Gardiner Happening - Ghetto Funk.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/04-09 - Bloodstone - Natural High.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/02-09 - Brenda & the Tabulations - Right on the Tip of My Tongue.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/05-03 - Blue Magic - Sideshow.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/06-11 - Brick - Dazz.flac
convert: Encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/03-18 - Brighter Side of Darkness - Love Jones.flac
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/02-23 - The 8th Day - She's Not Just Another Woman.flac
Sending event: write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/02-09 - Brenda & the Tabulations - Right on the Tip of My Tongue.flac
Sending event: write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/01-18 - 100 Proof (Aged in Soul) - Somebody's Been Sleeping.flac
Sending event: write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Darker Than Blue_ Soul From Jamdown, 1973-1980/01 - The Boris Gardiner Happening - Ghetto Funk.flac
Sending event: write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/05-18 - The Blackbyrds - Walking in Rhythm.flac
Sending event: write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/05-16 - Average White Band - Pick Up the Pieces.flac
Sending event: write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/01-21 - The Beginning of the End - Funky Nassau, Part I.flac
Sending event: write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/01-05 - Brook Benton - Rainy Night in Georgia.flac
Sending event: write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/05-10 - B.T. Express - Do It ('til You're Satisfied).flac
Sending event: write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/03-18 - Brighter Side of Darkness - Love Jones.flac
Sending event: write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/06-03 - Average White Band - Cut the Cake.flac
Sending event: write
Sending event: after_write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/06-02 - B.T. Express - Express.flac
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/04-09 - Bloodstone - Natural High.flac
Sending event: write
Sending event: write
Sending event: after_write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/06-08 - Brass Construction - Movin'.flac
Sending event: write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/05-03 - Blue Magic - Sideshow.flac
Sending event: write
Sending event: after_write
convert: Finished encoding /data/music/Various Artists/Can You Dig It_ The '70s Soul Experience/06-11 - Brick - Dazz.flac
Sending event: write
Sending event: after_write
Traceback (most recent call last):
  File "/data/jan/Projects/beets/beets/plugins.py", line 143, in wrapper
    return func(*args, **kwargs)
TypeError: update_after_write_time() got an unexpected keyword argument 'path'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jan/.local/bin/beet", line 11, in <module>
    load_entry_point('beets', 'console_scripts', 'beet')()
  File "/data/jan/Projects/beets/beets/ui/__init__.py", line 1267, in main
    _raw_main(args)
  File "/data/jan/Projects/beets/beets/ui/__init__.py", line 1254, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/data/jan/Projects/beets/beetsplug/convert.py", line 458, in convert_func
    pipe.run_parallel()
  File "/data/jan/Projects/beets/beets/util/pipeline.py", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/lib/python3.7/site-packages/six.py", line 693, in reraise
    raise value
  File "/data/jan/Projects/beets/beets/util/pipeline.py", line 358, in run
    self.coro.send(msg)
  File "/data/jan/Projects/beets/beetsplug/convert.py", line 325, in convert_item
    item.try_write(path=converted, id3v23=id3v23)
  File "/data/jan/Projects/beets/beets/library.py", line 687, in try_write
    self.write(*args, **kwargs)
  File "/data/jan/Projects/beets/beets/library.py", line 678, in write
    plugins.send('after_write', item=self, path=path)
  File "/data/jan/Projects/beets/beets/plugins.py", line 489, in send
    result = handler(**arguments)
  File "/data/jan/Projects/beets/beets/plugins.py", line 149, in wrapper
    return func(*args, **kwargs)
  File "/data/jan/Projects/beets/beetsplug/importadded.py", line 133, in update_after_write_time
    self.write_item_mtime(item, item.added)
  File "/data/jan/Projects/beets/beetsplug/importadded.py", line 81, in write_item_mtime
    self.write_file_mtime(util.syspath(item.path), mtime)
  File "/data/jan/Projects/beets/beetsplug/importadded.py", line 74, in write_file_mtime
    os.utime(util.syspath(path), (stat.st_atime, mtime))
OSError: [Errno 30] Read-only file system
```

### Setup

* OS: Arch Linux
* Python version: 3.7.3
* beets version: e64ecc2f81b1f06dae29c6e09c84daf446c62b81



Discussion:

Resolving patch:
diff --git a/beetsplug/importadded.py b/beetsplug/importadded.py
--- a/beetsplug/importadded.py
+++ b/beetsplug/importadded.py
@@ -124,7 +124,7 @@ def update_item_times(self, lib, item):
                             util.displayable_path(item.path), item.added)
             item.store()
 
-    def update_after_write_time(self, item):
+    def update_after_write_time(self, item, path):
         """Update the mtime of the item's file with the item.added value
         after each write of the item if `preserve_write_mtimes` is enabled.
         """


Test patch: