-
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
Implement multi-value genres tag #5426
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -708,13 +708,13 @@ def test_if_def_false_complete(self): | |
self._assert_dest(b"/base/not_played") | ||
|
||
def test_first(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you try and test this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently the only way to use Without it being confirmed that that is the intended method of use, or a future improvement to the ergonomics, I wouldn't want to encode this in a test as the expected usage. This PR just brings up the genres field to the same state as the artists field, and any work beyond that is out of scope. |
||
self.i.genres = "Pop; Rock; Classical Crossover" | ||
self._setf("%first{$genres}") | ||
self.i.semicolon_delimited_field = "Pop; Rock; Classical Crossover" | ||
self._setf("%first{$semicolon_delimited_field}") | ||
self._assert_dest(b"/base/Pop") | ||
|
||
def test_first_skip(self): | ||
self.i.genres = "Pop; Rock; Classical Crossover" | ||
self._setf("%first{$genres,1,2}") | ||
self.i.semicolon_delimited_field = "Pop; Rock; Classical Crossover" | ||
self._setf("%first{$semicolon_delimited_field,1,2}") | ||
self._assert_dest(b"/base/Classical Crossover") | ||
|
||
def test_first_different_sep(self): | ||
|
@@ -1306,6 +1306,28 @@ def test_write_date_field(self): | |
item.write() | ||
assert MediaFile(syspath(item.path)).year == clean_year | ||
|
||
def test_write_multi_genres(self): | ||
item = self.add_item_fixture(genre="old genre") | ||
item.write( | ||
tags={"genres": ["g1", "g2"]}, | ||
) | ||
|
||
# Ensure it reads all genres | ||
assert MediaFile(syspath(item.path)).genres == ["g1", "g2"] | ||
|
||
# Ensure reading single genre outputs the first of the genres | ||
assert MediaFile(syspath(item.path)).genre == "g1" | ||
|
||
def test_write_multi_genres_both_single_and_multi(self): | ||
item = self.add_item_fixture(genre="old genre 1") | ||
item.write( | ||
tags={"genre": "single genre", "genres": ["multi genre"]}, | ||
) | ||
|
||
# Ensure the multi takes precedence | ||
assert MediaFile(syspath(item.path)).genre == "multi genre" | ||
assert MediaFile(syspath(item.path)).genres == ["multi genre"] | ||
|
||
|
||
class ItemReadTest(unittest.TestCase): | ||
def test_unreadable_raise_read_error(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand a bit here, maybe with an example that shows why it's useful? The point of such a tag should be made obvious to end users scrolling through.