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

Foobar2000: Reporting the remaining time (Control Shift R) on a file that is over 1 day long produces an error. #14127

Closed
masonasons opened this issue Sep 12, 2022 · 4 comments · Fixed by #14570
Labels
good first issue github features these at https://github.com/nvaccess/nvda/contribute p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Milestone

Comments

@masonasons
Copy link

Steps to reproduce:

1: Find an audio file that is over a day long.
2. Open it in foobar2000.
3. In the foobar2000 window, press control shift R.

Actual behavior:

Nothing is spoken, and an error is appended to the log as follows.

ERROR - scriptHandler.executeScript (21:52:20.186) - MainThread (7396):
error executing script: <bound method AppModule.script_reportRemainingTime of <'foobar2000' (appName 'foobar2000', process ID 11520) at address 85c92b0>> with gesture 'ctrl+shift+r'
Traceback (most recent call last):
File "scriptHandler.pyc", line 216, in executeScript
File "appModules\foobar2000.pyc", line 81, in script_reportRemainingTime
File "appModules\foobar2000.pyc", line 41, in parseIntervalToTimestamp
File "_strptime.pyc", line 571, in _strptime_time
File "_strptime.pyc", line 359, in _strptime
ValueError: time data '2d 8:56:36' does not match format '%H:%M:%S'

Expected behavior:

NVDA should speak the remaining time as days:hours:minutes:seconds if applicable, else hours:minutes:seconds

NVDA logs, crash dumps and other attachments:

System configuration

NVDA installed/portable/running from source:

NVDA Installed

NVDA version:

2022.2

Windows version:

Windows 10 21H2 (64-bit) build 19044.1889

Name and version of other software in use when reproducing the issue:

Foobar2000 Version 1.6.11

Other information about your system:

Other questions

Does the issue still occur after restarting your computer?

Yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

Yes, this has been happening ever since the keyboard shortcuts for foobar2000 were added.

If NVDA add-ons are disabled, is your problem still occurring?

Yes

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Yes

@seanbudd seanbudd added triaged Has been triaged, issue is waiting for implementation. p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority good first issue github features these at https://github.com/nvaccess/nvda/contribute labels Sep 12, 2022
@saurabhanand03
Copy link
Contributor

Hi, can I work on this issue?

@seanbudd
Copy link
Member

@saurabhanand03 please do

@saurabhanand03
Copy link
Contributor

@seanbudd Hi, sorry for the delay in getting back to you, which file has the code to edit? Also, where is the "log" mentioned in the issue?

@trypsynth
Copy link
Contributor

@saurabhanand03, its under the actual behavior heading. The error is:
ERROR - scriptHandler.executeScript (21:52:20.186) - MainThread (7396):
error executing script: <bound method AppModule.script_reportRemainingTime of <'foobar2000' (appName 'foobar2000', process ID 11520) at address 85c92b0>> with gesture 'ctrl+shift+r'
Traceback (most recent call last):
File "scriptHandler.pyc", line 216, in executeScript
File "appModules\foobar2000.pyc", line 81, in script_reportRemainingTime
File "appModules\foobar2000.pyc", line 41, in parseIntervalToTimestamp
File "_strptime.pyc", line 571, in _strptime_time
File "_strptime.pyc", line 359, in _strptime
ValueError: time data '2d 8:56:36' does not match format '%H:%M:%S'
That should tell you what file to edit :)

seanbudd added a commit that referenced this issue Feb 13, 2023
Fixes #14127
Supersedes #14451

Summary of the issue:
When using the foobar2000 audio player, the ctrl+shift+r command should report the remaining time in the audio file in the SS, MM:SS, HH:MM:SS, or D HH:MM:SS format depending on the remaining time length.
However, using the command on audio files over a day long produces an error as the code attempts to read the time string in the HH:MM:SS format instead of the D HH:MM:SS format.

Description of user facing changes
Time calculation is now processed correctly for all audio length up to 31 days. After this point, it is uncertain how foobar reports time.

In addition to fixing the time calculations, the spoken UI message was also amended to say "[time] total", "[time] elapsed", or "[time] remaining", rather than just "[time]" so as to be more understandable for the listener.

Description of development approach
Created a collection of translatable time string output formats.

Created a generic way to parse timedeltas to localised formatted strings.

Created internal functions for foobar appModule to parse foobar time strings to localised formatted strings.

---------

Co-authored-by: saurabhanand03 <asaurabh2003@gmail.com>
@nvaccessAuto nvaccessAuto modified the milestone: 2023.1 Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue github features these at https://github.com/nvaccess/nvda/contribute p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Projects
None yet
5 participants