geigerzaehler / beets-alternatives

Beets plugin to manage external files
MIT License
91 stars 21 forks source link

`beet alt update foo`: FileNotFoundError #51

Closed discopatrick closed 4 years ago

discopatrick commented 4 years ago

Hi there - I'm trying to solve this problem.

FYI, plex is my alternative collection that contains everything in my library.

I have tried running beet alt update othercollection which is a subset of my collection, and it works fine. So I suspect it's just one of the tracks in my collection that is causing the problem.

beet alt update plex
Traceback (most recent call last):
  File "/Users/patrick/Music/beets/beetsenv3/bin/beet", line 11, in <module>
    load_entry_point('beets==1.4.9', 'console_scripts', 'beet')()
  File "/Users/patrick/Music/beets/beetsenv3/lib/python3.8/site-packages/beets/ui/__init__.py", line 1266, in main
    _raw_main(args)
  File "/Users/patrick/Music/beets/beetsenv3/lib/python3.8/site-packages/beets/ui/__init__.py", line 1253, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/Users/patrick/Music/beets/beetsenv3/lib/python3.8/site-packages/beetsplug/alternatives.py", line 81, in func
    opts.func(lib, opts)
  File "/Users/patrick/Music/beets/beetsenv3/lib/python3.8/site-packages/beetsplug/alternatives.py", line 44, in update
    alt.update(create=options.create)
  File "/Users/patrick/Music/beets/beetsenv3/lib/python3.8/site-packages/beetsplug/alternatives.py", line 191, in update
    for (item, actions) in self.items_actions():
  File "/Users/patrick/Music/beets/beetsenv3/lib/python3.8/site-packages/beetsplug/alternatives.py", line 167, in items_actions
    yield self.matched_item_action(item)
  File "/Users/patrick/Music/beets/beetsenv3/lib/python3.8/site-packages/beetsplug/alternatives.py", line 145, in matched_item_action
    if (item_mtime_alt < os.path.getmtime(syspath(item.path))):
  File "/usr/local/bin/../../../Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: b'/var/folders/17/x5g8zxq558j5t6_9hvdph_xc0000gn/T/tmpj67sp7pf.flac'
discopatrick commented 4 years ago

Solved. Somehow an item in the collection had been imported with a path of /var/folders/17/x5g8zxq558j5t6_9hvdph_xc0000gn/T/tmpj67sp7pf.flac - perhaps due to an interrupted import.

I queried the library for that path, and removed the item from the collection.

Now beet alt update plex is working.