Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

beet alt update doesn't always remove obsolete links #47

Closed
dosoe opened this issue Mar 12, 2020 · 3 comments · Fixed by #48
Closed

beet alt update doesn't always remove obsolete links #47

dosoe opened this issue Mar 12, 2020 · 3 comments · Fixed by #48
Assignees
Labels

Comments

@dosoe
Copy link

dosoe commented Mar 12, 2020

Hi!
I've been using beets_alternatives to create softlinks and therefore have two parralel classification systems for my music. However, I noticed a problem: When the directory of a file changes and I apply beet alt update by-work it creates new links with updated paths and targets, but doesn't remove the old ones.
Here my configuration:

alternatives:
    by-work:
        directory: /media/soergeld/My Passport/by-work
        paths:
            comp type::'non-classical': Non-Classique/$aaa/$aa/$tr
            type::'non-classical': Non-Classique/$aaa/$aa/$tr
            comp type::'medieval': Medieval/$aaa/$aa/$tr
            type::'medieval': Medieval/$aaa/$aa/$tr
            comp pw::'No_Work': Classique/$artist_sort/Divers/$aaa/$aa/$tr
            pw::'No_Work': Classique/$artist_sort/Divers/$aaa/$aa/$tr
            comp pc::'No_Parent_Composer': Classique/$artist_sort/$pw/$aaa/$aa/$tr
            pc::'No_Parent_Composer': Classique/$artist_sort/$pw/$aaa/$aa/$tr
            comp work_prefix::'None':  Classique/$pc/$pw/$aaa/$aa/$tr
            work_prefix::'None':  Classique/$pc/$pw/$aaa/$aa/$tr
            comp: Classique/$pc/$work_prefix/$pw/$aaa/$aa/$tr
            default: Classique/$pc/$work_prefix/$pw/$aaa/$aa/$tr
            
        formats: link

tr, pw, pc, aa, aaa and type are created using the inline plugin, I can show you how if needed.

As an example, beet mbsync && beet write outputted, among other things,

Georg Philipp Telemann - Complete Overtures, Volume 1 - Overture in D TWV 55: D18, 1. Ouverture
  albumartist: Georg Philipp Telemann; Collegium Instrumentale Brugense, Patrick Peire -> Georg Philipp Telemann; Het Kamerokest, Patrick Peire
  albumartist_sort: Telemann, Georg Philipp; Collegium Instrumentale Brugense, Peire, Patrick -> Telemann, Georg Philipp; Kamerokest, Het, Peire, Patrick
.
.
.
Georg Philipp Telemann - Complete Overtures, Volume 1 - Overture in A TWV 55: A4, 4. Minuetta 1-Minuetta 2
  albumartist: Georg Philipp Telemann; Collegium Instrumentale Brugense, Patrick Peire -> Georg Philipp Telemann; Het Kamerokest, Patrick Peire
  albumartist_sort: Telemann, Georg Philipp; Collegium Instrumentale Brugense, Peire, Patrick -> Telemann, Georg Philipp; Kamerokest, Het, Peire, Patrick

The files then got moved according to their new metadata. Applying beet alt update by-work after that showed

+/media/soergeld/My Passport/by-work/Classique/Telemann, Georg Philipp/Overture-Suite in D, TWV 55_D18/Kamerokest, Het, Peire, Patrick/Complete Overtures, Volume 1/1-1 Overture in D TWV 55_ D18, 1. Ouverture.mp3
.
.
.
+/media/soergeld/My Passport/by-work/Classique/Telemann, Georg Philipp/Overture in A, TWV 55_A4/Kamerokest, Het, Peire, Patrick/Complete Overtures, Volume 1/3-73 Overture in A TWV 55_ A4, 4. Minuetta 1-Minuetta 2.mp3

but the old links remain. Do you have an idea why? I didn't notice this behaviour before and it seemed to work fine, but then I didn't check in detail as I have a collection of ~50 000 tracks. However, find /media/soergeld/My\ Passport/by-work/ -xtype l shows more broken links, and I noticed that I had to remove all links and restart from scratch (which isn't that much of a problem) from time to time.
It seems like at least sometimes, more precisely when you move a file with beets, beets-alternatives would create new links and not redirect (and eventually modify) the existing ones, that are then left broken.

So to summarize:
I have files on beets with soft links from beets-alternatives
I change the files on beets and move them
I want to update the soft links
Instead of updating the old soft links to the new location of the files, new soft links are created and the old ones are left broken.

@wisp3rwind wisp3rwind self-assigned this Mar 18, 2020
@wisp3rwind wisp3rwind added the bug label Mar 18, 2020
@wisp3rwind
Copy link
Collaborator

Thanks for the report & sorry for the belated reply @dosoe! I believe I've pinned down the issue, will attempt a fix now.

@dosoe
Copy link
Author

dosoe commented Mar 18, 2020

Thanks a lot! No problem, I guess right now everyone has other things to worry about.

wisp3rwind added a commit to wisp3rwind/beets-alternatives that referenced this issue Mar 18, 2020
wisp3rwind added a commit to wisp3rwind/beets-alternatives that referenced this issue Mar 18, 2020
@wisp3rwind
Copy link
Collaborator

@dosoe: The linked PR should fix this issue, if it's not too much of a hassle for you to test it before merging, that'd be perfect!

wisp3rwind added a commit to wisp3rwind/beets-alternatives that referenced this issue May 6, 2020
wisp3rwind added a commit to wisp3rwind/beets-alternatives that referenced this issue Jul 12, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants