Skip to content
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

Crash with Amberol #28

Open
Leeo97one opened this issue May 28, 2022 · 2 comments
Open

Crash with Amberol #28

Leeo97one opened this issue May 28, 2022 · 2 comments
Labels
upstream An issue with a library or tool we are using

Comments

@Leeo97one
Copy link

When playing audio with Amberol:

2022-05-28 02:12:41,087 | WARNING  | closing connection [discord_rpc.async_]
Traceback (most recent call last):
  File "/usr/bin/discordrp-mpris", line 33, in <module>
    sys.exit(load_entry_point('discordrp-mpris==0.3.2', 'console_scripts', 'discordrp-mpris')())
  File "/usr/lib/python3.10/site-packages/discordrp_mpris/__main__.py", line 341, in main
    loop.run_until_complete(wait_task)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/usr/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
    return fut.result()
  File "/usr/lib/python3.10/site-packages/discordrp_mpris/__main__.py", line 336, in main
    return loop.run_until_complete(main_task)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/usr/lib/python3.10/site-packages/discordrp_mpris/__main__.py", line 329, in main_async
    return await instance.run()
  File "/usr/lib/python3.10/site-packages/discordrp_mpris/__main__.py", line 91, in run
    await self.tick()
  File "/usr/lib/python3.10/site-packages/discordrp_mpris/__main__.py", line 141, in tick
    replacements = self.build_replacements(player, metadata, position, length, state)
  File "/usr/lib/python3.10/site-packages/discordrp_mpris/__main__.py", line 262, in build_replacements
    replacements['length'] = cls.format_timestamp(length)
  File "/usr/lib/python3.10/site-packages/discordrp_mpris/__main__.py", line 288, in format_timestamp
    secs = microsecs // int(1e6)
TypeError: unsupported operand type(s) for //: 'str' and 'int'
@FichteFoll FichteFoll added the upstream An issue with a library or tool we are using label Jun 27, 2022
@ravener
Copy link

ravener commented May 12, 2024

This is due to the fact that Amberol reports the microseconds duration as a string, you just need to handle the case that the length is a string and try to convert it to a number.

Edit: Technically that breaks the spec, I found the root of the issue and so I've reported this upstream: https://gitlab.gnome.org/World/amberol/-/issues/380

@FichteFoll
Copy link
Owner

FichteFoll commented May 13, 2024

Thanks for creating the report. smplayer had a similar issue in that it violated the protocol by transmitting a float instead of an int for the position field (see #7).

We can deploy a similar workaround here, but fixing this upstream is of course preferred and I'd rather spend time on migrating to jeepney as the dbus library instead of dbussy because I found its API to be much cleaner. (That said, since I personally don't use this tool anymore, it has dropped a bit in priority for me.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream An issue with a library or tool we are using
Projects
None yet
Development

No branches or pull requests

3 participants