![]() |
#16 | ||
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 248
Karma: 892441
Join Date: Jul 2010
Device: K2i
|
Quote:
![]() Replace the "synchronize" line in the menu.json file with: Code:
{"name": "[ Synchronize ]", "priority": 1, "action": "lipc-set-prop com.lab126.cmd wirelessEnable 1 && sleep 7 && /mnt/us/python/bin/python2.7 /mnt/us/extensions/dropbox/bin/dbcli.py && lipc-set-prop com.lab126.cmd wirelessEnable 0"}, ![]() If trap000d some day would want to work on a better implementation, I'd not be opposed to that. ![]() Also thank you @knc1 for pointing me in the right direction. ![]() |
||
![]() |
![]() |
![]() |
#17 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
In Aerospace Science, any landing that you can walk away from is a good landing.
In Computer Science, any scripted solution that works is a good solution. |
![]() |
![]() |
Advert | |
|
![]() |
#18 | |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 23
Karma: 8028
Join Date: Sep 2016
Device: Kindle PW1
|
Hi Notimp,
I've added WiFi automatic on/off commands to the code. Available at master in repository https://github.com/trap000d/dropbox-...ive/master.zip It has not tested yet (no Kindle on hand) so the code might work or not. Also this hardcoded solution might break someone's preferences: what if somebody would like to keep their WiFi connection active all the time ? I could add another key into config, e.g. "autowifi=1" will activate wireless OR. (what looks even better) I can check if connection is active, remember the state, enable it if not active, and restore the original state at the end. Something like 'host dropbox.com' or 'ping -c 1 dropbox.com' should work, thought. P.S. Unfortunately, for several next days I'll have no time for this (come back home only after Xmas) Regards, Quote:
|
|
![]() |
![]() |
![]() |
#19 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 248
Karma: 892441
Join Date: Jul 2010
Device: K2i
|
I'd vote for making it opt in as well - just in case.
Although the ping check and "return to initial state" solution sounds like it should very much cover all fronts... The only thing anyone could "loose" that way would be a fall back in case he "didn't mean to connect" at that time - although, I'd say those cases should be fairly limited - as digging into KUAL, your app, and pressing the sync button is a pretty strong sign of intent. ![]() I'll test your github build asap - you'll get the feedback on it in two minutes. Last edited by notimp; 12-21-2016 at 11:45 AM. |
![]() |
![]() |
![]() |
#20 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 248
Karma: 892441
Join Date: Jul 2010
Device: K2i
|
The github script above currently doesnt work. The issue is that after you switch Wifi on - it takes a few seconds until the Kindle connects to your network, and gets online - the script at that stage already is in the "connecting" stage - ("connecting" gets displayed) and seemingly not reinitializing the connection attempt, but just sitting idle/timing out.
Thats why I had the sleep 7 (sleep 6 should suffice as well ![]() ![]() Cheers, n. Last edited by notimp; 12-21-2016 at 11:44 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#21 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Doesn't the system have a 'wait for wireless' lipc event?
(Don't waste too much time on that, I might have it confused with systemd.) |
![]() |
![]() |
![]() |
#22 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 248
Karma: 892441
Join Date: Jul 2010
Device: K2i
|
Created .bat files for Windows (Linux and OSX users look at page 1 to find a bash script that does the same
![]() Just drag/drop an .epub onto the booksync2drop.bat file to start the process. ![]() Prerequisites: Calibre with the Calibre Plugin "Modify ePub" installed Python (tested with version 2.7) https://www.python.org/downloads/windows/ lxml (version has to fit the python install above (!), f.e. 2.7 - also 32 or 64 bit has to fit as well) https://pypi.python.org/pypi/lxml/3.3.5#downloads kindle-hyphens (just download the repo as a .zip file and unzip it to C:\kindle-hyphens\ Attention! The folder path is not optional. Please copy the .zips contents (the individual files - not the files nested in another folder) to C:\kindle-hyphens\ and no where else.) https://github.com/dmalinovsky/kindle-hyphens - In the kindle-hyphens folder, create a subfolder named out (and don't navigate into it for the time being.. ![]() Then create a bat file in the kindle-hyphens folder (important!), name it rename.bat (important!) and copy the following text into it (using a text editor): Code:
@echo off setlocal EnableDelayedExpansion set preserve=abcdefghijklmnopqrstuvwxyz 1234567890 for %%a in (%0\..\out\*.azw3) do ( set "filename=%%~Na" call :RemoveChars filename newFilename= if "!newFilename!" neq "%%~Na" ren "%%a" "!newFilename!%%~Xa" ) goto :EOF :RemoveChars filename newFilename= set %2= :nextChar set "char=!%1:~0,1!" if "!preserve:%char%=!" neq "%preserve%" set "%2=!%2!%char%" set "%1=!%1:~1!" if defined %1 goto nextChar exit /B Then create a .bat file in a folder of your choice (f.e on the Desktop). This will become your drag/drop target for the .epub. Rename it to booksync2drop.bat and copy the following text into it (using a text editor): Code:
@echo off :ask echo Is this an english epub? set INPUT= set /P INPUT=Type y/n: %=% If /I "%INPUT%"=="y" goto yes If /I "%INPUT%"=="n" goto no :yes goto english :no goto other :english start /wait ebook-meta %1 --language en start /wait calibre-debug -e "C:\kindle-hyphens\main.py" %1 "%~n1_temp.epub" start /wait ebook-convert "%~n1_temp.epub" "%~n1.azw3" --change-justification justify goto fin :other start /wait calibre-debug -e "C:\kindle-hyphens\main.py" %1 "%~n1_temp.epub" start /wait ebook-convert "%~n1_temp.epub" "%~n1.azw3" --change-justification justify goto fin :fin del "%~n1_temp.epub" move "%~n1.azw3" "C:\kindle-hyphens\out\%~n1.azw3" call "C:\kindle-hyphens\rename.bat" move "C:\kindle-hyphens\out\*.azw3" "%HOMEPATH%\Dropbox\Books\" echo Script has finished. echo The .azw3 should now be in the Dropbox\Books\ folder. pause exit Create a folder named Books in your Dropbox folder. Make sure your Dropbox folder resides in \Users\USERNAME\Dropbox\ (the .bat script expects it there, if it isn't you have to change/rewrite the script) - and you are good to go. Drag an .epub file onto the booksync2drop.bat to start. Also - if you want to, you could change the default (fallback) language in the kindle-hyphens main.py to english (en) or german (de), or any other language supported by kindle-hyphens (the default is russian (ru)) - if you do so, it is recommended that you use Notepad++ (https://notepad-plus-plus.org/) to do it, in case there are whitespace formating issues (Windows doesn't like unix whitespaces - but this editor can handle it.). and you can rewrite the booksync2drop.bat to ask if the book you are converting is german (or any other language supported by kindle-hyphens) and force the script to set a german language tag, before kindle-hyphens gets fed the .epub By default I am forcing an english language tag here - but the script was originally written with english set as the fallback language in the main.py and a different language that could be set at the yes/no prompt - in mind. So effectively you could make it work for two languages. (Don't forget to change the start /wait ebook-meta %1 --language en line to the language of your choice if you want to go that route... ![]() You can then point the Dropbox client on the Kindle to sync the /Books/ folder - and voila, hyphenated azw3s on your Kindle in seconds. ![]() Last edited by notimp; 12-22-2016 at 07:58 AM. |
![]() |
![]() |
![]() |
#23 | |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 23
Karma: 8028
Join Date: Sep 2016
Device: Kindle PW1
|
Hi,
I've added "smart" wireless handling to the script: at start it's checking connection availability then switching wifi on if needed. At the end it restores initial state of connection. Pushed new version to master (download link is the same as before: https://github.com/trap000d/dropbox-...ive/master.zip ). Please test it and let me know if you find any problems. If all OK, I'll tag it as v0.1.3 P.S. TODO (next 2-3 weeks, depending on free time). I'm to add 'replace-incorrect-characters-in-file-name' feature. It should effectively resolve all problems with non-Unicode symbols (like German umlauts, or other characters not supported by FAT, e.g. ':' '#' '?' e.t.c.) in file names. Regards, Quote:
|
|
![]() |
![]() |
![]() |
#24 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 248
Karma: 892441
Join Date: Jul 2010
Device: K2i
|
Works. Yay.
![]() Also, thank you for looking into the non standard character issue in the future. edit: As a (very) small note on presentation, I really don't like the ...... "progression" indicator in the text output. It feels "messy", especially because it stays on during the connected stage. On an eReader it reads as "grammatically wrong" (syntax) - its partly an OCD thing and I could "fix it" myself - but I'm offering it up as feedback - in case you'd want to rethink it. I understand that it has some value in visualizing progression. (edit: Havent looked into the script yet - if it is something the framework produces as a byproduct and you havent put in distinctly, please ignore the comment. ![]() Also - let me state that its a shame how few people have downloaded the script on mobileread so far - its the best delivery mechanism I've found on the Kindle so far. It makes using the Kindle with services like dotepub (google it, I have no interest in popularizing it too much.. ![]() I'm still using it daily - its a game changer. (And if you have privacy concerns, you can use the seafile offshoot. ) Last edited by notimp; 12-27-2016 at 06:33 PM. |
![]() |
![]() |
![]() |
#25 | |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 23
Karma: 8028
Join Date: Sep 2016
Device: Kindle PW1
|
That's good.
As for dotted progress line, I've added it mostly for debug purposes (just to view how much time it takes). Indeed, it's annoying so I'll remove this 'feature' in release (tomorrow, as I need to synchronize code with Seafile client too). Quote:
|
|
![]() |
![]() |
![]() |
#26 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 23
Karma: 8028
Join Date: Sep 2016
Device: Kindle PW1
|
New version 0.1.3
See the thread start
|
![]() |
![]() |
![]() |
#27 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 248
Karma: 892441
Join Date: Jul 2010
Device: K2i
|
I got tired of drag/dropping the epubs onto the drop target in Windows -
so I created a .bat file for Windows that mimics the shell script behavior from page one (looks for the most recent .epub in the (default) Windows Downloads folder, moves it it to /Dropbox - puts it through kindle-hyphens, converts it to azw3 (with justification justify), removes special characters from the filename and moves the azw3 to /Dropbox/Books/ -). You still have to install all the dependencies mentioned in the previos posting - including the rename.bat, and have them in the folders the script expects them to be - so follow the instructions in the previous posting (https://www.mobileread.com/forums/sh...0&postcount=22) as you may have done previously and only replace the drag/drop .bat with a .bat containing the following text. Code:
@echo off :ask FOR /F "delims=|" %%I IN ('DIR "%HOMEPATH%\Downloads\*.epub" /B /O:D') DO SET NewestePub=%%I FOR %%i IN ("%NewestEpub%") DO SET EpubName=%%~ni echo %NewestePub% echo Is this an english epub? set INPUT= set /P INPUT=Type y/n: %=% If /I "%INPUT%"=="y" goto yes If /I "%INPUT%"=="n" goto no :yes goto english :no goto other :english move "%HOMEPATH%\Downloads\%NewestePub%" "%HOMEPATH%\Dropbox\%NewestePub%" start /wait ebook-meta "%HOMEPATH%\Dropbox\%NewestePub%" --language en start /wait calibre-debug -e "C:\kindle-hyphens\main.py" "%HOMEPATH%\Dropbox\%NewestePub%" "%HOMEPATH%\Dropbox\%ePubName%_temp.epub" start /wait ebook-convert "%HOMEPATH%\Dropbox\%ePubName%_temp.epub" "%HOMEPATH%\Dropbox\%ePubName%.azw3" --change-justification justify goto fin :other move "%HOMEPATH%\Downloads\%NewestePub%" "%HOMEPATH%\Dropbox\%NewestePub%" start /wait calibre-debug -e "C:\kindle-hyphens\main.py" "%HOMEPATH%\Dropbox\%NewestePub%" "%HOMEPATH%\Dropbox\%ePubName%_temp.epub" start /wait ebook-convert "%HOMEPATH%\Dropbox\%ePubName%_temp.epub" "%HOMEPATH%\Dropbox\%ePubName%.azw3" --change-justification justify goto fin :fin del "%HOMEPATH%\Dropbox\%ePubName%_temp.epub" move "%HOMEPATH%\Dropbox\%ePubName%.azw3" "C:\kindle-hyphens\out\%ePubName%.azw3" call "C:\kindle-hyphens\rename.bat" move "C:\kindle-hyphens\out\*.azw3" "%HOMEPATH%\Dropbox\Books\" echo Script has finished. echo The .azw3 should now be in the Dropbox\Books\ folder. pause exit ![]() edit: And here is how you make it as easy as possible to launch that thing. ![]() ![]() Once you made sure the .bat works for you as intended (you could edit folder paths for example, although you shouldnt have to), or change the meta data language that gets set and makes sure that the correct hyphenation rules are applied - you can download "bat2exe converter" (http://www.f2ko.de/en/b2e.php) and a nice .ico icon (f.e.: https://www.iconfinder.com/icons/274...tudy_text_icon), convert the .bat into an .exe (don't forget to include your .ico file using the option in the third rider (afair)), name the .exe however you want (f.e. epubmove.exe), right click on it and select "Attach to Start Menu". Once you've done that pressing the Windows key followed by e and p (you are spelling out epubmove.exe), should bring the .exe into focus and allow you to run it by simply pressing enter. Thats four button presses to launch the program - two more to define the metadata language in your .epub - and after that the .azw3 is ready in your /Dropbox/Books/ folder, waiting to be synced. ![]() (Tested with Windows 7 and above, Windows XP had an issue relating filenames with spaces in them (at least with the older droptarget .bat), once you converted the .bat to an .exe - you'd have to test if it works with this one.) Last edited by notimp; 02-15-2017 at 03:15 AM. |
![]() |
![]() |
![]() |
#28 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
But Mr. Gates wants you to do things his way.
Next thing you know, you'll find yourself complaining about Amazon controlling the behavior of your Kindle with their automated OTA updates. Those huge corporations have a name for such a person: Loyal Customer. |
![]() |
![]() |
![]() |
#29 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 248
Karma: 892441
Join Date: Jul 2010
Device: K2i
|
I'm not using Windows that much..
![]() ![]() Also - I already instigated a "motion" in the communites I'm more active in to at least counter balance (*hrm*) the public opinion against the recent actions by Amazon. I at least mention the forced update regime once every month by now - because combined with the exclusivity publishers and authors granted them production wise (.kfx) it means, that they can iterate and push "fixes" without user consent, without knowledge, and without us having a real way to counteract it (blocking with that _temp folder - is not something the normal user..., you know the drill.. ![]() Also - isn't it funny how fast they backpaddle once another move to phase out eBook formats we still can understand gets some media attention? Sad thing is, they'll always try again, after a little cooldown period.. But most of this is off topic - so I'll just stop there... edit: You can also look at it this way: This is my contribution to get people off of Whispersync once and for all. ![]() Last edited by notimp; 02-14-2017 at 08:04 PM. |
![]() |
![]() |
![]() |
#30 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
I would really like to replace Amazon's service with our version.
Something that allows the user to pick their cloud service and sharing options. Just to stop the data mining of having Amazon looking over our shoulders, keeping track of every word we read and how fast we read it. - - - - - Yes, I realized I was preaching to the converted but I like to give my own opinions a refresh whenever possible. |
![]() |
![]() |
![]() |
Tags |
dropbox, kual, python, seafile |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Seafile Client | trap000d | Kindle Developer's Corner | 20 | 10-03-2016 06:11 PM |
what should I ask my client for next time? | angharad09 | Conversion | 2 | 02-27-2012 05:54 PM |
Touch OPDS client ??? | vlad59 | Kobo Reader | 7 | 12-04-2011 09:36 AM |
Android Email Client | veronica0406 | enTourage Archive | 2 | 11-12-2010 05:23 PM |
Android SFTP (client) | kenjennings | enTourage Archive | 4 | 04-12-2010 01:37 PM |