Delete and handle nonexistant tags - #660
Merged
geigerzaehler merged 6 commits intoApr 10, 2014
Merged
Conversation
sampsyo
added a commit
that referenced
this pull request
Apr 5, 2014
In preparation for #660, where we will allow MediaFile to expose None values when tags are missing (and consume None to remove tags). This makes it possible to hide nullness in the rest of beets by translating None to a suitable zero-ish value on field assignment. Types can of course opt out of this to preserve a distinct null value. We do this now for the album_id field, which needs to be null to indicate singletons. Type.normalize() also enables more sophisticated translations (e.g., an integer field could round off float values assigned into it) in the future.
added 6 commits
April 9, 2014 23:28
Instead of returning a special "None value" if a tag does not exist, we return none directly.
Author
|
@sampsyo I think we're ready to merge. |
Member
|
Awesome! Looks great to me; I agree that it's merging time. 🚀 ✨ 👍 With this merged, we can finally address #157. |
geigerzaehler
pushed a commit
that referenced
this pull request
Apr 10, 2014
Delete and handle nonexistant tags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is based on #644 and adds two things
delattr(mediafile, 'artist')and thenmediafile.save()will remove the 'artist' tag from the file on disk.MediaFileproperties may now returnNoneif a tag is not present in the file. I have no clue how this will play with the rest of beets, but at least the tests all pass.There is one thing I’d like to add: In
mediafile.update()check forNonevalues in the dictionary and delete those tags. This solves #157 and #645.Feedback is very welcome.