I find it pretty cool what's possible by combining several different web services.
The complete script is only useful with a Wowza Media Server (http://www.wowza.com/) - a great streaming server for video and audio in different formats, also available on Amazon EC2.
But there are several parts of the functionality that should be valuable for other applications, as they demonstrate how to retrieve ip geolocation information using the Quova web service and display the info in a listview and on Google Maps.
The script does the following:
- It expects the dns (web address) of the Wowza Media Server as the only parameter. If you start it without a parameter, it offers to use a test file (which you would have to upload to Amazon S3 first).
- It retrieves IP addresses and additional information from the Wowza Media Server and parses them into an array.
- It uses the API of the Quova web service (http://developer.quova.com/) to retrieve geolocation information for each IP address and adds the data to the array. The script uses location down to state and city, latitude/longitude for map placement, internet provider info, and user time zone. See Quova documentation for the details of all the info that’s returned by the service. The Quova API is free for up to 1000 queries per day and not more than 2 queries per second. The script tracks and enforces these limits.
- It displays the results in a list, sorted by location.
- Optionally it displays the data on a Google map. For this purpose it creates a KML file, uploads it to Amazon S3 (the file needs to accessible to Google), and opens a Google Maps page with the file as input.
The attached zip file contains the most important files relevant for this application. You might have to download an additional file.
Put all local files into the script directory and upload the others to Amazon S3 or the Wowza Media Server as necessary.
- wmsUserInfo.au3: Script file source code
- wmsDisplayUserInfo.kxf: Koda Form Designer source for form used by script
- quova.ini: ini file for Quova service. Enter the key and shared secret that you get from Quova after signing up. The ini file is also used to track the number of queries per day.
- s3.ini: ini file for Amazon S3 service. Enter your keys and the bucket name. Only needed if you want to use S3 for the KML file or a test file.
- serverinfo.xml: a sample file with user information from the Wowza Media Server. If you put it into the S3 bucket configured in the s3.ini file you can test the complete script without using a Wowza Media Server.
- xwmshttpserverinfoxml.jar and XwmsHTTPServerInfoXML.java: This are the Java source and jar files of a customized version of the Wowza Media Server module that provides the user information. The only change from the standard module is that it also outputs a query string passed to the streaming application at start time. This allows to distinguish between different streams on the same application. The script checks whether the customized version is used and parses accordingly. The jar file needs to be loaded on the Wowza Media Server at startup. See Wowza documentation for details.
- As said above, the free Quova service allows a maximum of 1000 queries per day. Quova queries include a timestamp in GMT time. I assume that they count per GMT day, and that is what the script does.
- You can change the color of the placemarks on the Google map according to any criteria that you have available in the script if you change the code accordingly. I don't have any official documentation about the available colors, so it is just trial and error. The default color is blue.
- The KML file needs to be in a location that's accessible to Google, so it cannot be on your local computer. If you have a website, you could also use ftp to upload it to your website and use that url with Google maps. It's just something you would have to automate yourself.
- If the ip address of the computer that runs the script is in the list of ip addresses, the script uses the time zone information from this computer to calculate local times for the other ip addresses. You could just add it to the list if it wasn't included and you want the information.
- The script is working for me, but I have only used it with relatively small numbers of ip addresses. So I am not sure about performance and behavior if it reaches the limits. In particular I don't know how Google maps behaves if the KML file contains a large number of placemarks. Be sure to test!