all repos — dotfiles @ 4412588453728042b59daa5b849cfa24544183c4

linux dotfiles

Update scripts/pd

- using 'os.system' now instead of 'subprocess.run'
- using rclone instead of dropbox
prithugoswami prithugoswami524@gmail.com
Mon, 07 May 2018 20:39:20 +0530
commit

4412588453728042b59daa5b849cfa24544183c4

parent

0ef274c209b57ad1bfb5ba5a30f6eb2e3a729d2c

1 files changed, 13 insertions(+), 5 deletions(-)

jump to
M scripts/pdscripts/pd

@@ -5,23 +5,27 @@ # I use this for my journal.

import os import datetime -import sys import tempfile -import subprocess, shlex -file_path = r'/home/prithu/Dropbox/Tasker/pd.txt' +file_path = r'/home/prithu/Dropbox/pd/pd.txt' entry = None with tempfile.NamedTemporaryFile(suffix='.pdtemp') as temp: command = "vim {}".format(temp.name) - subprocess.run(shlex.split(command)) + os.system(command) entry = open(temp.name, 'r').read() if entry == '': print("Nothing was entered...") exit() +print("Fetching changes...") +if not os.system('rclone sync drop:/pd/ ~/Dropbox/pd/'): + print("Done") +else: + print("Something went wrong") + with open(file_path, 'a', encoding='utf8') as fp: dt = datetime.datetime.now() date_string = dt.strftime('%a, %d %b %Y')

@@ -31,4 +35,8 @@

fp.write('\n\n\n===============================\n' + date_and_time + '\n') fp.write(entry) -subprocess.run(['dropbox']) +print("Pushing changes...") +if not os.system('rclone sync ~/Dropbox/pd/ drop:/pd/'): + print("Done") +else: + print("Something went wrong")