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

Hydrus crashes on audio files #1007

Closed
ShadowJonathan opened this issue Nov 15, 2021 · 4 comments
Closed

Hydrus crashes on audio files #1007

ShadowJonathan opened this issue Nov 15, 2021 · 4 comments

Comments

@ShadowJonathan
Copy link

ShadowJonathan commented Nov 15, 2021

Hydrus version

461

Operating system

Windows 11

Install method

Installer

Install and OS comments

Additional about description:

image

Bug description and reproduction

Hydrus displays tracebacks and occasionally crashes when playing back audio files.

This is one of the audio files; https://cdn.discordapp.com/attachments/895293596662648841/909943250637430784/4db10e133c372f2954805c44766d4eca75475c775355022a8720dad5ab40e801.flac

Log output

TypeError
unsupported operand type(s) for -: 'NoneType' and 'int'
  File "hydrus\client\gui\canvas\ClientGUICanvasMedia.py", line 866, in paintEvent
    self._Redraw( painter )
  File "hydrus\client\gui\canvas\ClientGUICanvasMedia.py", line 630, in _Redraw
    self._last_drawn_info = self._GetAnimationBarStatus()
  File "hydrus\client\gui\canvas\ClientGUICanvasMedia.py", line 589, in _GetAnimationBarStatus
    return self._media_window.GetAnimationBarStatus()
  File "hydrus\client\gui\ClientGUIMPV.py", line 301, in GetAnimationBarStatus
    current_frame_index = min( current_frame_index, num_frames - 1 )
@ShadowJonathan
Copy link
Author

(I'm reporting this bug by proxy for a friendo, in case y'all want additional info)

@floogulinc
Copy link
Collaborator

floogulinc commented Nov 16, 2021

I can confirm this seems to happen with all audio files.

@floogulinc
Copy link
Collaborator

floogulinc commented Nov 16, 2021

This issue seems to come from this line:

current_frame_index = min( current_frame_index, num_frames - 1 )

This line is outside the previous check for if num_frames is None so for files without num_frames, like audio files, it still tries to subtract 1 from None. This line should be moved to inside the else of the previous if and could perhaps be refactored as:

if num_frames is None or num_frames == 1:
                   
    current_frame_index = 0
    
else:
    
    current_frame_index = min( int( round( ( current_timestamp_ms / self._media.GetDuration() ) * num_frames ) ), num_frames - 1 )


current_timestamp_ms = min( current_timestamp_ms, self._media.GetDuration() )

@hydrusnetwork
Copy link
Owner

Thank you for this report--I am very sorry for the trouble! It is fixed for tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants