crustymonkey / py-sonic

A python library to wrap the Subsonic REST API
http://stuffivelearned.org/doku.php?id=programming:python:py-sonic
GNU General Public License v3.0
56 stars 26 forks source link

Scrobble does not support 'time' #31

Closed dathbe closed 9 months ago

dathbe commented 9 months ago

The scrobble function in libsonic does not seem to support specifying the play_date time. Documentation here: http://www.subsonic.org/pages/api.jsp#scrobble

dathbe commented 9 months ago

Update: It does appear to be supported, but not documented (https://stuffivelearned.org/doku.php?id=programming:python:py-sonic#scrobble_self_sid_submission_true).

The proper call is:

api.scrobble('id', listenTime=123345)

where "id" is the unique id of the song you want to scrobble And the listenTime is specified in seconds since 1970. Be careful if you input the subsonic api-standard milliseconds since 1970 because it will wrap around and give you a date in the 18th century.

crustymonkey commented 9 months ago

Yeah, this is something I do throughout the library, which is convert from the standard unix timestamp to the non-standard Java BS of milliseconds as an int. I'd rather have people just use time.time() calcs in python and pass that value than adhere to java stupidity.

dathbe commented 9 months ago

The thought makes sense. A note about it in the docs would be useful.

I was just following the Subsonic API docs, which specify passing milliseconds. And “time” instead of “listenTime”.

Very useful library, though. Thanks for putting it together.