aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/notectl.py7
-rw-r--r--utils/postutil.py2
2 files changed, 6 insertions, 3 deletions
diff --git a/utils/notectl.py b/utils/notectl.py
index a2e4a19..f64a371 100644
--- a/utils/notectl.py
+++ b/utils/notectl.py
@@ -31,7 +31,10 @@ def new_post():
fn = os.path.join(dir, "note.txt")
with open(fn, "w"): pass
edit_file(fn)
- ts = time.time_ns() // 10 ** 9
+ ts = time.time_ns() // 10 ** 9
+ if len(sys.argv) >= 3:
+ dt = datetime.fromisoformat(sys.argv[2])
+ ts = int(dt.timestamp())
postpath = postutil.move_post(fn, ts)
p = postutil.process_post(postpath, False)
if len(p.content) == 0 and len(p.media) == 0:
@@ -112,7 +115,7 @@ Sync all local data to the configured remote host for serving.
'''
def sync_remote():
conf.require()
- subprocess.run(["rsync", "-azv", "--exclude=posts", "--exclude=media_dropoff", conf.LOCAL_DATA_ROOT + "/", conf.SYNC_TARGET])
+ subprocess.run(["rsync", "-rLptgoDzv", "--exclude=posts", "--exclude=media_dropoff", conf.LOCAL_DATA_ROOT + "/", conf.SYNC_TARGET])
'''
Create a new notekins instance with all files and directories that it expects.
diff --git a/utils/postutil.py b/utils/postutil.py
index c978d3e..f2e1a3d 100644
--- a/utils/postutil.py
+++ b/utils/postutil.py
@@ -142,7 +142,7 @@ def process_post(fn, is_updating):
if destm is None:
d = datetime.fromtimestamp(ts, tz=timezone.utc)
destm = os.path.join("media_orig", str(d.year))
- destm = os.path.join(destm, f"{ts}-{os.path.basename(fn)}")
+ destm = os.path.join(destm, f"{ts}-{os.path.basename(m)}")
if not os.path.isfile(os.path.join(conf.LOCAL_DATA_ROOT, destm)):
raise FileNotFoundError(f"Cannot find original media ({destm})")
thumbnail = None