Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 02-26-2019, 02:35 PM   #31
pazos
cosiñeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 1,271
Karma: 2189337
Join Date: Apr 2014
Device: BQ Cervantes 4
Hey @embryo, any plans to make this tool compatible with other OSes? (linux, mac). It shouldn't be too hard to make it work. I don't mean packaging, just running the script with system-wide installed pyside (via pip3).

Thanks for your time!
pazos is offline   Reply With Quote
Old 02-26-2019, 03:40 PM   #32
Frenzie
Wizard
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 1,613
Karma: 724945
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
Looks like the dependency isn't Python 3-compatible:

Code:
KoHighlights-0.5.0.0$ python3 main.py 
Traceback (most recent call last):
  File "main.py", line 17, in <module>
    from slppu import slppu as lua  # https://github.com/noembryo/slppu
  File "/home/frans/src/kobo/KoHighlights-0.5.0.0/slppu.py", line 131
    print ERRORS['unexp_end_string']
               ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(ERRORS['unexp_end_string'])?
But other than that APPDATA thing I suspect it might pretty much just work as is.

Edit: yup, works fine.

Edit 2: except for this when double clicking on a book since os.startfile() is apparently Windows-only:

Code:
$ python main.py 
Traceback (most recent call last):
  File "main.py", line 377, in on_file_table_itemDoubleClicked
    (os.startfile(path) if isfile(path) else
AttributeError: 'module' object has no attribute 'startfile'
You can easily make it a little more generic using something like this (via):
Code:
import os, sys, subprocess

def open_file(filename):
    if sys.platform == "win32":
        os.startfile(filename)
    else:
        opener ="open" if sys.platform == "darwin" else "xdg-open"
        subprocess.call([opener, filename])
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2019-02-26_21-43-25.png
Views:	496
Size:	47.5 KB
ID:	169925  

Last edited by Frenzie; 02-26-2019 at 03:49 PM.
Frenzie is offline   Reply With Quote
Old 02-26-2019, 09:00 PM   #33
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 509
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
@Frenzie Thank you for testing..

I've made the slppu.py python 3.x compatible and also added the function to open the books on other OSes.

What do you mean by "the APPDATA thing"?
EDIT: Ah, you meant the os.environ["APPDATA"] that is used for the SETTINGS_DIR variable...
How about using this:
Code:
if sys.platform == "win32":  # Windows
    SETTINGS_DIR = join(os.environ["APPDATA"], APP_NAME)
elif sys.platform == "darwin":  # MacOS
    SETTINGS_DIR = join(os.path.expanduser("~"), "Library",
                        "Application Support", APP_NAME)
else:  # Linux
    SETTINGS_DIR = join(os.path.expanduser("~"), "." + APP_NAME)
I will upload the changes to github but not compile the 0.6. version yet, since I'm waiting for other KoReader changes (hint-hint ;o)

Last edited by embryo; 02-27-2019 at 06:08 AM.
embryo is offline   Reply With Quote
Old 02-27-2019, 06:17 AM   #34
Frenzie
Wizard
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 1,613
Karma: 724945
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
Apologies, it's what's keeping the program from starting on non-Windows operating systems. I'm talking about this line.

On Linux and Mac that's HOME followed by some stuff (different on both platforms I'm afraid, though HOME would suffice as a rather dumb implementation).

There's a module that abstracts it away for you if desired: https://pypi.org/project/appdirs/
Frenzie is offline   Reply With Quote
Old 02-27-2019, 06:43 AM   #35
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 509
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
Quote:
Originally Posted by Frenzie View Post
There's a module that abstracts it away for you if desired: https://pypi.org/project/appdirs/
Yes, I know, but I'm trying to avoid extra dependencies...

Does it works OK now?
embryo is offline   Reply With Quote
Old 02-27-2019, 08:35 AM   #36
Frenzie
Wizard
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 1,613
Karma: 724945
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
Yes, it now runs fine out of the box, albeit still only in Python 2.7.

Python 3 looks like this:

Code:
Traceback (most recent call last):
  File "main.py", line 29, in <module>
    from gui_main import Ui_Base  # ___ ______ GUI STUFF ________________
  File "/home/frans/src/kobo/KoHighlights-master/gui_main.py", line 265, in <module>
    from main import DropTableWidget
  File "/home/frans/src/kobo/KoHighlights-master/main.py", line 30, in <module>
    from gui_about import Ui_About
  File "/home/frans/src/kobo/KoHighlights-master/gui_about.py", line 106, in <module>
    import images_rc
  File "/home/frans/src/kobo/KoHighlights-master/images_rc.py", line 21, in <module>
    qInitResources()
  File "/home/frans/src/kobo/KoHighlights-master/images_rc.py", line 16, in qInitResources
    QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
TypeError: 'qRegisterResourceData' called with wrong argument types:
  qRegisterResourceData(int, str, str, str)
Supported signatures:
  qRegisterResourceData(int, unicode, unicode, unicode)
On my desktop I got this error when scanning, perhaps because Python 2.7 is a bit weird about Unicode. However, I tracked it to a problematic file on my system called:

Code:
'Hy'$'\366''kk'$'\344''yksen Tiedot.doc'
It's not clear to me why it's problematic, because it sounds like it should just result in ẙ and, um, this one. It's actually supposed to read HYÖKKÄYKSEN. This is how wget saved it in a website mirroring command. Anyway, it doesn't seem like much you could do anything about. Python 3 *might* run into less of a problem. I haven't tried it.

Code:
Traceback (most recent call last):
  File "main.py", line 1925, in process
    self.start_scan()
  File "main.py", line 1929, in start_scan
    for dir_tuple in os.walk(self.path):
  File "/usr/lib/python2.7/os.py", line 296, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/usr/lib/python2.7/os.py", line 296, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/usr/lib/python2.7/os.py", line 296, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/usr/lib/python2.7/os.py", line 296, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/usr/lib/python2.7/os.py", line 296, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/usr/lib/python2.7/os.py", line 296, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/usr/lib/python2.7/os.py", line 286, in walk
    if isdir(join(top, name)):
  File "/usr/lib/python2.7/posixpath.py", line 73, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf6 in position 3: ordinal not in range(128)
As an aside, this line is Windows-only:
Code:
elif dir_path.lower().endswith("koreader\\history")

Last edited by Frenzie; 02-27-2019 at 08:38 AM.
Frenzie is offline   Reply With Quote
Old 02-27-2019, 12:15 PM   #37
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 509
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
Quote:
Originally Posted by Frenzie View Post
Python 3 looks like this:

Code:
Traceback (most recent call last):
  File "main.py", line 29, in <module>
    from gui_main import Ui_Base  # ___ ______ GUI STUFF ________________
  File "/home/frans/src/kobo/KoHighlights-master/gui_main.py", line 265, in <module>
    from main import DropTableWidget
  File "/home/frans/src/kobo/KoHighlights-master/main.py", line 30, in <module>
    from gui_about import Ui_About
  File "/home/frans/src/kobo/KoHighlights-master/gui_about.py", line 106, in <module>
    import images_rc
  File "/home/frans/src/kobo/KoHighlights-master/images_rc.py", line 21, in <module>
    qInitResources()
  File "/home/frans/src/kobo/KoHighlights-master/images_rc.py", line 16, in qInitResources
    QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
TypeError: 'qRegisterResourceData' called with wrong argument types:
  qRegisterResourceData(int, str, str, str)
Supported signatures:
  qRegisterResourceData(int, unicode, unicode, unicode)
Is it python 3 that asks for this? qRegisterResourceData(int, unicode, unicode, unicode)
That's strange.. (no unicode in python 3.x)
Quote:
On my desktop I got this error when scanning, perhaps because Python 2.7 is a bit weird about Unicode. However, I tracked it to a problematic file on my system called:

Code:
'Hy'$'\366''kk'$'\344''yksen Tiedot.doc'
Can you pm me this file? (delete all the contents, I just want the filename and the .sdr if possible)

Quote:
As an aside, this line is Windows-only:
Code:
elif dir_path.lower().endswith("koreader\\history")
Fixed it.

Thank you very much for your tests
embryo is offline   Reply With Quote
Old 02-28-2019, 03:44 AM   #38
Frenzie
Wizard
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 1,613
Karma: 724945
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
Quote:
Originally Posted by embryo View Post
Is it python 3 that asks for this? qRegisterResourceData(int, unicode, unicode, unicode)
That's strange.. (no unicode in python 3.x)
Could be that I or Debian messed up something with the PySide dependencies for Python 3, or just a problem with PySide. I only meant I get that error if I run the program with Python 3.

I'll see if I can get the file with the corrupted name to you. It might be difficult seeing how it's corrupted and all, but I suppose tar should preserve it properly. Anyway, I don't have that file on my laptop.
Frenzie is offline   Reply With Quote
Old 02-28-2019, 06:02 AM   #39
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 509
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
Quote:
Originally Posted by Frenzie View Post
I'll see if I can get the file with the corrupted name to you.
Thank you..
embryo is offline   Reply With Quote
Old 03-01-2019, 04:40 PM   #40
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 509
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
  • Updated to v0.6.1.0
    • Merging the highlights of a book that is read in two different devices is now possible (beta). It must be from the same reader engine though. Read about it here.
    • Syncing the reading position for a book that is read in two different devices is also possible now.
    • We can now edit highlight comments while in the "Highlights" view, using the right-click menu or double clicking.
    • From "Highlights" view, using the right-click menu, we can locate the current highlight to the "Books" view.
    • Changed: When scanning a directory using the "Scan Directory" button, the previously loaded books are not unloaded from the list.
    • Fixed: The same book's metadata are not loaded more than one time any more.
    • Fixed: The book's description text is now read only (as it should).
embryo is offline   Reply With Quote
Old 03-03-2019, 05:04 AM   #41
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 509
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
  • Updated to v0.7.0.0
    • Option to sort highlights by Date or Page (in "Books" view).
embryo is offline   Reply With Quote
Old 03-05-2019, 08:27 AM   #42
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 509
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
Quote:
Originally Posted by Frenzie View Post
Could be that I or Debian messed up something with the PySide dependencies for Python 3, or just a problem with PySide.
Tried to run it with Python 3 and found out that Pyside could not get installed in Python after version 3.4.

I guess after that you need Pyside2..
embryo is offline   Reply With Quote
Old 03-05-2019, 09:04 AM   #43
Frenzie
Wizard
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 1,613
Karma: 724945
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
How do you mean exactly? https://packages.debian.org/source/stretch/pyside

But PySide2/Qt5 would be preferable in the long run in any case.
Frenzie is offline   Reply With Quote
Old 03-05-2019, 07:48 PM   #44
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 509
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
Quote:
Originally Posted by Frenzie View Post
I was trying to install Pyside in a Lubuntu 16.04 VM and I couldn't.
I read somewhere that it was because of "Pyside could not get installed in Python after version 3.4".

I setup another VM (Xubuntu) updated to 18.04 and succeed in installing everything.... and got to the same error as yours
It has to do with the pyside's resource creator (it creates code for Python2).

Bypassed it by not using it and loading the images from the original files.
Got an error from future.moves.urllib.request.URLError, bypassed it ... got another from ...

I'll get there some time in the future
Quote:
But PySide2/Qt5 would be preferable in the long run in any case.
PySide2 needs Python3, and that is a problem for many other libraries or for backwards compatibility (I do have a system with XP on it, that can run all my apps)
I'm a Luddite I know, but I don't want to throw away machines that work fine, just so I can wait more time for loading the newer super duper Word or Photoshop
embryo is offline   Reply With Quote
Old 03-06-2019, 04:31 PM   #45
embryo
Fanatic
embryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbitembryo with a running start, can leap into geosynchronous orbit
 
embryo's Avatar
 
Posts: 509
Karma: 60774
Join Date: Aug 2013
Device: Kobo Glo, GloHD
OK, the updated script should work with Python 2/3 out of the box.
There is a problem with the settings for the position of the window if python3 loads python2's settings file and vice versa, but everything else works.
Even a command-line interface is added.. (never made one before)
embryo is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PRS-T1 T1Mizer(Utility app for T1) fairworld Sony Reader Dev Corner 9 11-16-2017 08:26 AM
PDF: Highlights in images correct, copied text from highlights truncated wonderose Android Devices 0 08-02-2015 11:25 AM
Kindle Previewer (a must have utility) townsend Sigil 3 05-03-2013 12:13 AM
Need unzip utility on iLiad nekokami iRex 5 04-20-2009 03:18 PM
ePub Creation Utility KoopaOne ePub 13 04-30-2008 10:38 AM


All times are GMT -4. The time now is 07:07 AM.


MobileRead.com is a privately owned, operated and funded community.