aboutsummaryrefslogtreecommitdiff
path: root/utils/notectl.py
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2024-07-25 03:41:45 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2024-07-25 03:41:45 -0400
commit2e8481b7739e04bc83b1780a3aaf3e44d5baae25 (patch)
tree7fd04f281787b0fa97924197eab2a6a313962b08 /utils/notectl.py
parentb736068ee7b82e05c2ede8bc48ace7ffa4709e29 (diff)
downloadnotekins-2e8481b7739e04bc83b1780a3aaf3e44d5baae25.tar.xz
Fix posts with images breaking regen.
Allow setting a time when making a post ("unsupported" feature).
Diffstat (limited to 'utils/notectl.py')
-rw-r--r--utils/notectl.py7
1 files changed, 5 insertions, 2 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.