MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   KOReader (https://www.mobileread.com/forums/forumdisplay.php?f=276)
-   -   Save the cover as an image file when loading a document (https://www.mobileread.com/forums/showthread.php?t=332401)

Winkelschraube 08-17-2020 06:33 AM

Save the cover as an image file when loading a document
 
How can I specify that when a document is opened, the cover is saved as an image file with a fixed name?

Frenzie 08-17-2020 10:27 AM

I don't think you can. Is that an option in another program?

Ken Maltby 08-17-2020 10:58 AM

It would be helpful if you could describe how you wanted to use the image/file. You can take a screenshot that will be saved as a .png, with a name Reader_date_time.
When you take a successful screenshot, you are given where the snapshot png is stored and offered an option to set it as the screensaver. (The option won't work if the OS on your device manages the screensaver function, like Android does on my note 2.)

Luck;
Ken

Winkelschraube 08-17-2020 11:33 AM

Hello my friend. :)

I want to make a screensaver from the cover. I have an android reader. I can then link to a picture as a screensaver.

Best would be something like /koreader/currentcover.png or something like that.

Winkelschraube 08-17-2020 11:33 AM

Quote:

Originally Posted by Frenzie (Post 4023925)
I don't think you can. Is that an option in another program?

I don't know. :/

pazos 08-17-2020 01:53 PM

See https://github.com/koreader/koreader/issues/5732. It is a non-fixable thing.

You can, of course, hack the code to write the screensaver to a jpg/png file each time a new document is opened. I would suggest to develop that on the emulator, not directly on a android device.

When you manage to modify the code you'll need to import your modified files in the program each time the program is updated. You can use a modified version of https://github.com/koreader/koreader...ation-patterns

Winkelschraube 08-17-2020 06:01 PM

Quote:

Originally Posted by pazos (Post 4024018)
See https://github.com/koreader/koreader/issues/5732. It is a non-fixable thing.

In this case I was asked to write in "/data/...", I just need to get a file like "/koreader/screenshots/currentcover.png".

Quote:

Originally Posted by pazos (Post 4024018)
You can, of course, hack the code to write the screensaver to a jpg/png file each time a new document is opened. I would suggest to develop that on the emulator, not directly on a android device.

When you manage to modify the code you'll need to import your modified files in the program each time the program is updated. You can use a modified version of https://github.com/koreader/koreader...ation-patterns

OoOoOohhh the "rocks flavor" looks very good with the scripts. Now also apart from screensavers.

I'll have a look at the code, but I don't know any Lua. :/

Does KOReader create a log file with the last loaded file?

A suggestion from me would be a script that is executed with every document load.

pazos 08-17-2020 06:36 PM

Quote:

Originally Posted by Winkelschraube (Post 4024121)
Does KOReader create a log file with the last loaded file?

logs are written to console on the emulator and to android log buffer on android (you can retrieve them with adb logcat)

Quote:

Originally Posted by Winkelschraube (Post 4024121)
A suggestion from me would be a script that is executed with every document load.

It doesn't make sense to add hooks everywhere. The program itself is a big hook (it is interpreted). You only need to rewrite the parts of the code you need. In that case the function that's called is https://github.com/koreader/koreader....lua#L537-L585

The scripts there are just for android and made sense because there's no easy way for users to customize the program on that platform.

Winkelschraube 08-18-2020 01:52 PM

Ok the emulator is running. :)

But you're right, Android doesn't take a changing image file as screensaver.

Ken Maltby 08-19-2020 01:51 PM

I didn't know your Kindle PW2 was running under an Android OS, is that something you added yourself?

Winkelschraube 08-20-2020 05:16 AM

It is a poke 2. :D

https://www.mobileread.com/forums/sh...1&postcount=56

elchamaco 08-25-2020 04:26 AM

Quote:

Originally Posted by Frenzie (Post 4023925)
I don't think you can. Is that an option in another program?

Calibre companion.

Frenzie 08-25-2020 04:46 AM

Cool. What do you use it for?

elchamaco 08-25-2020 08:08 AM

Quote:

Originally Posted by Frenzie (Post 4026917)
Cool. What do you use it for?

The same, i write it to folder and the screensaver app of onyx nova shows it when it's in standby.

Frenzie 08-26-2020 06:48 AM

Parts of it would be theoretically quite simple, such as writing whatever you want as the screensaver to a file. But as @pazos said it's not quite clear to me if this isn't too low-level and device specific in a way that would require running the program as root. Please see https://github.com/koreader/koreader/issues/5732 :)


All times are GMT -4. The time now is 10:15 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.