Moved record mappings into separate yaml file.
This commit is contained in:
parent
1ea51e6e28
commit
3823e8b404
1
Pipfile
1
Pipfile
@ -5,6 +5,7 @@ name = "pypi"
|
||||
|
||||
[packages]
|
||||
pykeepass = "*"
|
||||
pyyaml = "*"
|
||||
|
||||
[dev-packages]
|
||||
|
||||
|
43
Pipfile.lock
generated
43
Pipfile.lock
generated
@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "e35466742a8ba0dfeeffb96a61f5a7848b21814c8a8cd17af4fd522b4f7471f3"
|
||||
"sha256": "1f66f1e1aa2975c8d7d4265a16e8d73d29cba44417e0cbee00803fe19d4a4d53"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
@ -103,7 +103,7 @@
|
||||
"hashes": [
|
||||
"sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d"
|
||||
],
|
||||
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'",
|
||||
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"version": "==0.18.2"
|
||||
},
|
||||
"lxml": {
|
||||
@ -216,15 +216,50 @@
|
||||
"sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86",
|
||||
"sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'",
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"version": "==2.8.2"
|
||||
},
|
||||
"pyyaml": {
|
||||
"hashes": [
|
||||
"sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf",
|
||||
"sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696",
|
||||
"sha256:129def1b7c1bf22faffd67b8f3724645203b79d8f4cc81f674654d9902cb4393",
|
||||
"sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77",
|
||||
"sha256:3b2b1824fe7112845700f815ff6a489360226a5609b96ec2190a45e62a9fc922",
|
||||
"sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5",
|
||||
"sha256:4465124ef1b18d9ace298060f4eccc64b0850899ac4ac53294547536533800c8",
|
||||
"sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10",
|
||||
"sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc",
|
||||
"sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018",
|
||||
"sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e",
|
||||
"sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253",
|
||||
"sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347",
|
||||
"sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183",
|
||||
"sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541",
|
||||
"sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb",
|
||||
"sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185",
|
||||
"sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc",
|
||||
"sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db",
|
||||
"sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa",
|
||||
"sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46",
|
||||
"sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122",
|
||||
"sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b",
|
||||
"sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63",
|
||||
"sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df",
|
||||
"sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc",
|
||||
"sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247",
|
||||
"sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6",
|
||||
"sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==5.4.1"
|
||||
},
|
||||
"six": {
|
||||
"hashes": [
|
||||
"sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926",
|
||||
"sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"
|
||||
],
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'",
|
||||
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"version": "==1.16.0"
|
||||
}
|
||||
},
|
||||
|
83
convert.py
83
convert.py
@ -2,6 +2,7 @@
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import yaml
|
||||
import onepif
|
||||
import kpwriter
|
||||
|
||||
@ -43,86 +44,8 @@ def getField(item, designation):
|
||||
return None
|
||||
|
||||
|
||||
# Mapping of 1P types for best conversion
|
||||
RECORD_MAP = {
|
||||
"112": {
|
||||
# API Credential
|
||||
"icon": "GEAR",
|
||||
},
|
||||
"wallet.financial.BankAccountUS": {
|
||||
# Bank Account
|
||||
"icon": "DOLLAR_SIGN",
|
||||
},
|
||||
"wallet.financial.CreditCard": {
|
||||
# Credit Card
|
||||
"icon": "DOLLAR_SIGN",
|
||||
},
|
||||
"wallet.computer.Database": {
|
||||
# Database
|
||||
"icon": "SERVER",
|
||||
},
|
||||
# Not exported: Document
|
||||
"wallet.government.DriversLicense": {
|
||||
# Driver License
|
||||
"icon": "BUSINESS_CARD",
|
||||
},
|
||||
"wallet.onlineservices.Email.v2": {
|
||||
# Email Account
|
||||
"icon": "ENVELOPE",
|
||||
},
|
||||
"identities.Identity": {
|
||||
# Identity
|
||||
"icon": "BUSINESS_CARD",
|
||||
},
|
||||
"webforms.WebForm": {
|
||||
# Login
|
||||
"icon": "MANAGER",
|
||||
},
|
||||
"113": {
|
||||
# Medical Record
|
||||
"icon": "WARNING_SIGN",
|
||||
},
|
||||
"wallet.membership.Membership": {
|
||||
# Membership
|
||||
"icon": "BUSINESS_CARD",
|
||||
},
|
||||
"wallet.government.HuntingLicense": {
|
||||
# Outdoor License
|
||||
"icon": "BUSINESS_CARD",
|
||||
},
|
||||
"wallet.government.Passport": {
|
||||
# Passport
|
||||
"icon": "BUSINESS_CARD",
|
||||
},
|
||||
"passwords.Password": {
|
||||
# Password
|
||||
"icon": "KEY",
|
||||
},
|
||||
"wallet.membership.RewardProgram": {
|
||||
# Reward Program
|
||||
"icon": "PERCENT_SIGN",
|
||||
},
|
||||
"securenotes.SecureNote": {
|
||||
# Secure Note
|
||||
"icon": "POST_IT",
|
||||
},
|
||||
"wallet.computer.UnixServer": {
|
||||
# Server
|
||||
"icon": "SERVER_2",
|
||||
},
|
||||
"wallet.government.SsnUS": {
|
||||
# Social Security Number
|
||||
"icon": "BUSINESS_CARD",
|
||||
},
|
||||
"wallet.computer.License": {
|
||||
# Software License
|
||||
"icon": "CARDBOARD",
|
||||
},
|
||||
"wallet.computer.Router": {
|
||||
# Wireless Router
|
||||
"icon": "12",
|
||||
},
|
||||
}
|
||||
# Load record mappings from Yaml file
|
||||
RECORD_MAP = yaml.load(open("mappings.yml", "rt"))
|
||||
|
||||
for item in opif:
|
||||
|
||||
|
79
mappings.yml
Normal file
79
mappings.yml
Normal file
@ -0,0 +1,79 @@
|
||||
# Mapping of 1P types for best conversion
|
||||
|
||||
# API Credential
|
||||
"112":
|
||||
icon: GEAR
|
||||
|
||||
# Bank Account
|
||||
wallet.financial.BankAccountUS:
|
||||
icon: DOLLAR_SIGN
|
||||
|
||||
# Credit Card
|
||||
wallet.financial.CreditCard:
|
||||
icon: DOLLAR_SIGN
|
||||
|
||||
# Database
|
||||
wallet.computer.Database:
|
||||
icon: SERVER
|
||||
|
||||
# Not exported: Document
|
||||
# Driver License
|
||||
wallet.government.DriversLicense:
|
||||
icon: BUSINESS_CARD
|
||||
|
||||
# Email Account
|
||||
wallet.onlineservices.Email.v2:
|
||||
icon: ENVELOPE
|
||||
|
||||
# Identity
|
||||
identities.Identity:
|
||||
icon: BUSINESS_CARD
|
||||
|
||||
# Login
|
||||
webforms.WebForm:
|
||||
icon: MANAGER
|
||||
|
||||
# Medical Record
|
||||
"113":
|
||||
icon: WARNING_SIGN
|
||||
|
||||
# Membership
|
||||
wallet.membership.Membership:
|
||||
icon: BUSINESS_CARD
|
||||
|
||||
# Outdoor License
|
||||
wallet.government.HuntingLicense:
|
||||
icon: BUSINESS_CARD
|
||||
|
||||
# Passport
|
||||
wallet.government.Passport:
|
||||
icon: BUSINESS_CARD
|
||||
|
||||
# Password
|
||||
passwords.Password:
|
||||
icon: KEY
|
||||
|
||||
# Reward Program
|
||||
wallet.membership.RewardProgram:
|
||||
icon: PERCENT_SIGN
|
||||
|
||||
# Secure Note
|
||||
securenotes.SecureNote:
|
||||
icon: POST_IT
|
||||
|
||||
# Server
|
||||
wallet.computer.UnixServer:
|
||||
icon: SERVER_2
|
||||
|
||||
# Social Security Number
|
||||
wallet.government.SsnUS:
|
||||
icon: BUSINESS_CARD
|
||||
|
||||
# Software License
|
||||
wallet.computer.License:
|
||||
icon: CARDBOARD
|
||||
|
||||
# Wireless Router
|
||||
wallet.computer.Router:
|
||||
icon: "12"
|
||||
|
Loading…
x
Reference in New Issue
Block a user