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

Mpris Player position is being updated automatically #122

Open
1 task done
TanR314 opened this issue Jan 22, 2025 · 6 comments · May be fixed by #160
Open
1 task done

Mpris Player position is being updated automatically #122

TanR314 opened this issue Jan 22, 2025 · 6 comments · May be fixed by #160
Labels
bug Something isn't working
Milestone

Comments

@TanR314
Copy link
Contributor

TanR314 commented Jan 22, 2025

Already reported ? *

  • I have searched the existing open and closed issues.

Regression?

Yes

System Information

Traceback (most recent call last):
 File "/usr/bin/ignis", line 5, in <module>
   main()
   ~~~~^^
 File "/usr/lib/python3.13/site-packages/ignis/main.py", line 12, in main
   cli(prog_name="ignis")
   ~~~^^^^^^^^^^^^^^^^^^^
 File "/usr/lib/python3.13/site-packages/click/core.py", line 1157, in __call__
   return self.main(*args, **kwargs)
          ~~~~~~~~~^^^^^^^^^^^^^^^^^
 File "/usr/lib/python3.13/site-packages/click/core.py", line 1078, in main
   rv = self.invoke(ctx)
 File "/usr/lib/python3.13/site-packages/click/core.py", line 1688, in invoke
   return _process_result(sub_ctx.command.invoke(sub_ctx))
                          ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
 File "/usr/lib/python3.13/site-packages/click/core.py", line 1434, in invoke
   return ctx.invoke(self.callback, **ctx.params)
          ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/usr/lib/python3.13/site-packages/click/core.py", line 783, in invoke
   return __callback(*args, **kwargs)
 File "/usr/lib/python3.13/site-packages/ignis/cli.py", line 146, in systeminfo
   print(get_systeminfo())
         ~~~~~~~~~~~~~~^^
 File "/usr/lib/python3.13/site-packages/ignis/cli.py", line 32, in get_systeminfo
   return f"""{get_version_message()}
               ~~~~~~~~~~~~~~~~~~~^^
 File "/usr/lib/python3.13/site-packages/ignis/cli.py", line 23, in get_version_message
   Branch: {Utils.get_ignis_branch()}
            ~~~~~~~~~~~~~~~~~~~~~~^^
 File "/usr/lib/python3.13/site-packages/ignis/utils/get_ignis_version.py", line 55, in get_ignis_branch
   from ignis.__commit__ import __branch__  # type: ignore
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "/usr/lib/python3.13/site-packages/ignis/__commit__.py", line 3
   __commit_msg__ = "fix(tray): add icon theme of item to search path (#120)

I don't know why is this happening

Description

Image
Okay so I ran a code to print the position of mpris player, then I paused it.
However, position is still being updated and printed

( Sorry, I mistakenly issued this in your dotfiles repo first )

How to reproduce

I guess it should be reproduced if you try to print the position by binding it

Logs, images, videos, config files, CSS/SCSS files

No response

@TanR314 TanR314 added the bug Something isn't working label Jan 22, 2025
@lost-melody
Copy link

lost-melody commented Jan 23, 2025

ignis systeminfo fails because __commit__.py was generated with incorrect string syntax. You need to fix it like this: __commit_msg__ = """ xxx """.

sorry I misunderstood it, so I folded my comments here.

MprisPlayer sync position by an infinite loop:

    @Utils.run_in_thread
    def __sync_position(self) -> None:
        while True:
            position = self.__player_proxy.Position
            if position:
                self._position = position // 1_000_000
                self.notify("position")
            time.sleep(1)

so you'll need to compare it with the earlier value before printing:

self._position = player.get_position()
def print_and_return(pos: int):
    if pos != self._position:
        self._position = pos
        print("position changed:", pos)
        return f"{pos}"
Widget.Label(label=player.bind("position", print_and_return))

and, yes, I agree that this should be done by the MprisPlayer.

@linkfrg
Copy link
Owner

linkfrg commented Jan 23, 2025

ignis systeminfo fails because __commit__.py was generated with incorrect string syntax. You need to fix it like this: __commit_msg__ = """ xxx """.

Thanks for the tip! Fixed in 77b16d7

@linkfrg
Copy link
Owner

linkfrg commented Jan 23, 2025

I can reproduce with firefox, but can't with spotify.

 @Utils.run_in_thread
    def __sync_position(self) -> None:
        while True:
            position = self.__player_proxy.Position
            print(position)  # here
            if position:
                self._position = position // 1_000_000
                self.notify("position")
            time.sleep(1)

If you try to print a position value directly from D-Bus, you will get the same problem (in case firefox).
The same if you try to get the position using D-Spy, firefox updates it by itself.
So, I have no idea how to fix this, this issue is on firefox side.

@TanR314
Copy link
Contributor Author

TanR314 commented Jan 23, 2025

Yeah, I am also getting this problem on Zen-browser only 😢

@linkfrg
Copy link
Owner

linkfrg commented Jan 23, 2025

ignis systeminfo fails because __commit__.py was generated with incorrect string syntax. You need to fix it like this: __commit_msg__ = """ xxx """.

Thanks for the tip! Fixed in 77b16d7

finally fixed in a998164

@linkfrg linkfrg added this to the v0.5 milestone Feb 11, 2025
@linkfrg
Copy link
Owner

linkfrg commented Feb 22, 2025

I found a workaround for this in #160, could you test it?
However, on a fresh start of Ignis, the position will be wrong anyway, because firefox provides the wrong value.
#160 only makes MprisPlayer ignore updated position if the player is paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants