Skip to content

Commit

Permalink
Look in metadata for track title
Browse files Browse the repository at this point in the history
  • Loading branch information
pwt committed Apr 3, 2022
1 parent cbcd2fd commit f3a5bb8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
v0.4.49 -
v0.4.49 - Maintenance update
v0.4.48 - Add 'sub_gain' action
- Add 'surround_volume_tv' action
- Add 'surround_volume_music' action
Expand Down
10 changes: 10 additions & 0 deletions soco_cli/action_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,16 @@ def title_not_useful(title):
for item in sorted(track_info):
if item not in ["metadata", "uri", "album_art"]:
elements[item.capitalize()] = track_info[item]
# If there's no title, look in the metadata
try:
if elements["Title"] == "" or title_not_useful(elements["Title"]):
metadata = parse(track_info["metadata"])
elements["Title"] = metadata["DIDL-Lite"]["item"]["dc:title"]
logging.info(
"Found title in metadata: {}".format(elements["Title"])
)
except KeyError:
pass

# Remove blank and 'None' items
elements = {
Expand Down

0 comments on commit f3a5bb8

Please sign in to comment.