brikell69 / nookdevs

Automatically exported from code.google.com/p/nookdevs
0 stars 0 forks source link

sync library #169

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
More of an enhancement than a an issue, would it be possible for nookLibrary to 
autosync with a OPDS catalog like it does form smashwords or the other one. 

I put my hole calibre library on my dropbox and I use calibre2opds to create a 
catalog. I just want nookLibrary to update like theDaily does. 

Original issue reported on code.google.com by talis...@gmail.com on 14 Apr 2011 at 5:59

GoogleCodeExporter commented 9 years ago
I think trook does this.

Original comment by hari.swa...@gmail.com on 15 Apr 2011 at 1:22

GoogleCodeExporter commented 9 years ago
trook allows you to browse your catalog, but you need to download the books 
individually. I am thinking of something automatic.

i have only learned C++ so i cant do it myself, but it seems like it wouldn't 
be that much effort to take the relevant piece of code from trook and adapt it 
to here...  

Original comment by talis...@gmail.com on 15 Apr 2011 at 2:40

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
i wrote a python script that does what i want. in just cant turn the wifi on. 
maybe there is a way to incorporate it with nooklibrary....

i forgot, the script is called nookopds on the apps page on nookdevs.

Original comment by talis...@gmail.com on 6 May 2011 at 11:46

GoogleCodeExporter commented 9 years ago
Thanks. Ill see if i can add a new menu option & call this script. Ill add the 
apk file to this incident when its ready for testing.

Original comment by hari.swa...@gmail.com on 6 May 2011 at 12:47

GoogleCodeExporter commented 9 years ago
Thank you! That would be great!
Note two things:
The script can NOT start a WIFI conncetion. if you could stick it in to be 
called when the WIFI is on during the refresh, that would be very helpful.

the script goes to sleep and calls if self everyday at the same hour.  I would 
be happy if we could keep that capability. If not, le me know and i will edit 
the code to fit you needs.

Original comment by talis...@gmail.com on 6 May 2011 at 2:49

GoogleCodeExporter commented 9 years ago
if you want it to be done manually, I can call the command from the refresh 
module. 

if it has to run at a certain time in the night, we probably have to create a 
separate app that sets an alarm to lock wifi at that time and call this script.

BTW, there are 2 scripts wifi_start.sh  and wifi_stop.sh under /system/etc
are they not working?

Original comment by hari.swa...@gmail.com on 6 May 2011 at 3:09

GoogleCodeExporter commented 9 years ago
You have to understand, i have no programing experience except python (and very 
low level like VHDL and assembly). i dont really understand the mid level (like 
JAVA).

I would like it to run at a certain time at night (defined in the settings 
file), but it would not be the end of the world if not. If you want the script 
to return true or something like that, thats not a problem. I think you really 
have more knowledge and you know the real apps more than me. You also 
understand that its funner to wake up and take the nook to read on the way with 
no need to sync it on wifi before you leave. So i think you need to tell me 
what works best for you.

I tried running the two scripts you listed. I get a permission error. 

In any case, tell me what you need, and Ill try to provide.

Original comment by talis...@gmail.com on 6 May 2011 at 3:25

GoogleCodeExporter commented 9 years ago
i gave it some more thought.

would it be easier if you added the script to the refresh function in 
nookLibrary and then added a "refresh at set time" function that would call the 
refresh function at a set time? i am sure that people would like to have B&N or 
smashwords updated automatically. 

what do you think?

Original comment by talis...@gmail.com on 9 May 2011 at 6:06

GoogleCodeExporter commented 9 years ago
Yes. We can do that. I'm out travelling this week. I'll start on this next week 
and attach the apk file here for testing.

Original comment by hari.swa...@gmail.com on 9 May 2011 at 7:36

GoogleCodeExporter commented 9 years ago
Enjoy your travels :-)
Let me know when you start working on it and what you need.

I think I might give an email based library management script a crack. May be 
Gmail based. 

Original comment by talis...@gmail.com on 9 May 2011 at 3:32

GoogleCodeExporter commented 9 years ago
I have changed the script to do what I think it needs to do. 
What now?

Original comment by talis...@gmail.com on 24 May 2011 at 4:18

GoogleCodeExporter commented 9 years ago
Hi,
I changed the refresh logic to call your script. I'm working on the scheduling 
part now. I'll use your script, test and let you know. It might be a couple of 
weeks before I finish this and ready for testing.

Thanks.

Original comment by hari.swa...@gmail.com on 24 May 2011 at 4:34

GoogleCodeExporter commented 9 years ago
welcome back!
I have updated the script on nook devs and i have one even more suited for the 
library app.

do you want it to return true or false at the end?

I am still working on the email based script. I had some problems, but i think 
i found my mistake (at least one of them....) 

Original comment by talis...@gmail.com on 24 May 2011 at 4:55

GoogleCodeExporter commented 9 years ago
yes. That would be great! I'm just calling the script and not checking any 
return value now. I can change that and may be display an error message if 
needed.

Original comment by hari.swa...@gmail.com on 24 May 2011 at 6:04

GoogleCodeExporter commented 9 years ago
I'll get on it today.

I think i will also be done with the email based delivery system.

Would it be possible for the script to save text files it its own location (for 
the email password). An other way to ask it is, where and how does nook library 
store the smashwords or fictionwise password?

Original comment by talis...@gmail.com on 24 May 2011 at 7:15

GoogleCodeExporter commented 9 years ago
I store it in a database under /data/data/<app package>/ folder. This is 
available for each installed app and only the app process will have permission 
to access it.

You can also store files in "/system/media/sdcard/" folder. This is accessible 
by everyone.

Original comment by hari.swa...@gmail.com on 24 May 2011 at 9:56

GoogleCodeExporter commented 9 years ago
i am a little stuck on notifying nookLibrary that the script is done.

the least elegant way is to create a temp file when the scrhpt is done, and the 
java will delete it.

if i kill the script at the end (including the python interpreter), can you use 
that? like following active processes or something like that? 

i searched the web to see if there is a way for a python script to rase a flag 
of some sort in android. i did not see something like that...

Original comment by talis...@gmail.com on 24 May 2011 at 5:55

GoogleCodeExporter commented 9 years ago
can't you return value using sys.exit()? I'm not familiar with the way the 
python shell works in android. So, don't know if it works or not.

Original comment by hari.swa...@gmail.com on 24 May 2011 at 6:14

GoogleCodeExporter commented 9 years ago
i just whipped up a short script. see if you get any exceptions or flags or 
anything from the two versions. let me know if it works....

Original comment by talis...@gmail.com on 24 May 2011 at 6:19

Attachments:

GoogleCodeExporter commented 9 years ago
I can read return code from both. This should work. Return 0 for sucess and 1 
for any error.

Original comment by hari.swa...@gmail.com on 25 May 2011 at 3:45

GoogleCodeExporter commented 9 years ago
that makes life much easier.

should i kill the script process at the end of the run or will you? 

Original comment by talis...@gmail.com on 25 May 2011 at 4:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
fetch is for a gmail base system. it downloads all the attachments from new 
emails tagged nook.

when deleting this library(to start new), please delete 
"/system/media/sdcard/.emailsettings" file.

opds is for opds. please delete "/system/media/sdcard/settingsopds" and 
"/system/media/sdcard/current_files" when deleting the library.

you will have to kill the python process (or what ever is running) i cant do it 
myself...

i am on vacation so i might take me a while, but let me know if you run in to 
trouble, or if you need anything else. 

thanks again for doing this.

Original comment by talis...@gmail.com on 25 May 2011 at 7:57

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Hari,

Just wanted to get an update on how it is going and to see if anything needs to 
be changed with the python?

Regards,
Avi

Original comment by talis...@gmail.com on 14 Jun 2011 at 2:15

GoogleCodeExporter commented 9 years ago
Hi,
Sorry. I'm out of the country on business again & won't return till 30th. I 
have the code ready & did some testing. But its in my pc back home.
 Your script is fine. I was able to call & get a return code.

Original comment by hari.swa...@gmail.com on 14 Jun 2011 at 4:20

GoogleCodeExporter commented 9 years ago
Hi,
I updated the nookLibrary debug version with this package. Take a look and let 
me know.

Thanks,
Hari

Original comment by hari.swa...@gmail.com on 28 Jun 2011 at 4:19

GoogleCodeExporter commented 9 years ago
i am not sure what is hapening at all.
when i enter the refresh menu and add opds sync, it askes me for an hour (i 
entered 05:00) and then it starts refreshing. i am not sure how this is suppose 
to work. 
also, i dident see the emailscript at all...

Original comment by talis...@gmail.com on 29 Jun 2011 at 9:29

GoogleCodeExporter commented 9 years ago
I added a scheduler. It will lock wifi & call the script at the time you 
entered.
It will also call it if you select the refresh manually. I guess I can change 
it to not call the script when adding for the first time. I didn't think that 
was a big deal.

Original comment by hari.swa...@gmail.com on 30 Jun 2011 at 12:16

GoogleCodeExporter commented 9 years ago
05:00 came and passed, nothing happend.
it does not seem to call any script. 
the script should be called when added.
and there are two scripts. one that updates opds. the other that checks email. 
where is the email one?

Original comment by talis...@gmail.com on 30 Jun 2011 at 4:35

GoogleCodeExporter commented 9 years ago
copy the logs here and I'll take a look

Original comment by hari.swa...@gmail.com on 30 Jun 2011 at 9:45

GoogleCodeExporter commented 9 years ago
i think library calls the script before there is a wifi lock. could that be?

Original comment by talis...@gmail.com on 1 Jul 2011 at 6:12

Attachments:

GoogleCodeExporter commented 9 years ago
Could be a delay. I'll add logic to wait and check for the wifi before calling 
the script.
can you give me the path of the python scripts and their permissions?

Original comment by hari.swa...@gmail.com on 1 Jul 2011 at 1:30

GoogleCodeExporter commented 9 years ago
the path of the scripts? i am not really sure what you mean. maybe 
"sdcard/ase/scripts/" ? permissions? i think ase gets permissions for 
everything...

Original comment by talis...@gmail.com on 3 Jul 2011 at 1:41

GoogleCodeExporter commented 9 years ago
on my nook i run the script from sdcard/sl4a/scripts/opds.py and 
sdcard/sl4a/scripts/fetch.py

Original comment by talis...@gmail.com on 3 Jul 2011 at 1:43

GoogleCodeExporter commented 9 years ago
In the log, looks like it couldn't find the script. It may be due permissions. 
You can login via adb shell & check permissions.

Original comment by hari.swa...@gmail.com on 3 Jul 2011 at 1:44

GoogleCodeExporter commented 9 years ago
I installed your script from nookdevs. The app looks for the exact script under 
card/ase/scripts folder. Others won't work. I'll change it to lock wifi & wait 
a bit before calling the script.
I'll upload the apk later tonight/tomorrow

Original comment by hari.swa...@gmail.com on 3 Jul 2011 at 1:51

GoogleCodeExporter commented 9 years ago
the script from nookdevs is not the correct one. i changed the script to be 
suited for your needs. it is attached here in comment 25. one is for opds and 
one is for email. try running both and see that they will work better. 

Original comment by talis...@gmail.com on 3 Jul 2011 at 4:28

GoogleCodeExporter commented 9 years ago
the script from nookdevs is not the correct one. i changed the script to be 
suited for your needs. it is attached here in comment 25. one is for opds and 
one is for email. try running both and see that they will work better. 

Original comment by talis...@gmail.com on 3 Jul 2011 at 4:28

GoogleCodeExporter commented 9 years ago
the script from nookdevs is not the correct one. i changed the script to be 
suited for your needs. it is attached here in comment 25. one is for opds and 
one is for email. try running both and see that they will work better. 

Original comment by talis...@gmail.com on 3 Jul 2011 at 4:28

GoogleCodeExporter commented 9 years ago
i am sorry for the mixup. while i wush changing things i renamed the script on 
my nook.
it still does not work. ill add a logcat later tonight...

Original comment by talis...@gmail.com on 6 Jul 2011 at 4:59

GoogleCodeExporter commented 9 years ago
can you try with the nookLibrary debug version again? I just updated it

Original comment by hari.swa...@gmail.com on 9 Jul 2011 at 7:03

GoogleCodeExporter commented 9 years ago
will do. i need to recharge my nook first. ill let you know in a day.

Original comment by talis...@gmail.com on 10 Jul 2011 at 3:55

GoogleCodeExporter commented 9 years ago
i ran the refresh. it looks like calling scripts works, but after the script 
ran, the ase screen stays on. you could kill the app after calling it. also, 
the library shows refresh- still working... in the menu and no books show.

as i said before, there are to scripts. one title should be "gmail sync" and it 
should call nookGmailFetch.py. the other title is "OPDS sync" and it should 
call nookOPDS.py  
in this rar file are:
1) a logcat of what i did.
2) the two scripts in their most recent version.

let me know if you need anything else and thanks again for all the work

Original comment by talis...@gmail.com on 12 Jul 2011 at 12:12

Attachments:

GoogleCodeExporter commented 9 years ago
ok. thanks. I'll take a look later tonight.

Original comment by hari.swa...@gmail.com on 12 Jul 2011 at 12:17

GoogleCodeExporter commented 9 years ago
Let's get one script working good first. Adding 2nd one later is very easy.
the return code was working fine in the emulator. but I'm also seeing the same 
behavior as you in the device.

I modified the code to refresh properly and also modified the script to switch 
back to the library app at the end.
Use the latest apk and modify the script as shown below:

add this code instead of sys.exit
droid.startActivity("android.intent.action.MAIN",None,None,None,false,"com.nookd
evs.library","com.nookdevs.library.NookLibrary")

Original comment by hari.swa...@gmail.com on 13 Jul 2011 at 1:54

GoogleCodeExporter commented 9 years ago
i added it as you said. still, the ase shows up in the morning (disappears once 
i click on anything in the menu like email) and still don't have the books 
refreshed in library. if i kill library and restart in, all the books are there.

Original comment by talis...@gmail.com on 17 Jul 2011 at 9:13

GoogleCodeExporter commented 9 years ago
Thanks. I'll try it out this weekend.

Original comment by hari.swa...@gmail.com on 22 Jul 2011 at 2:48

GoogleCodeExporter commented 9 years ago
i ran a few test of my own. when i add droid.forceStopPackage('com.google.ase') 
after you addition, ase closes. and i see what i saw before the script was 
called. the books still don't show up and if it try to hit refresh, it is 
unresponsive (all the rest works fine. i think that the script is not called on 
day 2 but i am not sure of that.

Original comment by talis...@gmail.com on 24 Jul 2011 at 7:48