beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.92k stars 1.82k forks source link

Permission issues with permissions plugin #2089

Closed nomadturk closed 8 years ago

nomadturk commented 8 years ago

Problem

With 1.3.19 I'm having trouble with permissions plugin. Somehow what once was working is broken. When I import stuff beets finds them. Matches them. Tries to import them and at the last step it starts throwing out errors like below.

Running this command in verbose (-vv) mode:

$ beet -vv import -qapi /Depo/torrents/1976\ Olmaz\ Olsun\ -\ Vurdumduymaz/

Led to this problem:

[10:58] root@hades: /Depo/Beets # beet -vv import -qapi /Depo/torrents/1976\ Olmaz\ Olsun\ -\ Vurdumduymaz/
user configuration: /root/.config/beets/config.yaml
data directory: /root/.config/beets
plugin paths: 
Sending event: pluginload
artresizer: method is (2, (6, 8, 9))
thumbnails: using IM to write metadata
thumbnails: using GIO to compute URIs
library database: /root/beets-musiclibrary.blb
library directory: /Depo/Beets
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
Sending event: import_task_start
chroma: chroma: fingerprinted '/Depo/torrents/1976 Olmaz Olsun - Vurdumduymaz/AA - Olmaz Olsun.mp3'
chroma: matched recordings [u'006c8845-1749-45f1-b880-5569c84c2f8c'] on releases [u'd5151720-2b4b-4a13-ba90-e9b21d51957f', u'5e3ce113-d3f1-417c-ad2e-50730bace078', u'7902319c-c74a-4941-aae8-49e160cc29be']
chroma: chroma: fingerprinted '/Depo/torrents/1976 Olmaz Olsun - Vurdumduymaz/BB - Seni Gidi Vurdumduymaz.mp3'
chroma: matched recordings [u'8b98d9a8-cb0d-4680-8c4b-a8a2c238b4d3'] on releases [u'd5151720-2b4b-4a13-ba90-e9b21d51957f', u'5e3ce113-d3f1-417c-ad2e-50730bace078', u'7902319c-c74a-4941-aae8-49e160cc29be']
Looking up: /Depo/torrents/1976 Olmaz Olsun - Vurdumduymaz
Tagging Sezen Aksu - Olmaz Olsun www.USELESSSITE.com by atis
No album IDs found.
Search terms: Sezen Aksu - Olmaz Olsun www.USELESSITE.com by atis
Album might be VA: False
Sending event: albuminfo_received
Sending event: albuminfo_received
Sending event: albuminfo_received
chroma: acoustid album candidates: 3
Sending event: albuminfo_received
Sending event: albuminfo_received
Sending event: albuminfo_received
Sending event: albuminfo_received
Sending event: albuminfo_received
Sending event: albuminfo_received
Sending event: albuminfo_received
Sending event: albuminfo_received
Evaluating 8 candidates.
Candidate: Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz
Success. Distance: 0.17
Candidate: Sezen Aksu - Kusura Bakma / Yaşanmamış Yıllar
Success. Distance: 0.59
Candidate: Sezen Aksu - Allahaısmarladık / Kaç Yıl Geçti Aradan
Success. Distance: 0.54
Candidate: Sezen Aksu - Kaybolan Yıllar / Neye Yarar
Success. Distance: 0.47
Candidate: Sezen Aksu - Gölge Etme / Aşk
Success. Distance: 0.52
Candidate: Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz
Duplicate.
Candidate: Sezen Aksu - Kaybolmayan Yıllar, Vol.1
Success. Distance: 0.91
Candidate: Sezen Aksu - Allahaısmarladık
Success. Distance: 0.55

/Depo/torrents/1976 Olmaz Olsun - Vurdumduymaz (2 items)
Correcting tags from:
    Sezen Aksu - Olmaz Olsun www.USELESSSITE.com by atis
To:
    Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz
URL:
    http://musicbrainz.org/release/d5151720-2b4b-4a13-ba90-e9b21d51957f
(Similarity: 82.7%) (album) (Vinyl, 1976, TR, Hop Plak)
Sending event: import_task_choice
Sending event: import_task_apply
0 of 2 items replaced
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
Sending event: database_change
lastgenre: added last.fm album genre (artist): Turkish Pop
Sending event: database_change
Sending event: database_change
Sending event: database_change
fetchart: trying source filesystem for album Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz
fetchart: using well-named art file Folder.jpg
fetchart: using local image /Depo/torrents/1976 Olmaz Olsun - Vurdumduymaz/Folder.jpg
lyrics: lyrics already present: Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz - Olmaz Olsun
lyrics: lyrics already present: Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz - Seni Gidi Vurdumduymaz
the: "Sezen Aksu" -> "Sezen Aksu"
Sending event: before_item_moved
Sending event: item_moved
Sending event: database_change
Sending event: database_change
Sending event: write
hook: running command "echo writing to /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/01 - Olmaz Olsun.mp3" for event write
writing to /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/01 - Olmaz Olsun.mp3
Sending event: after_write
the: "Sezen Aksu" -> "Sezen Aksu"
Sending event: before_item_moved
Sending event: item_moved
Sending event: database_change
Sending event: database_change
Sending event: write
hook: running command "echo writing to /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/02 - Seni Gidi Vurdumduymaz.mp3" for event write
writing to /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/02 - Seni Gidi Vurdumduymaz.mp3
Sending event: after_write
Sending event: database_change
Sending event: database_change
Sending event: import_task_files
Sending event: art_set
embedart: Embedding album art into Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz
embedart: embedding /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/cover.jpg
Sending event: write
hook: running command "echo writing to /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/01 - Olmaz Olsun.mp3" for event write
writing to /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/01 - Olmaz Olsun.mp3
Sending event: after_write
embedart: embedding /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/cover.jpg
Sending event: write
hook: running command "echo writing to /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/02 - Seni Gidi Vurdumduymaz.mp3" for event write
writing to /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/02 - Seni Gidi Vurdumduymaz.mp3
Sending event: after_write
thumbnails: generating thumbnail for Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz
artresizer: ImageMagick resizing /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/cover.jpg to /root/.cache/thumbnails/normal/7a9ad5edde6ed1bd33182ea13e240746.png
thumbnails: wrote thumbnail for Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz
Sending event: database_change
acousticbrainz: getting data for: Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz - Olmaz Olsun
acousticbrainz: fetching URLs: https://acousticbrainz.org/006c8845-1749-45f1-b880-5569c84c2f8c/low-level https://acousticbrainz.org/006c8845-1749-45f1-b880-5569c84c2f8c/high-level
acousticbrainz: recording ID 006c8845-1749-45f1-b880-5569c84c2f8c not found
acousticbrainz: getting data for: Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz - Seni Gidi Vurdumduymaz
acousticbrainz: fetching URLs: https://acousticbrainz.org/8b98d9a8-cb0d-4680-8c4b-a8a2c238b4d3/low-level https://acousticbrainz.org/8b98d9a8-cb0d-4680-8c4b-a8a2c238b4d3/high-level
acousticbrainz: recording ID 8b98d9a8-cb0d-4680-8c4b-a8a2c238b4d3 not found
Sending event: album_imported
There was a problem setting permission on /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/01 - Olmaz Olsun.mp3
There was a problem setting permission on /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/02 - Seni Gidi Vurdumduymaz.mp3
There was a problem setting permission on /Depo/Beets/Sezen Aksu
There was a problem setting permission on /Depo/Beets/Sezen Aksu/1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz
Sending event: import
Sending event: cli_exit
hook: running command "echo beets just exited!" for event cli_exit
beets just exited!
hook: running command "echo have a nice day!" for event cli_exit
have a nice day

Now, let's check it in the database and let's check the permissions. More than once I realized that the files were moved to my library directory but not registered in the database.

[10:59] root@hades: /Depo/Beets # beet ls "Olmaz Olsun"
Sezen Aksu - Allahaısmarladık - Olmaz Olsun
Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz - Olmaz Olsun
Sezen Aksu - Olmaz Olsun / Seni Gidi Vurdumduymaz - Seni Gidi Vurdumduymaz
Nilüfer - Nilufer '84 - Olmaz Olsun
beets just exited!
have a nice day!

[11:02] root@hades: /Depo/Beets # ls -l Sezen\ Aksu/1976\ -\ Olmaz\ Olsun\ _\ Seni\ Gidi\ Vurdumduymaz/
01 - Olmaz Olsun.mp3             02 - Seni Gidi Vurdumduymaz.mp3  cover.jpg*                       

[11:02] root@hades: /Depo/Beets # ls -l Sezen\ Aksu/1976\ -\ Olmaz\ Olsun\ _\ Seni\ Gidi\ Vurdumduymaz/
total 8,1M
--w----r-T 1 nomad nomad 4,5M Haz 28 10:59 01 - Olmaz Olsun.mp3
--w----r-T 1 nomad nomad 3,7M Haz 28 10:59 02 - Seni Gidi Vurdumduymaz.mp3
-rwxr--r-- 1 nomad nomad 7,7K Haz 23 19:41 cover.jpg*

[11:02] root@hades: /Depo/Beets # ls -l Sezen\ Aksu/
total 4,0K
d-wxrw--wt 2 root root 4,0K Haz 28 10:59 1976 - Olmaz Olsun _ Seni Gidi Vurdumduymaz/

Also mind the nomad user for the mp3 files. Which actually is the downloading user. I ran beets as root this time but originally I am running it as non-root user. I was testing if the same problem occurs when I run it as root. Turns out it does. And I manually have to set permissions to 755 for directories and 644 for files after it.

Once permissions plugin is disabled, problem goes away.

Setup

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    fallback: ''
    google_API_key: REDACTED
    sources: google lyrics.com musixmatch
    google_engine_ID: REDACTED
    bing_client_secret: REDACTED
    force: no
    auto: yes
    genius_api_key: REDACTED
    bing_lang_to:
web:
    host: 10.8.3.15
    port: 8337
    cors: ''
duplicates:
    album: no
    move: /Depo/BeTara2/Duplicates
    delete: yes
    merge: yes
    count: no
    full: no
    format: ''
    keys: []
    tag: ''
    path: no
    copy: ''
    tiebreak: {}
    strict: no
    checksum: ''
library: ~/beets-musiclibrary.blb
original_date: yes
zero:
    field: comments
    comments:
    - EAC
    - LAME
    - from.+collection
    - ripped by
    - www
    - .net
    - .org
    - .com
    - iTunNORM

    update_database: yes

clutter:
- Thumbs.db
- .DS_Store
- '*.log'
- '*.txt'
- '*.cue'
- '*.m3u'
- '*.sfv'
- '*.nfo'
- '*.jpg.jpg'
- AlbumArt*.jpg
- picard*.jpg
- Folder.jpg
- '*.rtf'
- '*.doc'

plugins: discogs fromfilename fuzzy the lastgenre mbsync badfiles info acousticbrainz chroma thumbnails info hook web replaygain export fetchart embedart missing duplicates mbcollection mbsubmit  beatport lyrics mbsubmit permissions

musicbrainz:
    user: nomadturk
    pass: REDACTED
    host: musicbrainz.org
    ratelimit: 1
    ratelimit_interval: 1.0

import:
    copy: no
    move: yes
    write: yes
    resume: yes
    quiet_fallback: asis
    log: ~/beetslog.txt
acousticbrainz:
    auto: yes
permissions:
    file: 644
    dir: 755

paths:
    default: '%title{%the{$albumartist}}/%if{$original_year,$original_year - }$album/$track - $title'
    singleton: Non-Album/%title{%the{$albumartist}}/$artist - $title%if{$original_year, - $original_year}%if{%aunique{}, (%aunique{})}}
    comp: Various Artists/%if{$original_year,$original_year - }$album/$track - $artist - $title
    albumtype_soundtrack: Soundtracks/$album%if{$original_year, - $original_year}%if{%aunique{}, (%aunique{})}/$track - $artist - $title
    bad: BadMusic/%title{%the{$albumartist}}/$album%aunique{}/$track $title
convert:
    max_bitrate: 320
    never_convert_lossy_files: yes
    copy_album_art: no
    format: mp3
    formats:
        mp3:
            command: ffmpeg -i $source -ab 320k -map_metadata 0 $dest
            extension: mp3
        alac:
            command: ffmpeg -i $source -y -vn -acodec alac $dest
            extension: m4a
        aac:
            command: ffmpeg -i $source -y -vn -acodec libfaac -aq 100 $dest
            extension: m4a
        opus: ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest
        flac: ffmpeg -i $source -y -vn -acodec flac $dest
        ogg: ffmpeg -i $source -y -vn -acodec libvorbis -aq 2 $dest
        wma: ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest
    dest:
    auto: yes
    threads: 8
    tmpdir: /tmp

    paths: {}
    pretend: no
    quiet: yes
    embed: yes
threaded: yes
asciify_paths: yes
hook:
    hooks:
    -   event: cli_exit
        command: echo "beets just exited!"
    -   event: cli_exit
        command: echo "have a nice day!"
    -   event: item_imported
        command: echo "importing \"{item.path}\""
    -   event: write
        command: echo "writing to {path}"
id3v23: yes
replaygain:
    backend: command
    targetlevel: 91
    auto: no
    overwrite: no
    command: ''
    noclip: yes

ui:
    color: yes

match:
    strong_rec_thresh: 0.21
directory: /Depo/Beets
lastgenre:
    canonical: no
    count: 1
    fallback: ''
    whitelist: yes
    source: album
    force: yes
    min_weight: 10
    auto: yes
    separator: ', '
acoustid:
    apikey: REDACTED
mbcollection:
    auto: no
beatport:
    tokenfile: beatport_token.json
    apikey: REDACTED
    apisecret: REDACTED
    source_weight: 0.5
missing:
    count: no
    total: no
the:
    a: yes
    patterns: []
    the: yes
    strip: no
    format: '{0}, {1}'
thumbnails:
    auto: yes
    dolphin: no
    force: no
discogs:
    tokenfile: discogs_token.json
    apikey: REDACTED
    apisecret: REDACTED
    source_weight: 0.5
embedart:
    compare_threshold: 0
    auto: yes
    ifempty: no
    remove_art_file: no
    maxwidth: 0
export:
    default_format: json
    json:
        formatting:
            ensure_ascii: no
            indent: 4
            sort_keys: yes
            separators: [',', ': ']
fetchart:
    auto: yes
    minwidth: 0
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    google_engine: 001442825323518660753:hrh5ch1gjzm
    enforce_ratio: no
    cautious: no
    maxwidth: 0
    store_source: no
    google_key: REDACTED
    fanarttv_key: REDACTED
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
mbsubmit:
    threshold: medium
    format: $track. $title - $artist ($length)
fuzzy:
    threshold: 0.7
    prefix: '~'
chroma:
    auto: yes
sampsyo commented 8 years ago

Thanks for the report! I've fixed this on master -- any chance you could give it a try?

nomadturk commented 8 years ago

Well, it seems that did it. I imported a new folder after enabling this and it looks like it's been created with the correct permissions and without any errors.

Thank you @sampsyo ;)