mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-11-24 06:22:08 +03:00
896421fe9f
Don't do anything if a downloaded diff is empty after all (may be happening when an empty diff was published upstream). Correctly compute the waiting interval before checking for new data. As the interval is now computed based on the date of the newest object in the database, the configured intervals need to be adjusted slightly to take into account the time it takes for the server to publish a diff.
35 lines
568 B
Python
Executable File
35 lines
568 B
Python
Executable File
#!/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])
|
|
|
|
if h.filedate is None:
|
|
exit(5)
|
|
|
|
print(h.filedate)
|