Created
November 12, 2021 21:00
Revisions
-
schnatterer created this gist
Nov 12, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ Restoring android call logs backed up via myPhoneExplorer (unable to restore with Android 11) using a different app ([Phone Backup and Restore](https://play.google.com/store/apps/details?id=com.phone.backup.restore)). * Export all call logs from myPhoneExplorer as CSV (Tested with version 1.9.0) * Check out `mpe-csv-2-json.js` and `package.json` from this gist * `npm install` * `./mpe-csv-2-json.js your.csv > 2021-10-24, 09:02:25.sbl` * Copy the `.sbl` file to where "Phone Backup and Restore" can read it. In Version 1.6.6 it's `/storage/emulated/0/Android/data/com.phone.backup.restore/files/` (which requires root to access :-/) * Open Backup and restore app and restore your call logs file This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ #!/usr/bin/env node const fs = require('fs'); const csv = require('csv-parser'); const moment = require('moment'); const out = {}; out.f = [] function storageToE(Storage) { // RC = Received Call? -> 1 // DC = Dialed Call ?-> 2 // MC = Missed Call? -> 3 if (Storage=== 'RC') { return 1 } if (Storage=== 'DC') { return 2 } if (Storage ==='MC') { return 3 } throw `unknown Storage: ${Storage}` } if (process.argv.length <= 2) { console.log("Usage: " + __filename + " <input.csv>"); process.exit(-1); } fs.createReadStream(process.argv[2]) .pipe(csv({ separator: ';' })) .on('data', function(data){ try { let call = {}; call.a = data.Nummer call.b = data.Name call.c = moment(data.Zeitpunkt, "DD.MM.YYYY hh:mm").valueOf(); call.d = data.Dauer call.e = storageToE(data.Storage) out.f.push(call) } catch(err) { throw err; } }) .on('end',function(){ let str = JSON.stringify(out); str = JSON.stringify(out, null, 4); // (Optional) beautiful indented output. console.log(str); }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ { "name": "mpe-csv-2-json", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "version": "1.0.0", "license": "ISC", "dependencies": { "csv-parser": "^3.0.0", "moment": "^2.29.1" }, "devDependencies": {} }, "node_modules/csv-parser": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/csv-parser/-/csv-parser-3.0.0.tgz", "integrity": "sha512-s6OYSXAK3IdKqYO33y09jhypG/bSDHPuyCme/IdEHfWpLf/jKcpitVFyOC6UemgGk8v7Q5u2XE0vvwmanxhGlQ==", "dependencies": { "minimist": "^1.2.0" }, "bin": { "csv-parser": "bin/csv-parser" }, "engines": { "node": ">= 10" } }, "node_modules/minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "node_modules/moment": { "version": "2.29.1", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==", "engines": { "node": "*" } } }, "dependencies": { "csv-parser": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/csv-parser/-/csv-parser-3.0.0.tgz", "integrity": "sha512-s6OYSXAK3IdKqYO33y09jhypG/bSDHPuyCme/IdEHfWpLf/jKcpitVFyOC6UemgGk8v7Q5u2XE0vvwmanxhGlQ==", "requires": { "minimist": "^1.2.0" } }, "minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "moment": { "version": "2.29.1", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" } } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ { "name": "mpe-csv-2-json", "version": "1.0.0", "description": "", "main": "mpe-csv-2-json.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "csv-parser": "^3.0.0", "moment": "^2.29.1" }, "devDependencies": {} }