From 9d18f5b3aa6f6900e4a5b1608af2a502c586c46e Mon Sep 17 00:00:00 2001 From: DumbMachine Date: Wed, 26 Jun 2019 15:54:07 +0530 Subject: [PATCH 1/3] . --- README.md | 1 + setup.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3eec7fd..db067a0 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ - git - If not installed visit, [Git](https://git-scm.com/downloads) - python + - IF note installed visit, [Python](https://www.python.org/downloads/) - boostnote (also know where it is installed) - If not installed visit, [BoostNote](https://boostnote.io/#download) ## Installation: diff --git a/setup.py b/setup.py index b284b79..cb79f95 100644 --- a/setup.py +++ b/setup.py @@ -20,20 +20,19 @@ maintainer_email="ratin.kumar.2k@gmail.com", url="https://github.com/DumbMachine/syncboostnote", download_url="https://github.com/DumbMachine/syncboostnote/releases", - license="unlicensed", + license="GNU-gpl3", test_suite="tests", # setup_requires = ["pytest-runner"], # tests_require = ["pytest"], classifiers=[ - # "Development Status :: 1 - Planning", - "Development Status :: 2 - Pre-Alpha", - # "Development Status :: 3 - Alpha", - # "Development Status :: 4 - Beta", - # "Development Status :: 5 - Production/Stable", - # "Development Status :: 6 - Mature", + # "Development Status :: 1 - Planning", + # "Development Status :: 2 - Pre-Alpha", + "Development Status :: 3 - Alpha", + # "Development Status :: 4 - Beta", + # "Development Status :: 5 - Production/Stable", + # "Development Status :: 6 - Mature", "Intended Audience :: Developers", "Intended Audience :: Information Technology", - "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Operating System :: MacOS", "Operating System :: POSIX", From be4c3b9674be0b66b9e28491bdc07549f18f94a8 Mon Sep 17 00:00:00 2001 From: DumbMachine Date: Wed, 26 Jun 2019 18:34:42 +0530 Subject: [PATCH 2/3] update_change is now smarter --- syncboostnote/bns.yaml | 6 +- syncboostnote/cli.py | 26 ++++--- syncboostnote/config.py | 17 +++-- syncboostnote/test.py | 13 +++- syncboostnote/utils.py | 160 +++++++++++++++++++++------------------- 5 files changed, 121 insertions(+), 101 deletions(-) diff --git a/syncboostnote/bns.yaml b/syncboostnote/bns.yaml index a2f17ff..053364f 100644 --- a/syncboostnote/bns.yaml +++ b/syncboostnote/bns.yaml @@ -1,5 +1,5 @@ BOOSTNOTE_PATH: default # default: /home/$USER/Boostnote -FREQUENCY: hourly # ["hourly", "daily", "weekly", "onchange", "manual"] +FREQUENCY: manual # ["hourly", "daily", "weekly", "onchange", "manual"] Others will be implemented soon. SHIELDS: true -SHIELDS_TYPE: for-the-badge # default: for-the-badge -TIME: 1200 +SHIELDS_TYPE: for-the-badge # ['plastic' , 'flat', 'flat-square', 'for-the-badge', 'popout', 'popout-square', 'social'] +# TIME: 1200 Not recommended diff --git a/syncboostnote/cli.py b/syncboostnote/cli.py index c546106..c2d94f9 100644 --- a/syncboostnote/cli.py +++ b/syncboostnote/cli.py @@ -11,7 +11,7 @@ import yaml from colorama import Fore, init -from .config import Config, config_reader, interactive +from .config import Config, config_reader, interactive, generate_config from .utils import initialize from .test import sync @@ -41,12 +41,12 @@ def options(): help="Location of the BoostNotes local storage.", default=os.path.join(home, 'Boostnote')) - ap.add_argument( - "-ini", - "--init", - required=False, - help="Initialise the CLI", - default=False) + # ap.add_argument( + # "-ini", + # "--init", + # required=False, + # help="Initialise the CLI", + # default=False) ap.add_argument( "--sync", @@ -55,8 +55,8 @@ def options(): ) ap.add_argument( - "-cus", - "--custom", + "-co", + "--config", required=False, help="Location of the config.yaml/config.yml file", default=False) @@ -64,9 +64,9 @@ def options(): ap.add_argument( "-g", "--generate", - required=False, help="Generate config.yaml file for ya", - default=False) + action='/open?url=https%3A%2F%2Fgithub.com%2FDumbMachine%2FSyncBoostNote%2Fcompare%2Fstore_true' + ) ap.add_argument( "-i", @@ -85,8 +85,10 @@ def starter(args): ''' if args['sync']: sync() + elif args['generate']: + return generate_config() + elif args['interactive']: - print('>>> Interactive <<<') return interactive() elif args['location']: diff --git a/syncboostnote/config.py b/syncboostnote/config.py index 0e99157..a35b7f7 100644 --- a/syncboostnote/config.py +++ b/syncboostnote/config.py @@ -58,14 +58,15 @@ def hook(): return result -def create_config(location='.'): +def generate_config(): ''' Creates a default config for users to see. ''' - yaml.dump( - Config, - open(os.path.join(location, 'bns.yaml'), 'w+') - ) - - -# create_config() + open( + 'config.yaml', 'w+' + ).write('''BOOSTNOTE_PATH: default # default: /home/$USER/Boostnote +FREQUENCY: manual # ["hourly", "daily", "weekly", "onchange", "manual"] Others will be implemented soon. +SHIELDS: true +SHIELDS_TYPE: for-the-badge # ['plastic' , 'flat', 'flat-square', 'for-the-badge', 'popout', 'popout-square', 'social'] +# TIME: 1200 Not recommended +''') diff --git a/syncboostnote/test.py b/syncboostnote/test.py index 1f1b585..4d81e2a 100644 --- a/syncboostnote/test.py +++ b/syncboostnote/test.py @@ -24,11 +24,18 @@ def sync( os.system("git push origin master") else: print("Adding all the things") - os.system("git add -A") + p = subprocess.Popen( + "git add -A", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + # print("Commiting all the things") - os.system("git commit -m '.'") + p1 = subprocess.Popen( + f"git commit -m '{datetime.now()}'", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + for line in p1.stdout.readlines()[2:]: + print(line.decode("utf-8")) + # print("Pushing all the things") - os.system("git push origin master") + p2 = subprocess.Popen( + "git push origin master", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) retval = p.wait() diff --git a/syncboostnote/utils.py b/syncboostnote/utils.py index 1a4849f..1c07de2 100644 --- a/syncboostnote/utils.py +++ b/syncboostnote/utils.py @@ -8,7 +8,7 @@ from glob import glob import cson - +import subprocess from .test import git_update home = os.path.expanduser("~") @@ -21,7 +21,7 @@ def initialize(config): - Make directory for storing notes. - Create History # ! - Initialize the git repo. - ------------------------------------ + -----------------s------------------- called: - Is called upon using --initialize flag of the CLI ''' @@ -120,8 +120,8 @@ def ultimate(config): - updates the .md files, which require it. ----------------------------------------------- ''' - print("Searching for BOOSTNOTE_PATH", end='\r') - sys.stdout.flush() + # print("Searching for BOOSTNOTE_PATH", end='\r') + # sys.stdout.flush() if not os.path.isfile(os.path.join(config['BOOSTNOTE_PATH'], 'history.json')): # Create the History json again. @@ -129,13 +129,13 @@ def ultimate(config): if boostnote_exists(config['BOOSTNOTE_PATH']): # Creating History again, as this will track if new files have been added. - sys.stdout.flush() - print("Creating History.json file", end='\r') + # sys.stdout.flush() + # print("Creating History.json file", end='\r') create_history(config['BOOSTNOTE_PATH']) - sys.stdout.flush() - print("Creation done!", end='\r') + # sys.stdout.flush() + # print("Creation done!", end='\r') history_json = json.load(open(os.path.join( config['BOOSTNOTE_PATH'], 'history.json'), 'r')) @@ -175,7 +175,8 @@ def cson_reader(location): data = cson.load(open(location, 'r')) return data else: - raise FileNotFoundError(f'The cson file at {location} was not found') + return 0 + # raise FileNotFoundError(f'The cson file at {location} was not found') def customshield( @@ -210,67 +211,67 @@ def markdown_writer(things, location, shields=True, The dict{} which contains shit that was read via the cson ''' + if things: + embels = ['isStarred', 'isTrashed', + 'updatedAt', 'type', 'folder', 'tags'] + shelds = [] + if shields: + for key in embels: + x = None + if things[key]: + if key == 'isStarred': + shelds.append(customshield( + key, '⭐', color='black', style=options['style'])) - embels = ['isStarred', 'isTrashed', - 'updatedAt', 'type', 'folder', 'tags'] - shelds = [] - if shields: - for key in embels: - x = None - if things[key]: - if key == 'isStarred': - shelds.append(customshield( - key, '⭐', color='black', style=options['style'])) - - if key == 'isTrashed': - shelds.append(customshield( - key, '🗑', color='black', style=options['style'])) - - elif key == 'updatedAt': - shelds.append(customshield( - key, things[key].split(':')[0][:-3].replace('-', '/'), color='green', style=options['style'])) - - elif key in ['type', 'folder']: - shelds.append(customshield( - key, things[key], color='blue', style=options['style'])) - - elif key == 'tags': - if options['option']: - # OPTION 1: {tag| gay} {tag| notgay} - for tag in things[key]: - shelds.append( - customshield(label='tag', message=tag, - color='purple', style=options['style']) - ) - else: - # OPTION 2: {tag| gay, notgay} - tags = [] - for tag in things[key]: - tags.append(tag) + if key == 'isTrashed': shelds.append(customshield( - label='tags', message='_'.join(tags), color='blueviolet', style=options['style'])) + key, '🗑', color='black', style=options['style'])) - file = open(os.path.join(location, - f"{things['title']}.md"), 'w+') + elif key == 'updatedAt': + shelds.append(customshield( + key, things[key].split(':')[0][:-3].replace('-', '/'), color='green', style=options['style'])) - for count, shield in enumerate(shelds): - if count != len(shelds) - 1: - file.write(shield) - file.write(' ') - else: - file.write(shield) - file.write('\n') + elif key in ['type', 'folder']: + shelds.append(customshield( + key, things[key], color='blue', style=options['style'])) + + elif key == 'tags': + if options['option']: + # OPTION 1: {tag| gay} {tag| notgay} + for tag in things[key]: + shelds.append( + customshield(label='tag', message=tag, + color='purple', style=options['style']) + ) + else: + # OPTION 2: {tag| gay, notgay} + tags = [] + for tag in things[key]: + tags.append(tag) + shelds.append(customshield( + label='tags', message='_'.join(tags), color='blueviolet', style=options['style'])) + + file = open(os.path.join(location, + f"{things['title']}.md"), 'w+') + + for count, shield in enumerate(shelds): + if count != len(shelds) - 1: + file.write(shield) + file.write(' ') + else: + file.write(shield) + file.write('\n') - try: - file.write(things['content']) + try: + file.write(things['content']) - except: - pass - try: - file.write(things['snippets']) + except: + pass + try: + file.write(things['snippets']) - except: - pass + except: + pass def get_changes( @@ -289,7 +290,7 @@ def get_changes( files = [] os.chdir(location) p = subprocess.Popen( - git_commands.status, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + "git status", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) for line in p.stdout.readlines(): # Putting checks to see if any rendered file is deleted. if '.md' in line.decode("utf-8"): @@ -309,7 +310,7 @@ def get_changes( def update_changes( location=os.path.join(home, 'Boostnote') ): - create_history(location) + # create_history(location) changed_files = get_changes() history_json = json.load(open(os.path.join( location, 'history.json'), 'r')) @@ -352,16 +353,25 @@ def update_changes( def create_history( location=os.path.join(home, 'Boostnote') ): - files = {} - for note in get_notes(): - files[note.split('/')[-1]] = { - 'title': cson.load(open(note, 'r'))['title'], - 'updated': False - } - json.dump( - files, - open(os.path.join(location, 'history.json'), 'w+') - ) + if os.path.isfile( + os.path.join(location, 'history.json') + ): + # FIle already exists, check for changes. + update_changes() + print(1) + + else: + print(3) + files = {} + for note in get_notes(): + files[note.split('/')[-1]] = { + 'title': cson.load(open(note, 'r'))['title'], + 'updated': False + } + json.dump( + files, + open(os.path.join(location, 'history.json'), 'w+') + ) def create_readme(config): From 59924a488d1682e0fa112bbfd2859f78c4b32a21 Mon Sep 17 00:00:00 2001 From: DumbMachine Date: Sat, 29 Jun 2019 22:46:13 +0530 Subject: [PATCH 3/3] =?UTF-8?q?i=20guess,=20everything=20works=20now=20?= =?UTF-8?q?=F0=9F=A7=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++---- setup.py | 15 ++++---- syncboostnote/cli.py | 15 +------- syncboostnote/config.py | 1 - syncboostnote/config.yaml | 7 ---- syncboostnote/history.json | 38 --------------------- syncboostnote/test.py | 70 -------------------------------------- syncboostnote/utils.py | 60 +++++++++++++------------------- 8 files changed, 35 insertions(+), 181 deletions(-) delete mode 100644 syncboostnote/config.yaml delete mode 100644 syncboostnote/history.json diff --git a/README.md b/README.md index db067a0..578e6af 100644 --- a/README.md +++ b/README.md @@ -115,15 +115,11 @@ Everything up-to-date ``` ![image](https://user-images.githubusercontent.com/23381512/60123229-9a42a380-97a4-11e9-9da0-e38b4460933d.png) +## Example of Repository Generated can be found [here](https://github.com/DumbMachine/SyncBoostNoteExample). TODOS: -- [ ] Sorting tags: - - [ ] Sort the names by tag. - - [ ] Sort the names by date. - - [ ] sort the names by name (alphabetically) -- [ ] Delete ``*.md`` file ``*.cson`` has been deleted. -- [ ] Brings in oops. -- [ ] 😢😢😢 Anything other than ``INTERACTIVE`` is executed twice, dunno why pliz halp. +- [ ] Order Shields inline, ( Dates in one line, tags in one, folder specific in one ) + ## Thanks to this repo: - [pycson](https://github.com/avakar/pycson) - This helped in saving me alot of time. diff --git a/setup.py b/setup.py index cb79f95..45b41d1 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ packages=find_packages(exclude=["tests"]), scripts=[], description="CLI tool to help syncing BoostNote notes.", - long_description="Longer Desciption", + long_description="A simple CLI, created in Python, to help users to Sync their notes created in BoostNote Application with their Github Account. Along with syncing, it also creates a repo with a beautiful layout and interface to consume the notes on mobile devices.", author="Ratin Kumar", author_email="ratin.kumar.2k@gmail.com", maintainer="Ratin Kumar (@DumbMachine)", @@ -25,15 +25,14 @@ # setup_requires = ["pytest-runner"], # tests_require = ["pytest"], classifiers=[ - # "Development Status :: 1 - Planning", - # "Development Status :: 2 - Pre-Alpha", - "Development Status :: 3 - Alpha", - # "Development Status :: 4 - Beta", - # "Development Status :: 5 - Production/Stable", - # "Development Status :: 6 - Mature", + # "Development Status :: 1 - Planning", + # "Development Status :: 2 - Pre-Alpha", + # "Development Status :: 3 - Alpha", + "Development Status :: 4 - Beta", + # "Development Status :: 5 - Production/Stable", + # "Development Status :: 6 - Mature", "Intended Audience :: Developers", "Intended Audience :: Information Technology", - "License :: OSI Approved :: BSD License", "Operating System :: MacOS", "Operating System :: POSIX", "Operating System :: Unix", diff --git a/syncboostnote/cli.py b/syncboostnote/cli.py index c2d94f9..9bce22d 100644 --- a/syncboostnote/cli.py +++ b/syncboostnote/cli.py @@ -85,6 +85,7 @@ def starter(args): ''' if args['sync']: sync() + elif args['generate']: return generate_config() @@ -120,17 +121,3 @@ def run_as_command(): run_as_command() - - -# print( -# ''' -# _________________________________ -# | | -# | Generation was successful | -# | Below is the generated config: | -# | ------------------------- | -# | $ cd repo_name | -# | $ python setup.py install | -# ------------------------------ -# ''' -# ) diff --git a/syncboostnote/config.py b/syncboostnote/config.py index a35b7f7..fc2d56c 100644 --- a/syncboostnote/config.py +++ b/syncboostnote/config.py @@ -29,7 +29,6 @@ def interactive(): ['BOOSTNOTE_PATH: ', ' ~/BoostNotes', 'BOOSTNOTE_PATH'], ['SHIELDS: ', ' True', 'SHIELDS'], ['SHIELDS_TYPE: ', 'for-the-badge', 'SHIELDS_TYPE'], - # ["hourly", "daily", "weekly", "monthly", "onchange"] ['FREQUENCY: ', 'hourly', 'FREQUENCY'], ['TIME: ', '1200', 'TIME'], # 24 gour format for now diff --git a/syncboostnote/config.yaml b/syncboostnote/config.yaml deleted file mode 100644 index 536f85a..0000000 --- a/syncboostnote/config.yaml +++ /dev/null @@ -1,7 +0,0 @@ -BOOSTNOTE_PATH: ~/BoostNotes - -SHIELDS: True -SHIELDS_TYPE: "for-the-badge" - -FREQUENCY: hourly # ["hourly", "daily", "weekly", "onchange"] -TIME: 12 # 24 Hour format for now diff --git a/syncboostnote/history.json b/syncboostnote/history.json deleted file mode 100644 index e2d36c0..0000000 --- a/syncboostnote/history.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "48b6616e-2dae-4a4e-a86e-e8133bcdbe05.cson": { - "title": "Snippet note example", - "updated": false - }, - "a0681b02-531d-4212-b35e-3bab8b60beea.cson": { - "title": "create-python-project", - "updated": false - }, - "b8b2dcb5-8c0e-43bf-84ab-0a7605bf31c1.cson": { - "title": "\ud83d\udd34 THIS DOCUMENTATION IS WIP and will be completed soon.", - "updated": false - }, - "2a3fd7c0-8c21-472a-bf95-05ea84d0d41e.cson": { - "title": "Day: Monday", - "updated": false - }, - "a7469891-2c80-41e0-b7be-e1c6f05f92a5.cson": { - "title": "TEST", - "updated": false - }, - "cc0c17cb-25bb-45f6-bdf0-fc8b54e88bb2.cson": { - "title": "Day: Tuesday Date: June 18", - "updated": false - }, - "43cbad10-3808-42c2-8439-1478b45b6293.cson": { - "title": "DAY: SUNDAY", - "updated": false - }, - "b008ef56-e95c-4a09-9268-349bd4fbf77d.cson": { - "title": "", - "updated": false - }, - "8d91b880-2462-4a8b-a914-1712b8579bc1.cson": { - "title": "Welcome to Boostnote!", - "updated": false - } -} \ No newline at end of file diff --git a/syncboostnote/test.py b/syncboostnote/test.py index 4d81e2a..d102ca3 100644 --- a/syncboostnote/test.py +++ b/syncboostnote/test.py @@ -61,73 +61,3 @@ def boostnote_notes_exist(location=os.path.join(home, 'notes')): def git_update(message='nothing'): os.system('git add -A') os.system(f"git commit -m '{message}'") - - -def timely_check(config): - time_check = config['TIME'] - frequency = config['FREQUENCY'] - - if frequency == 'onchange': - raise NotImplementedError('This THING is not implemented currently') - else: - if datetime.now().hour == time_check: - print("ITS HIGH NOON") - else: - if datetime.now().hour > time_check: - time.sleep( - (datetime.now().hour - time_check) * 360 - ) - elif datetime.now().hour < time_check: - time.sleep( - (datetime.now().hour - time_check + 24) * 360 - ) - # time.sleep(2) - print("Has the time come yet?") - - -def time_check(frequency, thyme, config): - ''' - Waits for the time and performs: - 1. If user mentions time, then sleep time will be time + frequency - 2. If user mention time, then sleep time will be 1200 hrs + frequency - ''' - thyme = 12 - while(1): - - if frequency == 'onchange': - while(1): - if not get_changes(): - # Wait - print(f'Waiting for {"2 seconds"}') - time.sleep(2) - # time, slep(10 * 60 * 60) - else: - # change occured - print("Calling update_changes") - update_changes() - print("Calling ultimate") - ultimate(config) - - if datetime.now().hour == thyme: - # check updates - print(gay) - pass - else: - print('shit', datetime.now()) - if frequency == 'hourly': - time.sleep(1 * 360 / 100) - elif frequency == 'daily': - time.sleep(24 * 360 / 100) - elif frequency == 'weekly': - time.sleep(24 * 7 * 360 / 100) - - -# time_check('onchange', '14', -# { -# "BOOSTNOTE_PATH": os.path.join(home, 'Boostnote'), -# "SHIELDS": True, -# "SHIELDS_TYPE": "for-the-badge", -# "FREQUENCY": "hourly", -# "TIME": 11 -# } -# ) diff --git a/syncboostnote/utils.py b/syncboostnote/utils.py index 1c07de2..631f171 100644 --- a/syncboostnote/utils.py +++ b/syncboostnote/utils.py @@ -35,6 +35,7 @@ def initialize(config): location=os.path.join(BOOSTNOTE_NOTES, 'syncboostnote') ) create_history(BOOSTNOTE_PATH) + # update_changes() ultimate(config) else: raise NotADirectoryError( @@ -120,8 +121,6 @@ def ultimate(config): - updates the .md files, which require it. ----------------------------------------------- ''' - # print("Searching for BOOSTNOTE_PATH", end='\r') - # sys.stdout.flush() if not os.path.isfile(os.path.join(config['BOOSTNOTE_PATH'], 'history.json')): # Create the History json again. @@ -129,14 +128,9 @@ def ultimate(config): if boostnote_exists(config['BOOSTNOTE_PATH']): # Creating History again, as this will track if new files have been added. - # sys.stdout.flush() - # print("Creating History.json file", end='\r') create_history(config['BOOSTNOTE_PATH']) - # sys.stdout.flush() - # print("Creation done!", end='\r') - history_json = json.load(open(os.path.join( config['BOOSTNOTE_PATH'], 'history.json'), 'r')) for file in history_json.keys(): @@ -176,7 +170,6 @@ def cson_reader(location): return data else: return 0 - # raise FileNotFoundError(f'The cson file at {location} was not found') def customshield( @@ -212,7 +205,7 @@ def markdown_writer(things, location, shields=True, ''' if things: - embels = ['isStarred', 'isTrashed', + embels = ['isStarred', 'isTrashed', 'createdAt', 'updatedAt', 'type', 'folder', 'tags'] shelds = [] if shields: @@ -228,8 +221,16 @@ def markdown_writer(things, location, shields=True, key, '🗑', color='black', style=options['style'])) elif key == 'updatedAt': + year, month, day = things[key].split( + ':')[0][:-3].split('-') # 2019/06/29 + shelds.append(customshield( + "UpdatedAt".replace(" ", "%20"), f"{day}%20{month}%20{year}", color='green', style=options['style'])) + + elif key == 'createdAt': + year, month, day = things[key].split( + ':')[0][:-3].split('-') # 2019/06/29 shelds.append(customshield( - key, things[key].split(':')[0][:-3].replace('-', '/'), color='green', style=options['style'])) + "createdAt".replace(" ", "%20"), f"{day}%20{month}%20{year}", color='green', style=options['style'])) elif key in ['type', 'folder']: shelds.append(customshield( @@ -353,31 +354,21 @@ def update_changes( def create_history( location=os.path.join(home, 'Boostnote') ): - if os.path.isfile( - os.path.join(location, 'history.json') - ): - # FIle already exists, check for changes. - update_changes() - print(1) - - else: - print(3) - files = {} - for note in get_notes(): - files[note.split('/')[-1]] = { - 'title': cson.load(open(note, 'r'))['title'], - 'updated': False - } - json.dump( - files, - open(os.path.join(location, 'history.json'), 'w+') - ) + files = {} + for note in get_notes(): + files[note.split('/')[-1]] = { + 'title': cson.load(open(note, 'r'))['title'], + 'updated': False + } + json.dump( + files, + open(os.path.join(location, 'history.json'), 'w+') + ) def create_readme(config): notes = get_notes() - # data = {} file = open(os.path.join(config['BOOSTNOTE_PATH'], 'README.md'), 'w+') file.write( '''# SnycBoostNotes @@ -408,17 +399,14 @@ def create_readme(config): ) for note in get_notes(): data = cson_reader(note) - # data[note.split("/")[-1]] = { - # 'title': cson_reader(note)['title'], - # 'createdAt': cson_reader(note)['createdAt'], - # 'tags': cson_reader(note)['tags'], - # } # ! Generate Github link here file.write( # https://github.com/DumbMachine/SyncBoostNoteExample/blob/master/notes/syncboostnote/Stolen%20Content.md f"- [{data['title']}](https://github.com/DumbMachine/{repo_name()}/blob/master/notes/syncboostnote/{data['title'].replace(' ','%20')}.md)") + if data['tags']: + file.write(" {}".format(customshield( + label='tags', message="%20,%20".join(data['tags']), color='purple'))) file.write("\n") - # return data awesome = 'https://img.shields.io/badge/made--with--%E2%99%A5--by-ProjectPy-blueviolet.svg'