Implement note creation
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
				
			|||||||
from api import StandardNotesAPI
 | 
					from api import StandardNotesAPI
 | 
				
			||||||
 | 
					from uuid import uuid1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ItemManager:
 | 
					class ItemManager:
 | 
				
			||||||
    items = {}
 | 
					    items = {}
 | 
				
			||||||
@@ -65,6 +66,19 @@ class ItemManager:
 | 
				
			|||||||
        item['dirty'] = True
 | 
					        item['dirty'] = True
 | 
				
			||||||
        self.syncItems()
 | 
					        self.syncItems()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def createNote(self, name, time):
 | 
				
			||||||
 | 
					        uuid = str(uuid1())
 | 
				
			||||||
 | 
					        content = dict(title=name, text='', references=[])
 | 
				
			||||||
 | 
					        self.items[uuid] = dict(content_type='Note',
 | 
				
			||||||
 | 
					                dirty=True,
 | 
				
			||||||
 | 
					                auth_hash=None,
 | 
				
			||||||
 | 
					                uuid=uuid,
 | 
				
			||||||
 | 
					                created_at=time,
 | 
				
			||||||
 | 
					                updated_at=time,
 | 
				
			||||||
 | 
					                enc_item_key='',
 | 
				
			||||||
 | 
					                content=content)
 | 
				
			||||||
 | 
					        return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, username, password):
 | 
					    def __init__(self, username, password):
 | 
				
			||||||
        self.standard_notes = StandardNotesAPI(username, password)
 | 
					        self.standard_notes = StandardNotesAPI(username, password)
 | 
				
			||||||
        self.syncItems()
 | 
					        self.syncItems()
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								sn-fs.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								sn-fs.py
									
									
									
									
									
								
							@@ -79,15 +79,20 @@ class StandardNotesFS(LoggingMixIn, Operations):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return len(data)
 | 
					        return len(data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def create(self, path, mode):
 | 
				
			||||||
 | 
					        path_parts = path.split('/')
 | 
				
			||||||
 | 
					        note_name = path_parts[1]
 | 
				
			||||||
 | 
					        now = datetime.utcnow().isoformat()[:-3] + 'Z' # hack
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self.item_manager.createNote(note_name, now)
 | 
				
			||||||
 | 
					        return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def chmod(self, path, mode):
 | 
					    def chmod(self, path, mode):
 | 
				
			||||||
        return 0
 | 
					        return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def chown(self, path, uid, gid):
 | 
					    def chown(self, path, uid, gid):
 | 
				
			||||||
        return 0
 | 
					        return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def create(self, path, mode):
 | 
					 | 
				
			||||||
        return 0
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def destroy(self, path):
 | 
					    def destroy(self, path):
 | 
				
			||||||
        return 0
 | 
					        return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user