-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add base implementation of attachments #591
Conversation
Very cool! Thanks for taking the first steps and demonstrating your intentions with code. I have a couple of questions about the direction:
|
For the coverart use case we need additional information like a description or the cover art type (front, back, artist, etc.). It would be very complicated to devise a custom serialization mechanism just to put it into one column.
This is not available yet and I guess pretty hard to implement. Using a table is a lot less painful.
URLs are a superset of paths, so we don’t loose anything. In the future we might do fancy things with attachment URLs. For example point to rap genius, wikipedia and stuff like that. See also the wiki. |
Indeed; this all makes sense! 👍 😃
Aha; sorry, I was a little behind in reading the wiki page updates. That's true, but it's also important to consider the complexity cost of using URLs. From my perspective, the essence of the attachment functionality is the ability to track files in the filesystem—move them along with the associated music, name them according to path formats, delete them when the music is deleted, etc. If we use full URLs for attachments, we'll pay the price in For many of the examples I can think of where URLs would be useful, current flexible attributes would work just fine. Lyrics from Rap Genius? Use a If we get down to basics, I think the principal between an attachment and a normal flexible attribute is the file-like handling. Since this doesn't apply to URLs, I'm not sure we gain much from the added complexity. |
I’ve given this some thought and it all boils down to functionality/complexity trade off. I’ll try to argue that the additional functionality is worthwile and we can reduce complexity to a minimum. Why do we need URLs?Beets already has flexible attributes to attach scalar data to items. But for simple file attachments we need more—we have to attach vectors to items. When I pondered the coverart plugin I realised that this is still insufficient, because coverart needs to store the cover type (“front”, “back”, etc.) So the next step is to attach two-dimensional vectors to items: Each item has a list of attachments, and each a attachment has a list of attributes. If we take a step back it seems natural to look at attachments as a general way of storing multi-dimensional data for items. Cover art would be using this and I’m confident users will come up with great ideas to leverage this, too. Will the usage of URLs be overly comple?Additional code in the core (the To create attachements, both beets and plugins use the factory’s I hope this adresses all the issues. Just to be clear, URLs are not absolutely necessary, but since we are designing a new API from scratch we should keep it as extendible as possible and URLs are a simple yet powerful tool to achieve this. |
2ded210
to
4b11eed
Compare
What should we do about this? |
Probably the best thing to do would be to regroup and work on the design. There's probably lots we can use from this PR, but we need to think carefully about the approach again before proceeding. |
Should this get closed and be treated more as a reference than anything? |
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is a proposal on how to implement attachments. For a written explanation see the wiki.
The goal is to cover #111, #559 and the use cases on the wiki.
The PR also includes a coverart plugin. It implements the use case for cover art on top of the attachment framework and serves as a guide on how to use the framework.
Although the basic interfaces are all there, there is still a lot of work to do. Incomplete implementations should all be marked by TODO or FIXME tags. In addition we have to do the following.
list
command to show attachments.format_help()
method to the ArgumentParser interface.