mirror of
https://github.com/SoongNoonien/mpdevil.git
synced 2023-08-10 21:12:44 +03:00
denested "if" in Song
This commit is contained in:
parent
68720a41bd
commit
67e8c3ece5
28
bin/mpdevil
28
bin/mpdevil
@ -491,21 +491,21 @@ class MultiTag(list):
|
|||||||
|
|
||||||
class Song(collections.UserDict):
|
class Song(collections.UserDict):
|
||||||
def __setitem__(self, key, value):
|
def __setitem__(self, key, value):
|
||||||
# time is deprecated https://mpd.readthedocs.io/en/latest/protocol.html#other-metadata
|
if key == "time": # time is deprecated https://mpd.readthedocs.io/en/latest/protocol.html#other-metadata
|
||||||
if key != "time":
|
pass
|
||||||
if key == "duration":
|
elif key == "duration":
|
||||||
super().__setitem__(key, Duration(value))
|
super().__setitem__(key, Duration(value))
|
||||||
elif key == "format":
|
elif key == "format":
|
||||||
super().__setitem__(key, Format(value))
|
super().__setitem__(key, Format(value))
|
||||||
elif key == "last-modified":
|
elif key == "last-modified":
|
||||||
super().__setitem__(key, LastModified(value))
|
super().__setitem__(key, LastModified(value))
|
||||||
elif key in ("range", "file", "pos", "id"):
|
elif key in ("range", "file", "pos", "id"):
|
||||||
super().__setitem__(key, value)
|
super().__setitem__(key, value)
|
||||||
|
else:
|
||||||
|
if isinstance(value, list):
|
||||||
|
super().__setitem__(key, MultiTag(value))
|
||||||
else:
|
else:
|
||||||
if isinstance(value, list):
|
super().__setitem__(key, MultiTag([value]))
|
||||||
super().__setitem__(key, MultiTag(value))
|
|
||||||
else:
|
|
||||||
super().__setitem__(key, MultiTag([value]))
|
|
||||||
|
|
||||||
def __missing__(self, key):
|
def __missing__(self, key):
|
||||||
if key == "title":
|
if key == "title":
|
||||||
|
Loading…
Reference in New Issue
Block a user