Explorar el Código

Telefonnummernextraktion erfolgreich

git-svn-id: svn://svn.siningsoft.de/Sailfish_Contacts_Restore@6 9ea9dde1-eeb2-4aae-9f27-8a0df3aa35ee
devnull hace 4 años
padre
commit
eac3a8c0b5
Se han modificado 36 ficheros con 53 adiciones y 23 borrados
  1. 1 0
      SQL/Abfragen.sql
  2. 0 0
      Testdata/contacts_with-Mail_n_Voice.db
  3. BIN
      Testdata/contacts_with-Mails.db
  4. BIN
      Testdata/contacts_with-Phone-Mobile-Fax-Pager-Assistent.db
  5. BIN
      Testdata/contacts_with-Phone-Mobile-Fax.db
  6. BIN
      Testdata/system/privileged/Ambienced/ambienced.sqlite
  7. BIN
      Testdata/system/privileged/Ambienced/ambienced.sqlite-shm
  8. BIN
      Testdata/system/privileged/Calendar/mkcal/db
  9. 0 0
      Testdata/system/privileged/Calendar/mkcal/db.changed
  10. 0 1
      Testdata/system/privileged/Contacts/calendar.stamp
  11. BIN
      Testdata/system/privileged/Contacts/qtcontacts-sqlite/contacts.db-shm
  12. BIN
      Testdata/system/privileged/Contacts/qtcontacts-sqlite/contacts.db-wal
  13. BIN
      Testdata/system/privileged/Images/dropbox.db
  14. BIN
      Testdata/system/privileged/Images/facebook.db
  15. BIN
      Testdata/system/privileged/Images/onedrive.db
  16. BIN
      Testdata/system/privileged/Images/vk.db
  17. 0 9
      Testdata/system/privileged/Keys/storedkeys.ini
  18. BIN
      Testdata/system/privileged/Notifications/notifications.db
  19. BIN
      Testdata/system/privileged/Notifications/notifications.db-shm
  20. BIN
      Testdata/system/privileged/Secrets/initialsalt/518327c7-a7d1-4952-b75d-d2ebf971f2bb/file0
  21. BIN
      Testdata/system/privileged/Secrets/initialsalt/518327c7-a7d1-4952-b75d-d2ebf971f2bb/file1
  22. BIN
      Testdata/system/privileged/Secrets/initialsalt/518327c7-a7d1-4952-b75d-d2ebf971f2bb/file2
  23. 0 3
      Testdata/system/privileged/Secrets/lockcodecheck/202adee0-eab6-477e-9858-28b6e9983c3c/file0
  24. 0 3
      Testdata/system/privileged/Secrets/lockcodecheck/202adee0-eab6-477e-9858-28b6e9983c3c/file1
  25. 0 3
      Testdata/system/privileged/Secrets/lockcodecheck/202adee0-eab6-477e-9858-28b6e9983c3c/file2
  26. BIN
      Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.openpgp/metadata.db
  27. BIN
      Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.openpgp/metadata.db-shm
  28. BIN
      Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.openpgp/metadata.db-wal
  29. BIN
      Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.smime/metadata.db
  30. BIN
      Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.smime/metadata.db-shm
  31. BIN
      Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.smime/metadata.db-wal
  32. BIN
      Testdata/system/privileged/Secrets/org.sailfishos.secrets.plugin.encryptedstorage.sqlcipher/metadata.db
  33. BIN
      Testdata/system/privileged/Secrets/org.sailfishos.secrets.plugin.encryptedstorage.sqlcipher/metadata.db-shm
  34. BIN
      Testdata/system/privileged/Secrets/org.sailfishos.secrets.plugin.encryptedstorage.sqlcipher/metadata.db-wal
  35. 1 1
      test/vcfExport_2_children.py
  36. 51 3
      test/vcfExport_PhoneNumbers.py

+ 1 - 0
SQL/Abfragen.sql

@@ -1,3 +1,4 @@
 SELECT * FROM Contacts;
 SELECT * FROM Contacts JOIN EmailAddresses ON Contacts.contactId = EmailAddresses.contactId;
+SELECT * from PhoneNumbers JOIN Details on Details.detailId = PhoneNumbers.detailId;
 

+ 0 - 0
Testdata/system/Contacts/qtcontacts-sqlite/contacts.db → Testdata/contacts_with-Mail_n_Voice.db


BIN
Testdata/system/privileged/Ambienced/ambienced.sqlite-wal → Testdata/contacts_with-Mails.db


BIN
Testdata/system/privileged/Notifications/notifications.db-wal → Testdata/contacts_with-Phone-Mobile-Fax-Pager-Assistent.db


BIN
Testdata/system/privileged/Contacts/qtcontacts-sqlite/contacts.db → Testdata/contacts_with-Phone-Mobile-Fax.db


BIN
Testdata/system/privileged/Ambienced/ambienced.sqlite


BIN
Testdata/system/privileged/Ambienced/ambienced.sqlite-shm


BIN
Testdata/system/privileged/Calendar/mkcal/db


+ 0 - 0
Testdata/system/privileged/Calendar/mkcal/db.changed


+ 0 - 1
Testdata/system/privileged/Contacts/calendar.stamp

@@ -1 +0,0 @@
-1

BIN
Testdata/system/privileged/Contacts/qtcontacts-sqlite/contacts.db-shm


BIN
Testdata/system/privileged/Contacts/qtcontacts-sqlite/contacts.db-wal


BIN
Testdata/system/privileged/Images/dropbox.db


BIN
Testdata/system/privileged/Images/facebook.db


BIN
Testdata/system/privileged/Images/onedrive.db


BIN
Testdata/system/privileged/Images/vk.db


+ 0 - 9
Testdata/system/privileged/Keys/storedkeys.ini

@@ -1,9 +0,0 @@
-[encoding]
-jolla/jolla-store/scheme=xor
-jolla/jolla-store/key=xor_key
-
-[encodedkeys]
-jolla/jolla-store/application_name=SVwXbVNcHE5CEz5fVFRMXkBnRl1BTF5fPAoGGhsMSmdbXUEe
-jolla/jolla-store/client_id=PSEEEjwfDk0bSygAUz4JX0pqEwc9FxdKbTE1CCsXFzYlPRIOBygFUw==
-jolla/jolla-store/client_secret=MiMmGgguDBwaBy8TNz8OX0ILXCAOHwoLEj0UNgFXJAkMJAotCR9qOBJJNzoBBwQXHDMtHRAKLhUZKBwQBxwcKgI5PBsRFDsgJCsOC0AfKhMzEwcISDsAOTMECTkJATsOKQ8sJkYzGjwrLT1GNBNdNR89EDQeEBQRFjE+BjBLMj8=
-

BIN
Testdata/system/privileged/Notifications/notifications.db


BIN
Testdata/system/privileged/Notifications/notifications.db-shm


BIN
Testdata/system/privileged/Secrets/initialsalt/518327c7-a7d1-4952-b75d-d2ebf971f2bb/file0


BIN
Testdata/system/privileged/Secrets/initialsalt/518327c7-a7d1-4952-b75d-d2ebf971f2bb/file1


BIN
Testdata/system/privileged/Secrets/initialsalt/518327c7-a7d1-4952-b75d-d2ebf971f2bb/file2


+ 0 - 3
Testdata/system/privileged/Secrets/lockcodecheck/202adee0-eab6-477e-9858-28b6e9983c3c/file0

@@ -1,3 +0,0 @@
-org.sailfishos.secrets.plugin.encryptedstorage.sqlcipher
-¶dº™áØ„y©„yaׯÈ\ʼn<Óbâ
-ICI÷	›ÕÖÁo?‡Ä³‡™R

+ 0 - 3
Testdata/system/privileged/Secrets/lockcodecheck/202adee0-eab6-477e-9858-28b6e9983c3c/file1

@@ -1,3 +0,0 @@
-org.sailfishos.secrets.plugin.encryptedstorage.sqlcipher
-¶dº™áØ„y©„yaׯÈ\ʼn<Óbâ
-ICI÷	›ÕÖÁo?‡Ä³‡™R

+ 0 - 3
Testdata/system/privileged/Secrets/lockcodecheck/202adee0-eab6-477e-9858-28b6e9983c3c/file2

@@ -1,3 +0,0 @@
-org.sailfishos.secrets.plugin.encryptedstorage.sqlcipher
-¶dº™áØ„y©„yaׯÈ\ʼn<Óbâ
-ICI÷	›ÕÖÁo?‡Ä³‡™R

BIN
Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.openpgp/metadata.db


BIN
Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.openpgp/metadata.db-shm


BIN
Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.openpgp/metadata.db-wal


BIN
Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.smime/metadata.db


BIN
Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.smime/metadata.db-shm


BIN
Testdata/system/privileged/Secrets/org.sailfishos.crypto.plugin.gnupg.smime/metadata.db-wal


BIN
Testdata/system/privileged/Secrets/org.sailfishos.secrets.plugin.encryptedstorage.sqlcipher/metadata.db


BIN
Testdata/system/privileged/Secrets/org.sailfishos.secrets.plugin.encryptedstorage.sqlcipher/metadata.db-shm


BIN
Testdata/system/privileged/Secrets/org.sailfishos.secrets.plugin.encryptedstorage.sqlcipher/metadata.db-wal


+ 1 - 1
test/vcfExport_2_children.py

@@ -11,7 +11,7 @@ import sqlite3
 import vobject
 import uuid
 
-SQLconn = sqlite3.connect('../Testdata/system/Contacts/qtcontacts-sqlite/contacts.db')
+SQLconn = sqlite3.connect('../Testdata/contacts_with-Mail.db')
 
 
 try:

+ 51 - 3
test/vcfExport_PhoneNumbers.py

@@ -5,19 +5,20 @@
 # Links
 #  FileFormatdescription: https://docs.fileformat.com/email/vcf/#vcf-30-example
 #  Pytho vobject: http://eventable.github.io/vobject/
+
 # ChangeLog
+#  2021-08-03 - multiple E-Mails with different types are working correctly
 
 import sqlite3
 import vobject
 import uuid
 
-SQLconn = sqlite3.connect('../Testdata/system/Contacts/qtcontacts-sqlite/contacts.db')
+SQLconn = sqlite3.connect('../Testdata/contacts_with-Phone-Mobile-Fax-Pager-Assistent.db')
 
 
 try:
     SQLContCur = SQLconn.cursor()
     for row in SQLContCur.execute('SELECT * FROM Contacts'):
-            print(row[4] + ' ' + row[6])
         
             # contactID abfragen
             contactID=row[0]
@@ -30,13 +31,16 @@ try:
             vcf.add('n').value = vobject.vcard.Name( family=row[6], given=row[4] )
             vcf.add('fn').value =row[1]
             
+            print("debug: Contact " + row[1])
+            
+            
             SQLEmailCur = SQLconn.cursor()
             
             ## Abfragen E-Mail-Adressen
             for Emailrow in SQLEmailCur.execute('SELECT * from EmailAddresses JOIN Details on Details.detailId= EmailAddresses.detailId where EmailAddresses.contactId = ' + str(contactID)):
                 
                 # debug ausgabe
-                print("debug: " + str(Emailrow[2]) + " at " + str(Emailrow[9]))
+                print("...debug: " + str(Emailrow[2]) + " at " + str(Emailrow[9]))
                 
                 email = vcf.add('email')
                 email.value = str(Emailrow[2])
@@ -46,7 +50,51 @@ try:
                     email.type_param = str(Emailrow[9])
 
 
+            SQLPhoneCur = SQLconn.cursor()
             
+            ## Abfragen Telefonnummer, Fax, SMS - Nummern kommen aus der gleichen Tabelle
+            for Phonerow in SQLPhoneCur.execute('SELECT * from PhoneNumbers JOIN Details on Details.detailId = PhoneNumbers.detailId where PhoneNumbers.contactId = ' + str(contactID)):
+                
+                # wir müssen die SubTypen unterscheiden
+                #Null	voice
+                #1	cell
+                #2	fax
+                #3	pager
+                #6	video
+                #10	Assistent
+                
+                
+                # debug ausgabe
+                print("...debug: " + str(Phonerow[2]) + " at " + str(Phonerow[10]) + " subtype=" + str(Phonerow[3]))
+                
+                # None is a normal phone Number
+
+
+                if Phonerow[3] == "1":
+                    phcat='cell'
+                elif Phonerow[3] == "2":
+                    phcat='fax'
+                elif Phonerow[3] == "3":
+                    phcat='pager'
+                elif Phonerow[3] == "6":
+                    phcat='video'
+                elif Phonerow[3] == "10":
+                    phcat='assistent'
+                elif Phonerow[3] is None:
+                    phcat='voice'
+                
+                print("...debug: " + phcat)
+
+                phone = vcf.add(phcat).value = str(Phonerow[2])
+                
+                # nur den Typ einpflegen, wenn das hier nicht none ist
+                if Phonerow[10] != None:
+                    try:
+                        phone.type_param = str(Phonerow[10])
+                    except AttributeError:
+                        continue
+
+            # Ausgabe
             print(vcf.serialize())
 
 # hier brauchen wir einige eception handles -> wie bekommen wir die einzelnen exceptions heruas ?