Closed owenvoke closed 5 months ago
Hiya, cheers for the bug report.
It also might be nice to support duration as well (which is the duration in seconds) that some services provide.
Sounds good. Was this recently added to the listenbrainz API or did I just manage to completely miss it? lol
I'm happy to open a PR if you think this makes sense.
I'm away at the moment, so if you want to open a PR, go for it. Otherwise you'll have to bear with me a couple days.
Hi @Weissnix4711, thanks for the quick reply! I'm happy to wait as it'd be nice to have your input (no rush).
Regarding duration
, I'm not entirely sure. It's just mentioned alongside duration_ms
in the Additional Info Fields section.
Hi @Weissnix4711, thank you for fixing this, really appreciate it! Please could you create a new release when you get a chance? 🎉
Hi @Weissnix4711, thank you for fixing this, really appreciate it! Please could you create a new release when you get a chance? 🎉
Sorry, forgot to push the tag. Will do.
System Health details
System Information
Home Assistant Community Store
GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4946 Installed Version | 1.34.0 Stage | running Available Repositories | 1398 Downloaded Repositories | 28 HACS Data | okHome Assistant Cloud
logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | okDashboards
dashboards | 3 -- | -- resources | 13 views | 19 mode | storageRecorder
oldest_recorder_run | 26 June 2024 at 09:12 -- | -- current_recorder_run | 4 July 2024 at 09:30 estimated_db_size | 1271.26 MiB database_engine | postgresql database_version | 16.3Checklist
Describe the issue
When using a service such as Plex to add data to ListenBrainz, it doesn't include a
duration_ms
in the payload. This results in the following error as it tries to divideNone
by1000
.Example response from `get_now_playing()`
```json { "payload": { "count": 1, "listens": [ { "playing_now": true, "track_metadata": { "additional_info": { "listening_from": "Plex", "track_mbid": "a58aa1ab-fff2-42e5-97ae-111347123871" }, "artist_name": "Jeff Lynne\\u2019s ELO", "release_name": "Wembley or Bust", "track_name": "Evil Woman" } } ], "playing_now": true, "user_id": "owenvoke" } } ```Probably the best solution is to change this line to add support for services that don't submit a
duration_ms
: https://github.com/Weissnix4711/hass-listenbrainz/blob/e28c1e55f038c4b6beb17247767d5dc352a111cf/custom_components/listenbrainz/api.py#L137It also might be nice to support
duration
as well (which is the duration in seconds) that some services provide. 🤔 I'm happy to open a PR if you think this makes sense.Error
Reproduction steps
duration_ms
dataDebug logs
Diagnostics dump
No response