Grant Shoshin Shangreaux <[email protected]> writes: > Yoni Rabkin writes: > >> Grant Shoshin Shangreaux <[email protected]> writes: >> >>> Yoni Rabkin writes: >>> >>>> Grant Shoshin Shangreaux <[email protected]> writes: >>>> >>>>> +(defun emms-tag-editor--track-editable-p (track) >>>>> + "Return t if TRACK is not a file, or has a tagfile function defined." >>>>> + (or (not (emms-track-file-p track)) >>>>> + (emms-tag-editor--tagfile-function track))) >>>> >>>> Why check if it is a file? Not all files are editable (e.g. .pls, .m3u). >>> >>> Oh, good point. This was to allow editing of URL tracks for example. I >>> just assumed if the track isn't a file we can allow adding metadata to >>> the cache-db if desired. We're not trying to write to any file so just >>> allow it as editable. If it /is/ a file then we check for a tagfile >>> function. Considering we won't have one defined for .pls or .m3u this >>> should catch those, correct? >> >> It is a roundabout way of addressing it, but perfectly valid. It can >> stay that way. > > Now that I think of it, I totally agree.
> Perhaps it would be better to enumerate which types of tracks allow > editing of metadata? Your code already does that by looking up an association in `emms-tag-editor-tagfile-functions'. > I admit, I'm not deeply familiar with all of the track types. I do see > benefit in adding metadata to URL tracks, even if it is only in the > cache-db. We are effectively switching around the concept: we are making a cache editor that also writes tags, as opposed to a tag editor that saves some of its data in a cache. We'll need to communicate this to the user so that there are no surprises. I can think of three cases: First, if there is an association in `emms-tag-editor-tagfile-functions' then we edit the file, and check that it has been edited. Second, if it is a file, but with no association in `emms-tag-editor-tagfile-functions', then there should be a message along the lines of: "the file doesn't have a metadata editor, changes will be saved only in the Emms cache and not in the file itself" Third, if it is not a file then a similar message is displayed, such as "saving changes to the Emms cache" or "editing the Emms cache." One place we could put such messages, perhaps in an eye-catching font-lock, is at the top of the "*EMMS-TAGS*" buffer. -- "Cut your own wood and it will warm you twice"
