sbarakat / beets-copyartifacts

A plugin for beets that moves non-music files during the import process.
MIT License
59 stars 25 forks source link

CopyArtifacts behaving badly with the 'Use as is' auto-tagger option #4

Open Night-Man opened 10 years ago

Night-Man commented 10 years ago

I think CopyArtifacts may be behaving badly when using the 'Use as is' auto-tagger option when beets is set to move files during import. It cause beets to crash. I think it might be because the 'Use as is' option moves the folder in the source directory, renaming it and putting it in the destination directory in the folder '_'. Whereas normally beets would create a new folder in the destination with the pathname specified in the config.yaml ($albumartist_sort/$album%aunique{} etc.). Since it moves the folder when using 'Use as is' there is no folder to copy artifacts from. But that just my theory.... here's what I get for output when it crashes.

Traceback (most recent call last):
File "/usr/local/bin/beet", line 8, in <module>
load_entry_point('beets==1.3.3', 'console_scripts', 'beet')()
File "/Library/Python/2.7/site-packages/beets-1.3.3-py2.7.egg/beets/ui/__init__.py", line 946, in main
_raw_main(args)
File "/Library/Python/2.7/site-packages/beets-1.3.3-py2.7.egg/beets/ui/__init__.py", line 937, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/Library/Python/2.7/site-packages/beets-1.3.3-py2.7.egg/beets/ui/commands.py", line 843, in import_func
import_files(lib, paths, query)
File "/Library/Python/2.7/site-packages/beets-1.3.3-py2.7.egg/beets/ui/commands.py", line 779, in import_files
session.run()
File "/Library/Python/2.7/site-packages/beets-1.3.3-py2.7.egg/beets/importer.py", line 347, in run
pl.run_parallel(QUEUE_SIZE)
File "/Library/Python/2.7/site-packages/beets-1.3.3-py2.7.egg/beets/util/pipeline.py", line 243, in run
out = self.coro.send(msg)
File "/Library/Python/2.7/site-packages/beets-1.3.3-py2.7.egg/beets/importer.py", line 905, in manipulate_files
plugins.send('import_task_files', session=session, task=task)
File "/Library/Python/2.7/site-packages/beets-1.3.3-py2.7.egg/beets/plugins.py", line 372, in send
handler(**arguments)
File "/Library/Python/2.7/site-packages/copyartifacts-0.2-py2.7.egg/beetsplug/copyartifacts.py", line 27, in add_artifacts
for filename in os.listdir(task.paths[0]):
OSError: [Errno 2] No such file or directory: '/Volumes/MUSIC/MusicTmp/Fruition/Fruition'
sbarakat commented 10 years ago

I'm having trouble recreating this. The relevant parts from my config:

import:
    copy: no
    move: yes
    write: yes

plugins: copyartifacts

copyartifacts:
    extensions: .cue .log .jpg
    print_ignored: yes

After importing I get presented with a list of candidates and the following options:

# selection (default 1), Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort?

Selecting "Use as-is" copies over the mp3 files and the artifacts. As there's still some files left in the source directory, it has remained. I'm curious to know how you're source directory is disappearing.

The code in that area has been changed with the recent commit, so perhaps you could try again? I rolled back my version to an older one and still couldn't recreate this. Maybe I'm missing something...

Night-Man commented 10 years ago

Hmm, I'm having trouble recreating it specifically also, it's happened several more times now, and I've noticed that its happening under various different circumstances. Sometimes it happens when beets has found an accurate match, or when I select keep, or skip or use as is. But the results are always the same. Crashes with the error

OSError: [Errno 2] No such file or directory: '/Volumes/MUSIC/MusicTmp/Artist/Album'

And the source folder is gone. Though I no longer think it's because beets is moving the folder to the _ directory, because its happening with artists that are correctly tagged and put in the correct folder structure Artist/Album

Here's the settings in my config

import:
    move: yes
    log: ~/Applications/beets/beets.log

copyartifacts:
    print_ignored: yes

paths:
    default: $albumartist_sort/$album%aunique{} ($original_year) [$format]/%if{$multidisc,Disc $disc/}$track. $title
    singleton: Non-Album/$artist/$title
    comp: Compilations/$album%aunique{}/$track $title
    albumtype:soundtrack: Soundtracks/$album/$track $title
CaRoXo commented 10 years ago

Im also having this issue. Actually I could never use "Use as Is" option. Crash always. There is also an incompatibility with fetchart plugin. Fetchart imports a jpg, and then everything crashes becouse copyartifacts doesnt find it anymore (or at the inverse). I just disables fetchart importing from file. The issue with "Use as is" I cant discover how to handle but I would like to. So I never use this option.