geigi / cozy

🎧 Listen to audio books 📚 on Linux
https://cozy.sh
GNU General Public License v3.0
1.09k stars 84 forks source link

MPRIS: Fix seek actions to correctly move the specified amount of time #782

Closed grahamvh closed 8 months ago

grahamvh commented 1 year ago

Hello! This fixes the issue where MPRIS seek calls would cause cozy to skip ahead to the next chapter #781 Found that there was another function that basically already did what was needed for seeking in MPRIS, and thus co-opted and modified it to work for both purposes.

Perhaps it would be better to chase why self._player.position returns seemingly random numbers. However, it seemed more prudent to just reuse existing code for this purpose.

Let me know your thoughts, happy to throw this away and go a different direction. (Disclaimer: I'm a newbie to contributing to open source)

rdbende commented 8 months ago

So the problem was, that while Player.position expects seconds in the setter, it returns nanoseconds from it's getter. I fixed this and a couple of other issues in #820

geigi commented 8 months ago

Firstly, thanks for your PR :) And thanks @rdbende for finding the cause of this bug. As PR #820 is also fixing this bug I'm going to close this one as it creates additional complexity e.g. in the seek function. We should definitely look into streamlining the getter and setters of the Player.position. But thanks again for looking into it @grahamvh