-
Notifications
You must be signed in to change notification settings - Fork 8
Adding Cameras to the Database
##Format of text file being added to database When adding cameras to the database the first step is to make sure you have everything you need. If you are ready for this step that means you have already parsed a website and have a text file of information that was outputted by your parsing script. The format of this text file should adhere to the following guidelines. The first line in the file should contain the names of the fields you are adding to the database. At minimum this should include country, city, snapshot_url, latitude and longitude. If the country is USA, state should also be a field. Optionally you can include a description field with more information about this location. Each field should be separated by a '#'. Your first line should look something like this:
country#state#city#snapshot_url#latitude#longitude
The order in which these fields appear does not matter as long as the data on the following lines matches up to the position specified by the header. The rest of the text file should contain the information you obtained with your script, separated by '#' and in the order specified by your header.
Once you have verified that your text file follows these rules you are ready to add the cameras to the database.
##Adding cameras to database Compared to parsing cameras adding cameras is relatively simple. Navigate to NetworkCameras/Discovery/Add_cameras/ while logged into the development machine. Then enter:
python addCamera.py filepath non_ip
Where 'filepath' is the filepath to the output textfile generated by your parsing script. If you are adding IP cameras 'non_ip' would be replaced by 'ip'
You will be prompted to enter the username and password for the database. If you do not know the username and password check this page for instructions on how to find it. After you have successfully logged on to the database you will be asked a series of questions. When it asks you for a temp table name enter the name of the website (e.g. What shows up on the header of the website using '_' as spaces), for source enter the base url, replacing '.' with '_'. For example if your source website is 'bbc.uk' your source would be 'bbc_uk'. It will then ask if the information it found was correct, look over it and verify with either a 'y' or an 'n'. Lastly it will ask you if the cameras you are trying to add are traffic cameras, answer with a 'y' or an 'n'. If the cameras are added successfully the console will show a readout of how many fields were changed in the database table.
After you have successfully added your cameras, don't forget to delete your text file.
Please note that the cameras you add to the database will not show up on the website right away. The above process adds the cameras to the development database but someone will need to merge this database with the production database before they are visible on the website. Instructions on how to do that are located here.
©️ 2016 Cam2 Research Group