diff --git a/Python/get_location_data.py b/Python/get_location_data.py new file mode 100644 index 0000000..5d2049d --- /dev/null +++ b/Python/get_location_data.py @@ -0,0 +1,50 @@ +# Retrieve location info from Google Maps +# Tested in Python 2.7 +# I used this script to get all information about GPS coordinates. +# return Country,Town,Street or None when Google Maps breaks +# Sometimes Google gives an error by multiple requests +# +# You can contact me by e-mail at floris@entermi.nl. +# +# Last updated 18 December, 2017. +# +# Floris van Enter +# http://entermi.nl + +import urllib.request +import json + +# define the function +def getplace(lat, lon): + lat = str(lat) + lon = str(lon) + url = "http://maps.googleapis.com/maps/api/geocode/json?" + url += "latlng=%s,%s&sensor=false" % (lat, lon) + v = urllib.request.urlopen(url).read() + j = json.loads(v) + + # Sometimes Google gives no data, check + try: + components = j['results'][0]['address_components'] + except: + # Return message that Google failed + print('Google Shizzle') + return None + else: + # Return data + country = town = street = None + for c in components: + if "route" in c['types']: + street = c['long_name'] + if "country" in c['types']: + country = c['long_name'] + if "locality" in c['types']: + town = c['long_name'] + + print(lat + ", " + lon + " = " + str(country) + ", " + str(town) + ", " + str(street)) + return (str(country) + "," + str(town) + "," + str(street)) + +## Test runs +# print(getplace(47.591737, 2.759478)) +# print(getplace(51.2, 0.1)) +# print(getplace(51.3, 0.1)) \ No newline at end of file diff --git a/Python/handbrake_convert_video.sh b/Python/handbrake_convert_video.sh index 164b1e0..0d7ed07 100755 --- a/Python/handbrake_convert_video.sh +++ b/Python/handbrake_convert_video.sh @@ -17,6 +17,7 @@ DEST="/Users/floris/Downloads/done/" DEST_EXT=mp4 HANDBRAKE_CLI=/Applications/HandBrakeCLI +# walkthrough all files in folder and put them in the HandBrakeCLI for FILE in "$SRC"/* do filename=$(basename "$FILE")