goldendict-ng icon indicating copy to clipboard operation
goldendict-ng copied to clipboard

"Auto-pronounce words in main window" not work

Open playgithub opened this issue 1 year ago • 16 comments

Version

  • GoldenDict 24.01.22
  • OS archlinux 20204.2.5
  • Desktop KDE Plasma 5.27
  • Dict 牛津高阶英汉双解词典(简体)第8版

Problem

  • "Auto-pronounce words in main window" not work

Others

No problem for Qt 6.7 on Windows 11

playgithub avatar Feb 05 '24 06:02 playgithub

Bot detected the issue body's language is not English, translate it automatically.

Version

  • GoldenDict 24.01.22
  • OS archlinux 20204.2.5
  • Desktop KDE Plasma 5.27 *Dict Oxford Advanced Learner's Dictionary (Simplified) 8th Edition

Problem

  • "Auto-pronounce words in main window" not work

Others

No problem on Windows 11

github-actions[bot] avatar Feb 05 '24 06:02 github-actions[bot]

i had the same problem , they don't work to me

KonstantinDjairo avatar Mar 29 '24 20:03 KonstantinDjairo

Need more information:

  1. manually play the first sound? does it work?
  2. change the audio engine to external player or ffmpeg, does it work?

xiaoyifang avatar Mar 31 '24 01:03 xiaoyifang

  1. manually play the first sound? does it work?

Yes

  1. change the audio engine to external player or ffmpeg, does it work?

No

playgithub avatar Mar 31 '24 02:03 playgithub

I guess the first found audio file by the gd-ng maybe broken.

try to rearrange the first few dictionaries' order

xiaoyifang avatar Mar 31 '24 02:03 xiaoyifang

When using only one dict ("Dict 牛津高阶英汉双解词典(简体)第8版"), the problem still exists.

playgithub avatar Mar 31 '24 03:03 playgithub

Bot detected the issue body's language is not English, translate it automatically.

When using only one dict ("Dict Oxford Advanced Learner's Dictionary (Simplified) 8th Edition"), the problem still exists.

github-actions[bot] avatar Mar 31 '24 03:03 github-actions[bot]

  1. manually play the first sound? does it work?

Yes

  1. change the audio engine to external player or ffmpeg, does it work?

No

exactly the same here.

KonstantinDjairo avatar Apr 02 '24 18:04 KonstantinDjairo

To solve this problem, create a file article-script.js with the following content

window.addEventListener("load", () => {
  setTimeout(() => {
    window.location.href = gdAudioLinks.first;
  }, 0);   
});

and then put into the ~/.goldendict folder.

JingMatrix avatar May 21 '24 07:05 JingMatrix

To solve this problem, create a file article-script.js with the following content

window.addEventListener("load", () => {
  setTimeout(() => {
    window.location.href = gdAudioLinks.first;
  }, 0);   
});

and then put into the ~/.goldendict folder.

I've put it in ~/.config/goldendict, and it works. However, before the audio playing, it takes a longer latency than when translating from clipboard (Ctrl+C, C).

playgithub avatar May 21 '24 07:05 playgithub

The lag depends on your size of dictionaries, if you want to speed up, then you can try to change the time of wait (which is 300 is the example) before goldendict is ready to pronounce:

setTimeout(() => {
  window.location.href = gdAudioLinks.first;
}, 300);

And replace your file with the content above. Warning: too small will stop goldendict from working properly.

JingMatrix avatar May 21 '24 08:05 JingMatrix

Another problem is that when translating from clipboard (Ctrl+C, C) it'll pronounce twice.

playgithub avatar May 21 '24 09:05 playgithub

Another problem is that when translating from clipboard (Ctrl+C, C) it'll pronounce twice.

I cannot reproduce it on my device. Maybe it is because that I setup the shortcut in my sway config instead of relying on goldendict to register a global one.

JingMatrix avatar May 21 '24 10:05 JingMatrix

In my practice, article-script.js works regardless of the options below:

  • Auto-pronounce words in main window
  • Auto-pronounce words in scan popup

It just add an extra auto-pronounce.

playgithub avatar May 21 '24 10:05 playgithub

Yes, exactly. Please thus turn them off.

JingMatrix avatar May 21 '24 14:05 JingMatrix

@JingMatrix , thanks for the fix

I Had to modify the script in case no audio is found:

window.addEventListener("load", () => {
    setTimeout(() => 
    {
      if (gdAudioLinks.first)
        window.location.href = gdAudioLinks.first;
    }, 0);   
  });        

TheNicker avatar Sep 06 '24 13:09 TheNicker