Hanno Böck commited on 2024-03-10 12:02:36
Zeige 1 geänderte Dateien mit 6 Einfügungen und 1 Löschungen.
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
#!/usr/bin/python3 |
2 | 2 |
|
3 |
+import argparse |
|
3 | 4 |
import io |
4 | 5 |
import os |
5 | 6 |
import pathlib |
... | ... |
@@ -10,6 +11,10 @@ import urllib.request |
10 | 11 |
DBURL = "https://freewvsdb.schokokeks.org/" |
11 | 12 |
dbpaths = ["/var/lib/freewvs/", str(pathlib.Path.home()) + "/.cache/freewvs/"] |
12 | 13 |
|
14 |
+ap = argparse.ArgumentParser() |
|
15 |
+ap.add_argument("-f", "--force", action="store_true", help="Force update") |
|
16 |
+args = ap.parse_args() |
|
17 |
+ |
|
13 | 18 |
target = False |
14 | 19 |
for dbpath in dbpaths: |
15 | 20 |
if not os.path.isdir(dbpath): |
... | ... |
@@ -31,7 +36,7 @@ if os.path.isfile(target + "timestamp"): |
31 | 36 |
|
32 | 37 |
new = int(urllib.request.urlopen(DBURL + "freewvsdb.timestamp").read()) |
33 | 38 |
|
34 |
-if new == old: |
|
39 |
+if new == old and not args.force: |
|
35 | 40 |
# nothing to do |
36 | 41 |
sys.exit() |
37 | 42 |
|
38 | 43 |