maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   python script to archive all events (https://talk.maemo.org/showthread.php?t=37907)

bananenfisch 2009-12-20 22:05

python script to archive all events
 
hey... i wrote my first small python script for the n900. it’s a command-line tool, which copies all events (SMS and IM messages, phone calls) into an extra archive DB. this way, you can store all events by running the script, before you clean up your conversations and calling-history... theres also an output of counting all events grouped by event-type...
i want to write an graphical widget and a graphical tool to browse all archived events next year... you are welcome, if anyone want to help me (i'm new on python and GTK) :-)

here is the first version of the script: http://www.bananenfisch.net/?p=64

bananenfisch 2010-01-07 03:17

Re: python script to archive all events
 
hi!

i wrote a gtk-frontend for this script now, with some additional output options. more infos here: http://www.bananenfisch.net/?p=120

hmm, im new here... should i upload my small app to the extras-devel repository??

greets from vienna,
markus

danielwilms 2010-01-07 07:40

Re: python script to archive all events
 
Quote:

Originally Posted by bananenfisch (Post 456706)
hmm, im new here... should i upload my small app to the extras-devel repository??

Of course, feel free to add your application to extras-devel. Makes the installing and the testing easier. There is as well a wiki page with all the information and links you need.

Cheers Daniel

Saturn 2010-01-07 23:12

Re: python script to archive all events
 
Looks nice from the screenshoots. Please add it to the extras (and to garage) if you got the time.

Question, if I don't clean, concequtive runs of the script will create double entries?

Thanks for sharing.

bananenfisch 2010-01-08 00:14

Re: python script to archive all events
 
yes, i will upload it to extras-devel and garage at the weekend...

Quote:

Originally Posted by Saturn (Post 458367)
Question, if I don't clean, concequtive runs of the script will create double entries?

no, it only archive new (and changed) datasets... you only get an double entry for example, when you have an unread message, archive this, read the message, and archive again (because "is_read" flag get changed, so the data is not the same in the archive-db)...

bananenfisch 2010-01-15 15:31

Re: python script to archive all events
 
ok, now you can find it at extras-devel, also here: https://garage.maemo.org/projects/glogarchive

j.s 2010-01-17 21:11

Re: python script to archive all events
 
Quote:

Originally Posted by bananenfisch (Post 474301)
ok, now you can find it at extras-devel, also here: https://garage.maemo.org/projects/glogarchive

Thank you for developing this much needed application.

During the first run, it displays a message that "Archive not found, copying all from el.db". I assume that this happens very quickly, but there is no indication when the copy is finished. Perhaps a message on the next line, "Copying complete" or similar would be helpful for the new, first time user. and maybe for everyone else also.

Thank you again.

bananenfisch 2010-01-17 21:24

Re: python script to archive all events
 
yes, thats a good point... next version will do this...
i also want to make an CSV export, and maybe other useful features... any features you request?

bananenfisch 2010-02-02 21:36

Re: python script to archive all events
 
ok... the new version is now in extras-testing. would be nice, if you test it :)

Saturn 2010-02-02 23:36

Re: python script to archive all events
 
Thanks for the new version.

Like a lot that one can delete the archive with a click. I've accumulated a lot of entries and wanted to start from scratch but i was to lazy to open the xterm.

One issue (not blocker though) I notice is that events from contacts that have more than one number the archive shows the name only for the first number. All events with the second, thrird etc number show only the number (i.e. +123456789 (+123456789) : ...)

bananenfisch 2010-02-04 18:35

Re: python script to archive all events
 
Quote:

Originally Posted by Saturn (Post 507710)
One issue (not blocker though) I notice is that events from contacts that have more than one number the archive shows the name only for the first number. All events with the second, thrird etc number show only the number (i.e. +123456789 (+123456789) : ...)

hmmm... i cannot reproduce this. do you store this numbers with or without country-code?

Strive_Masiwa 2010-03-29 20:48

Re: python script to archive all events
 
I just installed glogarchive from Extras-devel to archive my SMS/ IM/ Call Logs. http://maemo.org/packages/view/glogarchive/

Some questions:
1. Where does it store the backups?
2. How do I move it to my memory card/ PC?
3. Is there a way to restore from the archive?

bananenfisch 2010-03-29 21:38

Re: python script to archive all events
 
Quote:

Originally Posted by Strive_Masiwa (Post 587288)
1. Where does it store the backups?
2. How do I move it to my memory card/ PC?
3. Is there a way to restore from the archive?

1. here: "/home/user/.rtcom-eventlogger/el_archive.db"

2. theres an export-to-csv function (you can open the csv-file with openoffice or excel). you can also copy the db-file directly - its a sqlite-file, which can be opened with sqlite-tools (e.g. sqlitebrowser). if you want the archive permanently at another place, copy the file to the new place (e.g. "cp /home/user/.rtcom-eventlogger/el_archive.db /home/user/MyDocs/archive.db") and set the new path in /opt/glogarchive/glogarchive.py at line 25:
ARCHIVE_PATH = "/home/user/MyDocs/archive.db"

3. not now, maybe in one of the next versions :-(

david_vargas_85 2010-04-21 07:39

Re: python script to archive all events
 
Any way to get it to export an HTML file instead of CSV?

bananenfisch 2010-04-21 23:03

Re: python script to archive all events
 
Quote:

Originally Posted by david_vargas_85 (Post 620563)
Any way to get it to export an HTML file instead of CSV?

there are some scripts, which can do this... google csv2html. it seems, you can do it online here: http://www.fortunato.de/cms/16-0-CSV...vertieren.html

but the idea is good. maybe there will be a XML export in one of the next versions...

sponka 2010-06-16 10:20

Re: python script to archive all events
 
Hello!

Installed app while ago when using 1.1 and never worked.
Tryed today with 1.2, updated to newest version first and it still crash (simply dissapear). Is there any special requirements to run app? dmesg is empty.

Thanks,
b.

bananenfisch 2010-06-16 13:24

Re: python script to archive all events
 
hm... strange... it should work with the standard maemo python environment.
any output, when you start it via terminal?

sponka 2010-06-16 13:35

Re: python script to archive all events
 
Indeed. Here it is:

/home/user/# glogarchive
process 10626: arguments to dbus_connection_get_data() were incorrect, assertion "connection != NULL" failed in file dbus-connection.c line 5757.
This is normally a bug in some application using the D-Bus library.
process 10626: arguments to dbus_connection_set_data() were incorrect, assertion "connection != NULL" failed in file dbus-connection.c line 5721.
This is normally a bug in some application using the D-Bus library.
Aborted
/home/user/#

bananenfisch 2010-06-16 13:50

Re: python script to archive all events
 
hmm... is "python-dbus" installed? (run "dpkg -l python-dbus")
what happens, when you try this:
run-standalone.sh python2.5 /opt/glogarchive/glogarchive.py

sponka 2010-06-16 14:11

Re: python script to archive all events
 
I am on data conection, but I think installing python-dbus should work. Fail :S

BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso30+0m5) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ sudo gainroot
Root shell enabled


BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso30+0m5) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/home/user # dpkg -i python-dbus
dpkg: error processing python-dbus (--install):
cannot access archive: No such file or directory
Errors were encountered while processing:
python-dbus

/home/user # run-standalone.sh python2.5 /opt/glogarchive/glogarchive.py
Traceback (most recent call last):
File "/opt/glogarchive/glogarchive.py", line 596, in <module>
listall(ui)
File "/opt/glogarchive/glogarchive.py", line 309, in listall
cur.execute("select events.event_type_id, count(events.id), events.outgoing from events group by events.event_type_id, events.outgoing order by events.event_type_id, events.outgoing")
sqlite3.OperationalError: no such table: events
/home/user #

I'll try later at home on wifi. Have enabled maemo-devel, maemo-extras and maemo-extras-testing repos.

Regards,
b.

bananenfisch 2010-06-16 15:10

Re: python script to archive all events
 
hmm - it seems, that there is a problem with the sql-file. what is the output of "ls /home/user/.rtcom-eventlogger" ?
there must be an archive-file (because it opens one), but not a valid one.

bananenfisch 2010-06-16 21:44

Re: python script to archive all events
 
and: do not run glogarchive as root! the script searches for the DB in the user-directory - the user-directory for root is /root - and there are no files. i get the same error, when i run the script as root...
what is the output, when you start it as user?
run-standalone.sh python2.5 /opt/glogarchive/glogarchive.py

sponka 2010-06-16 22:59

Re: python script to archive all events
 
Hm :/

Here is output and directory listing:




BusyBox v1.10.2 (Debian 3:1.10.2.legal-1osso30+0m5) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ run-standalone.sh python2.5 /opt/glogarchive/glogarchive.py
Traceback (most recent call last):
File "/opt/glogarchive/glogarchive.py", line 596, in <module>
listall(ui)
File "/opt/glogarchive/glogarchive.py", line 309, in listall
cur.execute("select events.event_type_id, count(events.id), events.outgoing from events group by events.event_type_id, events.outgoing order by events.event_type_id, events.outgoing")
sqlite3.OperationalError: no such table: events
~ $
~ $
~ $
~ $ ls -al /home/user/.rtcom-eventlogger/
drwx------ 4 user users 4096 Jun 16 15:29 .
drwxr-xr-x 58 user users 4096 Jun 16 20:33 ..
drwx------ 6 user users 4096 Jun 10 14:48 attachments
-rw------- 1 user users 37888 May 26 11:33 el-v1-before-restore.db
-rw-r--r-- 1 user users 240640 Jun 16 16:53 el-v1.db
-rw-r--r-- 1 user users 0 Jun 16 16:53 el-v1.db-journal
-rw-r--r-- 1 user users 0 Jun 16 12:31 el.db
-rw-r--r-- 1 user users 0 Jun 15 10:41 el_archive-v1.db
drwx------ 2 user users 4096 May 17 16:47 plugins
~ $

bananenfisch 2010-06-16 23:05

Re: python script to archive all events
 
ah ok. a
rm /home/user/.rtcom-eventlogger/el_archive-v1.db
should solve the problem.

sponka 2010-06-16 23:21

Re: python script to archive all events
 
That's it? Because it's working :))
THANKS!!!

bananenfisch 2010-06-17 01:00

Re: python script to archive all events
 
no problem =)

doris 2010-11-11 10:40

Re: python script to archive all events
 
First i would like to say that the application is very good, i love it :)
but also i like to ask, is it possible in some way to delete only one phonenumber, i mean only a few messages not the whole archive, not all messages and calls???
thanks :)

bananenfisch 2010-11-14 23:42

Re: python script to archive all events
 
hi doris,
there is a way, but not with glogarchive itself. use sqlitebrowser to edit the archive: http://sourceforge.net/projects/sqlitebrowser/
1. copy the archive from your phone, to your pc. this is the file: /home/user/.rtcom-eventlogger/el_archive-v1.db
2. make a backup of the file
3. open the file with sqlitebrowser
4. there you can browse the table "Events" - delete records you want to delete
5. save the file, move it back to /home/user/.rtcom-eventlogger/el_archive-v1.db on your phone

note: if you have the deleted records on your normal conversations-history, it will be archived again next time...

all right?

HerrPNur 2010-12-27 16:38

Re: python script to archive all events
 
bananenfisch could you check the topic about the sms counter
(http://talk.maemo.org/showthread.php?t=38364&page=9)
I have a question...

lorebett 2011-07-05 19:38

Re: python script to archive all events
 
Thanks for this application!
I was trying to find a way to export my sms and I couldn't find one (If I'm not wrong it is not possible from ovi suite is it?)

jellyroll 2012-10-27 12:37

Re: python script to archive all events
 
Quote:

Originally Posted by bananenfisch (Post 718452)
ah ok. a
rm /home/user/.rtcom-eventlogger/el_archive-v1.db
should solve the problem.

Thanks :D
Why do you need to remove this file?

bananenfisch 2012-10-30 04:02

Re: python script to archive all events
 
Quote:

Originally Posted by jellyroll (Post 1286297)
Thanks :D
Why do you need to remove this file?

Hehe, years later...
When die archive-file is broken (it was an issue while an update from 1.1 to 1.2, i think, or 1.3?) or empty, glogarchive crashes. Since there is no check, if the archive exist but empty, just delete the file and create a new archive-file...


All times are GMT. The time now is 04:01.

vBulletin® Version 3.8.8