Bug 30452 - Lutris does not update Last Played or Time Played
Summary: Lutris does not update Last Played or Time Played
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Rémi Verschelde
QA Contact:
URL: https://github.com/lutris/lutris/issu...
Whiteboard: MGA8TOO
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-19 19:16 CEST by Kevin Bulgrien
Modified: 2022-05-19 22:09 CEST (History)
1 user (show)

See Also:
Source RPM: lutris-0.5.8.4-1.mga8.src.rpm
CVE:
Status comment:


Attachments

Description Kevin Bulgrien 2022-05-19 19:16:48 CEST
Description of problem:

When using Lutris to launch programs, Last Played and Time Played do not work anymore.  The most recent "Last Played" time on my system is from 2021 or so.

Version-Release number of selected component (if applicable):

Version     : 0.5.8.4
Release     : 1.mga8

How reproducible:

Install Lutris.  Install an application.  Run the application.  Stop the application.  Note that neither Last Played or Time Played  for that application updates.

Steps to Reproduce:
1. Run "lutris" in a terminal.
2. Start an application from within lutris.
3. Stop the application.
4. Notice in the terminal:

Traceback (most recent call last):
  File "/home/devel/lutris/lutris-0.5.10.1/lutris/game.py", line 665, in beat
    self.on_game_quit()
  File "/home/devel/lutris/lutris-0.5.10.1/lutris/game.py", line 691, in on_game_quit
    self.stop()
  File "/home/devel/lutris/lutris-0.5.10.1/lutris/game.py", line 679, in stop
    self.stop_game()
  File "/home/devel/lutris/lutris-0.5.10.1/lutris/game.py", line 639, in stop_game
    self.playtime += self.timer.duration / 3600
TypeError: can only concatenate str (not "float") to str

This problem exists upstream, and is even present in the latest github release (5.10.1).  I have filed a bug report here:

https://github.com/lutris/lutris/issues/4289

Regardless, the following fixes the issue in the current Mageia release:

--- /usr/lib/python3.8/site-packages/lutris/game.py.orig        2021-07-02 20:01:47.000000000 -0500
+++ /usr/lib/python3.8/site-packages/lutris/game.py     2022-05-19 10:10:51.971704905 -0500
@@ -511,7 +511,7 @@
         self.emit("game-stop")
         if not self.timer.finished:
             self.timer.end()
-            self.playtime += self.timer.duration / 3600
+            self.playtime += str(self.timer.duration / 3600)

     def prelaunch_beat(self):
         """Watch the prelaunch command"""
Comment 1 Kevin Bulgrien 2022-05-19 19:19:20 CEST
Sorry, wrong patch above.  The correct patch is:

1:47.000000000 -0500
+++ /usr/lib/python3.8/site-packages/lutris/game.py     2022-05-19 12:19:00.658956942 -0500
@@ -511,7 +511,7 @@
         self.emit("game-stop")
         if not self.timer.finished:
             self.timer.end()
-            self.playtime += self.timer.duration / 3600
+            self.playtime = str(float(self.playtime) + self.timer.duration / 3600)

     def prelaunch_beat(self):
         """Watch the prelaunch command"""
Comment 2 Kevin Bulgrien 2022-05-19 19:25:52 CEST
Apparently I have trouble copy/pasting, but the patch is still readable.

In any event, in and expansion of the upstream source tarball, the fix goes into the lutris/game.py file.

Be aware the current upstream release (0.5.10.1) also has the bug, but I have tested this patch on both the upstream release and in the current Mageia 8 package.
Kevin Bulgrien 2022-05-19 19:26:38 CEST

Version: Cauldron => 8

Kevin Bulgrien 2022-05-19 19:27:00 CEST

CC: (none) => kbulgrien

Comment 3 Kevin Bulgrien 2022-05-19 19:38:18 CEST
This would affect Cauldron as well, since the bug is still present in the upstream top-of-tree and has been there for (3) years:

https://github.com/lutris/lutris/blob/master/lutris/game.py

https://github.com/lutris/lutris/commit/68d7fade47a21968f947c5403f5aa6bc46942b12
Comment 4 Kevin Bulgrien 2022-05-19 19:45:50 CEST
The actual regression occurs here on Jan 19, 2019:

https://github.com/lutris/lutris/commit/d3ee298ef387cfc300b000d5d3359ae781e2dee2
Comment 5 Lewis Smith 2022-05-19 22:09:04 CEST
Thank you for the fulsome report: not just the fault, but the upstream bug, and your own correction (comment 1, comment 2) - which presumably they will apply.

lutris is looked after by Rémi, so assiging this to you.

Whiteboard: (none) => MGA8TOO
Version: 8 => Cauldron
Assignee: bugsquad => rverschelde


Note You need to log in before you can comment on or make changes to this bug.