mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
Guard against network failures in getDatabaseDate()
When updating use the date from the diff file instead as we are guaranteed to get this if the file has been successfully loaded.
This commit is contained in:
33
utils/osm_file_date.py
Executable file
33
utils/osm_file_date.py
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import osmium
|
||||
import sys
|
||||
import datetime
|
||||
|
||||
|
||||
class Datecounter(osmium.SimpleHandler):
|
||||
|
||||
filedate = None
|
||||
|
||||
def date(self, o):
|
||||
ts = o.timestamp
|
||||
if self.filedate is None or ts > self.filedate:
|
||||
self.filedate = ts
|
||||
|
||||
node = date
|
||||
way = date
|
||||
relation = date
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python osm_file_date.py <osmfile>")
|
||||
sys.exit(-1)
|
||||
|
||||
h = Datecounter()
|
||||
|
||||
h.apply_file(sys.argv[1])
|
||||
|
||||
print(h.filedate)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user