Import History Visualized by Code Swarm

Talk about random things WiFiDB related, either new things, concepts, or issues to work out in code.
Post Reply
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Import History Visualized by Code Swarm

Post by pferland »

CodeSwarm Github page: https://code.google.com/p/codeswarm/
The Fork I used: https://github.com/rictic/code_swarm

YouTube Video: http://www.youtube.com/watch?v=iMQTmFTceTk

Code to gather data for use: https://github.com/pferland/WiFiDB/blob ... gen_xml.py
To use swarm_gen_xml.py you will need a modified config file from the current stable version of WiFiDB in a ini format. the python script is made to use config.ini but the current incarnation of WiFiDB uses config.inc.php.
There is also a php version of the script that is quite a bit older, that I have not updated as of yet. So it may or may not work.

Link to Sample config.ini file for people that want to convert their config.inc.php to config.ini to be used for the swarm_gen_xml.py script:
Daemon Config.ini: https://github.com/pferland/WiFiDB/wiki ... Config.ini
www config.ini: https://github.com/pferland/WiFiDB/wiki/WWW-config.ini



Now for the description.


Swarm_gen_xml.py – Connects to the WiFiDB SQL server and extracts the Imports. The only files used from the rest of the project for this script is the [wifidb/tools]/config/config.ini and [wifidb/www]/lib/config.ini files. Grabs the import date/time, Import Author, and AP ID’s and puts them into the events.xml file to be used by codeswarm. Next version is going to be updated to work with the dev version of the SQL server, and also use the API to grab the data so people do not need direct access to the SQL server.


Sample of Events.xml

Code: Select all

<?xml version="1.0"?>
<file_events>
<event date="1386700719000" filename="244556.wpa" author="glr" />
<event date="1386700719000" filename="244557.open" author="glr" />
<event date="1386700719000" filename="244558.wep" author="glr" />
</file_events>

Events.xml is generated by the swarm_gen_xml.py script. Each event has a timestamp in seconds, the filename is the AP ID and the security type for the AP, author is the Import Author.


Sample.config

Code: Select all

ColorAssign1="WEP", ".*wep.*", 0,0,255, 0,0,255
ColorAssign2="WPA", ".*wpa.*", 0,255,255, 0,255,255
ColorAssign3="Open", ".*open.*", 255,0,0, 255,0,0

TakeSnapshots=true
Only three CollorAssign# labels are supported for WiFiDB imports right now, wep, wpa, and open. The color for each is set at the end of each row, put the same RGB color twice.
TakeSnapshots is required, otherwise the frames that are generated are not stored, and then we cannot generate a video from the frames.


Browse to the path that is holding the generated PNG files, and run:

Code: Select all

ffmpeg -r 10/1 -pattern_type glob -i '*.png' -c:v libx264 out.mp4
Options Breakdown:
  • -r 10/1 = 10 frames per second (10 images shown per second)
    -pattern_type glob = Use the * for the pattern-I ‘*.png’ Input file is a pattern based png image.
    -vcodec libx264 = Use the x264 codec
    out.mp4 =The output file
The best acceleration you can get on a Mac is 9.8ms^2
Post Reply