Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

plugins: add importhistory #4748

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

doronbehar
Copy link
Contributor

Description

Add a plugin useful for bulk importers.

To Do

  • Documentation. (If you've add a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst near the top of the document.)
  • Tests. (Encouraged but not strictly required.)

@JOJ0
Copy link
Member

JOJ0 commented Jul 27, 2023

I have planned to finally look into this PR but I just can't get to it. In the meantime I'd like to mention that I have a quite similar plugin I'm maintaining (original maintainer doesn't use beets anymore). It certainly has a slightly different approach but just wanted to mention and maybe on the long run this could be merged into one plugin (....or not! It might be too different). Also it is pretty old code which I just quickfixed somehow to make it work for my needs. Just want you to have a look if you're interested: https://github.com/JOJ0/beets-dirfields

@doronbehar doronbehar force-pushed the importhistory-plug branch 4 times, most recently from afafefb to 26e5ae7 Compare December 7, 2023 11:28
@doronbehar
Copy link
Contributor Author

Hey @JOJ0 , after a mostly successful review process, I'd like to bump this PR upwards :) I hopefully fixed the formatting issues, and maybe CI will be green now. I also took a look upon the dirfields plugin and I think that this PR is much more mature - it includes docs as well as another feature described in the docs here, that isn't included in the competing plugin.

Copy link
Member

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking AWESOME! I really like the idea of a plugin dedicated to managing this information, and the use cases in the docs are super clear. Here are a few code suggestions!

docs/plugins/importhistory.rst Outdated Show resolved Hide resolved
docs/plugins/importhistory.rst Outdated Show resolved Hide resolved
docs/plugins/importhistory.rst Outdated Show resolved Hide resolved
docs/plugins/importhistory.rst Outdated Show resolved Hide resolved
beetsplug/importhistory.py Outdated Show resolved Hide resolved
beetsplug/importhistory.py Outdated Show resolved Hide resolved
beetsplug/importhistory.py Outdated Show resolved Hide resolved
beetsplug/importhistory.py Outdated Show resolved Hide resolved
beetsplug/importhistory.py Outdated Show resolved Hide resolved
beetsplug/importhistory.py Outdated Show resolved Hide resolved
@JOJ0
Copy link
Member

JOJ0 commented Dec 10, 2023

I finally found the time to read through the docs. Very useful and well written. Loads of useful usecases! Great!

Keeping track of the source path alone is the killerfeature for me❤️

I have one highlevel question regarding that: Will the sourcepath stay untouched in case for some reason I do a reimport from the items already in the library: beet import -L ...

@sampsyo
Copy link
Member

sampsyo commented Dec 10, 2023

Good question, @JOJ0!

@doronbehar
Copy link
Contributor Author

Will the sourcepath stay untouched in case for some reason I do a reimport from the items already in the library: beet import -L ...

Good question, I had no idea this option existed. Is there a way to know what events this action triggers?

@doronbehar
Copy link
Contributor Author

Thanks for all the comments. I'm glad you liked the idea in general, and that we only have to fine-tune the details of the implementation. I think that having tests would be nice, and it'll take me time to delve into it. I'll keep you notified! In the meantime, I pushed a commit fixing the easy issues presented by @sampsyo .

@doronbehar doronbehar force-pushed the importhistory-plug branch 2 times, most recently from 79271b2 to e2f3ff8 Compare December 13, 2023 21:45
@JOJ0
Copy link
Member

JOJ0 commented Dec 14, 2023

Will the sourcepath stay untouched in case for some reason I do a reimport from the items already in the library: beet import -L ...

Good question, I had no idea this option existed. Is there a way to know what events this action triggers?

Best you just test a reimport using that option and see what value source_path has after that. I have a feeling that it might the beets library path and the original source_path gets lost. Give it a try and we'll see if it does. HTH :-)

@doronbehar
Copy link
Contributor Author

Hey all,

I was busy for a while, and I had some time left today to fix some of the issues discussed back than, including a small bug I encountered while experimenting with the plugin personally. The commits I just pushed fix these issues, and I also marked the review conversations above as resolved, but of course feedback is still welcomed.

I didn't have time though, to think thoroughly about @JOJ0's question:

I have one highlevel question regarding that: Will the sourcepath stay untouched in case for some reason I do a reimport from the items already in the library: beet import -L ...

So don't feel like you need to review this now once more - this is still not ready enough.

@doronbehar
Copy link
Contributor Author

Hmm now I checked and saw that (before the last push) using beet import --library on items that were imported, indeed changes the source_path field to the path from the music library. I managed to fix that by using an additional listener to the import_task_choice event.

@doronbehar
Copy link
Contributor Author

Now I also fixed the small merge conflict, so this is ready for another round of review :). I think it'd be nice to write tests, but perhaps it'd be good to get your 👍 at this stage.

@doronbehar doronbehar requested review from sampsyo and JOJ0 March 15, 2024 16:25
@kergoth
Copy link
Contributor

kergoth commented Sep 20, 2024

I would suggest adding a config option to control the prompt to remove the source files, as I suspect there are those that would want to keep information about the import source but want to keep the source files pristine and unmodified otherwise. For example, I keep a copy of all the digital media I own for posterity, even if I remove it from my library, on general principle. Of course, this could always be added later on in a future PR.

Other than that, this looks like a great plugin, nice work.

@JOJ0
Copy link
Member

JOJ0 commented Sep 20, 2024

@kergoth I had a similar suggestion in mind...I think....

Do you mean a "global" config option for the plugin that disables all prompts ever and leaves the "source path saving" as the only feature left? Did I get this right? If not please clarify! Thanks! 😀

@kergoth
Copy link
Contributor

kergoth commented Sep 20, 2024

@kergoth I had a similar suggestion in mind...I think....

Do you mean a "global" config option for the plugin that disables all prompts ever and leaves the "source path saving" as the only feature left? Did I get this right? If not please clarify! Thanks! 😀

Exactly what I was thinking, yeah.

@doronbehar
Copy link
Contributor Author

Thanks for the comment :) I rebased to fix the merge conflicts and applied your suggestion. I also revised the documentation. Still I haven't found time yet to add a test for the plugin, and perhaps it'd be nice to do so.

@JOJ0
Copy link
Member

JOJ0 commented Sep 23, 2024

Hi @doronbehar thanks for the quick implementation of that feature! I'm currently reviewing and playing around with it so we can finally get to a merge. Yes, if you feel motivated a test for the plugin would be indeed wonderful!

I will push my suggestions directly as commits to your feature branch. Hope that is ok for you, we can discuss here then if you don't like something. It is just much easier for me at the moment to suggest as code/commits directly instead of adding suggestions via GitHub. Again: Hope that's ok, you'll see my commits soon......

PS: Last but not least: I want to apologize for letting you hang there for 6 months already! I was not really "in town" a couple of months ;-) Many thanks for the patience! Let's finally get this done now! 💪

@JOJ0
Copy link
Member

JOJ0 commented Sep 23, 2024

Hi @doronbehar I finished my changes for now. I tried to keep them bite-sized, so you can review them commit by commit. Hope that helps and speak soon. All the best!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants