beetbox / beetbox/beets

Zip files never get marked already imported during incremental import

Open
#3,561 1 comment 0 reactions 0 assignees View on GitHub
feature
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

### Problem

Upon importing a zip file while having `incremental: true` set, the zip file will never be considered already imported. Only the temporary directory it is extracted to will be marked to be skipped next time an incremental import is ran.

```sh
somasis/forretress:~/audio/source/stores % beet imp -i ATW\ -\ Mares\ EP.zip

/tmp/tmpu5za0hzt (5 items)
Tagging:
ATW - Mares EP
URL:
https://musicbrainz.org/release/8dd9a4cd-04b4-444f-bcc8-d6fb26fdaa48
(Similarity: 100.0%) (Digital Media, 2014, XW)
* Got A Bully -> Got a Bully
* geologist (video edit) -> Geologist (video edit)
This album is already in the library!
Old: 5 items, FLAC, 842kbps, 15:53, 93.3 MiB
New: 5 items, FLAC, 842kbps, 15:53, 93.2 MiB
[S]kip new, Keep both, Remove old, Merge all? r
somasis/forretress:~/audio/source/stores % beet imp -i ATW\ -\ Mares\ EP.zip

/tmp/tmpxod0g4q4 (5 items)
Tagging:
ATW - Mares EP
URL:
https://musicbrainz.org/release/8dd9a4cd-04b4-444f-bcc8-d6fb26fdaa48
(Similarity: 100.0%) (Digital Media, 2014, XW)
* Got A Bully -> Got a Bully
* geologist (video edit) -> Geologist (video edit)
This album is already in the library!
Old: 5 items, FLAC, 842kbps, 15:53, 93.3 MiB
New: 5 items, FLAC, 842kbps, 15:53, 93.2 MiB
[S]kip new, Keep both, Remove old, Merge all? r
```

This can be seen in the log file that is generated by the incremental import:

```text
[...]
duplicate-replace /tmp/tmpu5za0hzt
duplicate-replace /tmp/tmpxod0g4q4
[...]
```

### Expected

This seems counterintuitive, as the zip file should be considered the source of the import, not the directory. I don't think this behavior is intentional.

### Setup

* OS: Arch Linux
* Python version: 3.8.2
* beets version: 1.4.9
* Turning off plugins made problem go away (yes/no): no

Relevant `import` configuration:

```yaml
import:
log: /home/somasis/audio/lossless/beets.log
languages: en
write: yes
copy: yes
incremental: yes
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with `beet imp -i` and `incremental: yes`, then trace the incremental import handling and the generated import log. Compare the zip path with the temporary extraction directory; done means repeated imports recognize the zip source as already imported rather than logging a new temporary directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.