Last active
August 29, 2015 14:04
-
-
Save omichelsen/e24ae076cb331403860f to your computer and use it in GitHub Desktop.
Parse MediaDeviceService from LogEntries
This file contains 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 characters
[ | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":169359380359,"t":1406294298153,"m":"94.18.214.22 aog5x7dc INFO 'MediaDeviceService.getDevices.devices.video [\"FaceTime HD Camera (Display) (05ac:1112)\",\"FaceTime HD Camera (PUF6:VVDR)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":123643402383,"t":1406294317904,"m":"66.225.159.5 3197oner INFO 'MediaDeviceService.getDevices.devices.video []'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":71475116496,"t":1406294381007,"m":"69.14.193.178 qu2r7yz2 INFO 'MediaDeviceService.getDevices.devices.video [\"FaceTime HD Camera (Built-in) (05ac:8509)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":169458215047,"t":1406294454260,"m":"12.168.155.42 dolfhlfu INFO 'MediaDeviceService.getDevices.devices.video [\"Integrated Webcam (0c45:6433)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":123786187023,"t":1406294521582,"m":"69.14.193.178 qu2r7yz2 INFO 'MediaDeviceService.getDevices.devices.video [\"FaceTime HD Camera (Built-in) (05ac:8509)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":169594052551,"t":1406294672557,"m":"69.14.193.178 qu2r7yz2 INFO 'MediaDeviceService.getDevices.devices.video [\"FaceTime HD Camera (Built-in) (05ac:8509)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":123931948623,"t":1406294740288,"m":"67.241.15.199 ikeelfq0 INFO 'MediaDeviceService.getDevices.devices.video [\"Integrated Webcam (05ca:18a0)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":169646489607,"t":1406294767543,"m":"97.77.63.62 a8kmwa5p INFO 'MediaDeviceService.getDevices.devices.video [\"FaceTime HD Camera (Built-in) (05ac:8510)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":169656650375,"t":1406294781921,"m":"122.167.182.164 386nw4ao INFO 'MediaDeviceService.getDevices.devices.video [\"1.3M WebCam (0402:9665)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":169672611015,"t":1406294810024,"m":"122.167.182.164 386nw4ao INFO 'MediaDeviceService.getDevices.devices.video [\"1.3M WebCam (0402:9665)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":123983928335,"t":1406294814777,"m":"108.93.184.17 uzyh6aoq INFO 'MediaDeviceService.getDevices.devices.video []'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":71660117200,"t":1406294822640,"m":"179.210.175.154 0theomst INFO 'MediaDeviceService.getDevices.devices.video [\"Integrated Webcam (064e:8120)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":71683321296,"t":1406294872661,"m":"179.210.175.154 0theomst INFO 'MediaDeviceService.getDevices.devices.video [\"Integrated Webcam (064e:8120)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":71712255504,"t":1406294928788,"m":"72.74.243.227 b44a5xec INFO 'MediaDeviceService.getDevices.devices.video [\"ThinkVantage Virtual Camera\",\"Integrated Camera (5986:02d2)\"]'"}, | |
{"r":"353a81d9-091e-479c-9b07-fc1e271d91a5","s":71715421328,"t":1406294935160,"m":"108.93.184.17 uzyh6aoq INFO 'MediaDeviceService.getDevices.devices.video []'"} | |
] |
This file contains 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 characters
var fs = require('fs'); | |
var data = JSON.parse(fs.readFileSync(process.argv[2] || 'audio.json')); | |
var filter = /(\[.*\])\'$/; | |
function clean(string) { | |
return string.replace(/\\['"]/g,"'") | |
.replace(/\s\(\w{4}\:\w{4}\)/gi, ""); | |
} | |
function parse(list) { | |
return data.map(function (d) { | |
return JSON.parse(clean(filter.exec(d.m)[1])); | |
}); | |
} | |
function flatten(list) { | |
var merged = []; | |
merged = merged.concat.apply(merged, list); | |
return merged; | |
} | |
function unique(list) { | |
var unique = {}; | |
list.forEach(function (d) { | |
unique[d] = (unique[d] || 0) + 1; | |
}); | |
return unique; | |
} | |
function list(listObj) { | |
var arr = []; | |
for (var prop in listObj) { | |
arr.push([prop, listObj[prop]]); | |
} | |
return arr; | |
} | |
function order(a, b) { | |
return b[1] - a[1]; | |
} | |
var out = list(unique(flatten(parse(data)))).sort(order); | |
console.log(out); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment