openaudible / openaudible_docker

Run OpenAudible from a container and use it with a web browser
32 stars 11 forks source link

Books with umlauts couldn't be downloaded #7

Closed 9Mad-Max5 closed 2 years ago

9Mad-Max5 commented 2 years ago

Hi,

Books with German umlauts like ä, ö and ü can't be downloaded. I use the here mentioned docker container.

Errormessage

INFO: Download failed:/config/OpenAudible/tmp/Wie der König von Elfenheim lernte, Geschichten zu hassen.AAX_-497463167.part Wie der König von Elfenheim lern progress: null failed downloading /config/OpenAudible/tmp/Wie der König von Elfenheim lernte, Geschichten zu hassen.AAX_-497463167.part bytes= 153781007
WARNING: Error downloading, will try again: Wie der König von Elfenheim lernte, Geschichten zu hassen.AAX attempt 2
May 24, 2022 3:06:21 PM org.openaudible.download.DownloadJob download
HTTP/1.1 416 Requested Range Not Satisfiable
    at org.openaudible.download.DownloadJob._download(DownloadJob.java:187)
    at org.openaudible.download.DownloadJob.checkResponse(DownloadJob.java:302)
    at org.openaudible.download.DownloadJob.download(DownloadJob.java:123)
    at org.openaudible.download.DownloadAAXJob.processJob(DownloadAAXJob.java:212)
May 24, 2022 3:06:32 PM org.openaudible.download.DownloadJob _download
    at org.openaudible.util.queues.ThreadedQueue$JobThread.run(ThreadedQueue.java:516)
May 24, 2022 3:06:52 PM org.openaudible.download.DownloadJob _download
WARNING: Error downloading, will try again: Wie der König von Elfenheim lernte, Geschichten zu hassen.AAX attempt 3
May 24, 2022 3:06:32 PM org.openaudible.download.DownloadJob download

As I read in the openaudible issues that there has been an issue with the local settings, I looked up the one in the container. Those are the one set here:

LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

So there should be now issues at all...

But I just can't download the books.

openaudible commented 2 years ago

Go to Help: Diagnostics and look at "Properties" and make sure file.encoding and file.encoding are set to UTF-8.

"file.encoding": "UTF-8", "sun.jnu.encoding": "UTF-8",

9Mad-Max5 commented 2 years ago

"file.encoding": "UTF-8", But "sun.jnu.encoding": "ANSI_X3.4-1968",

Not a single idea where this comes from or how to resolve it.

openaudible commented 2 years ago

I made a change to the docker file, adding a

# Make sure file encoding will be set to UTF-8.
COPY --from=debian:9.11 /usr/lib/locale /usr/lib/locale

Are you able to test by building from git/docker (rather than just docker pull)

9Mad-Max5 commented 2 years ago

I build it on my own but still running in to the same issue.

openaudible commented 2 years ago

Hmm.

Be sure to git pull and make sure the change above is in the Dockerfile. Also, add:

ENV sun.jnu.encoding UTF-8
ENV file.encoding UTF-8

And see if the settings are different.

The installer should set the sun.jnu.encoding to UTF-8, which is why it shouldn't really be needed to be set as an environment variable. So I'm a bit confused since I can't reproduce it.

9Mad-Max5 commented 2 years ago

Those env are set but openaudible still sticks to "sun.jnu.encoding": "ANSI_X3.4-1968",.

openaudible commented 2 years ago

Very strange. Try quitting the OpenAudible application inside the browser. Then right-click the desktop, select "Open Terminal Here" Then

/config/OpenAudible/debug_linux.sh

and see if you see a warning about jnu encoding on startup.

9Mad-Max5 commented 2 years ago

Sorry, but the container don't have a debug_linux.sh. Not at all...

openaudible commented 2 years ago

Inside the container is a full linux OS.. There should be a directory within that called /config/OpenAudible Try opening the GUI terminal inside the web browser and running:

sh /config/OpenAudible/debug_linux.sh
9Mad-Max5 commented 2 years ago

In my container, there is no debug_linux.sh.

Do I need to pull it again or where should this shell be?

abc@7f56d1f484dd ~ $ ls -la /config/OpenAudible/
total 116
drwxrwxrwx+  7 abc 911  4096 Jun 10 16:27 .
drwxr-xr-x  13 abc abc  4096 Jun 10 16:26 ..
drwxrwxrwx+  2 abc 911  4096 Feb  1 12:09 aax
drwxrwxrwx+  2 abc 911  4096 Feb  1 12:09 art
drwxrwxrwx+  2 abc 911  4096 Feb  1 12:09 books
-rw-rw-rw-+  1 abc 911 12231 Jun 10 16:26 credentials.json
-rw-rw-rw-+  1 abc 911   157 Feb  1 16:10 directories.json
-rw-rw-rw-+  1 abc 911    55 Jun 10 16:26 keys.json
-rw-rw-rw-+  1 abc 911   688 May 24 14:14 license.json
-rw-rw-rw-+  1 abc 911   553 May 29 15:56 settings.json
-rw-rw-rw-+  1 abc 911    49 Nov  8  2021 stats.json
drwxrwxrwx+  2 abc 911  4096 Jun 10 16:27 tmp
drwxrwxrwx+  2 abc 911  4096 Oct  6  2021 web
-rw-rw-rw-+  1 abc 911   380 Jun 10 16:27 windows.json
openaudible commented 2 years ago

Oh, sorry. Looks like I got the directory wrong:

cd /usr/local/OpenAudible
sh debug_linux.sh

Towards the beginning of the output will be the java info and "starting OpenAudible... with any warnings about utf-8

9Mad-Max5 commented 2 years ago

Ah, this looks a lot better.

Like you said, here is the expected warning about the format. But is still have no clue how to fix it.

Jun 13, 2022 4:30:56 PM org.openaudible.desktop.swt.gui.GUI <init>
INFO: Starting OpenAudible build 3.5.5 for gtk swt 4944 jvm 18.0.1
WARNING: File System Not Set to UTF-8:
file.encoding=UTF-8, sun.jnu.encoding=ANSI_X3.4-1968

(java:1489): dbind-WARNING **: 16:31:05.200: AT-SPI: Error retrieving accessibility bus address:  org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
SWT SessionManagerDBus: Failed to RegisterClient: Timeout was reached
openaudible commented 2 years ago

That is super strange.

Here is a fix I found but haven't tried... Add this to the Dockerfile

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
    dpkg-reconfigure --frontend=noninteractive locales && \
    update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8 

or run from the web GUI terminal:

sudo apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales
sudo sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
    sudo dpkg-reconfigure --frontend=noninteractive locales && \
    sudo update-locale LANG=en_US.UTF-8
ENV LANG en_US.UTF-8 
9Mad-Max5 commented 2 years ago

Ok, so I tried all those things as well. And additionally, all other things I found with google. So this:

RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
    locale-gen
ENV LANG en_US.UTF-8  
ENV LANGUAGE en_US:en  
ENV LC_ALL en_US.UTF-8

and this

COPY --from=debian:9.11 /usr/lib/locale /usr/lib/locale
ENV LANG=C.UTF-8
openaudible commented 2 years ago

Maybe your docker is out of date?

docker --version
Docker version 20.10.2, build 20.10.2-0ubuntu1~18.04.2

Or maybe update your linux?

What linux are you running? Is there an ISO for it? What region/language did you specify when you set up your linux?

9Mad-Max5 commented 2 years ago

I think there has been an issue with the configuration. There had been some leftovers from previous docker container versions that had ruined the settings. After I removed them, went through the whole setup process again, everything is working. I'm not sure on which container change it had been, but I think the folder structure could lead to this issues even in the future...