add photo posting master
authorIan Kelling <iank@fsf.org>
Tue, 4 Feb 2020 00:37:24 +0000 (19:37 -0500)
committerIan Kelling <iank@fsf.org>
Tue, 4 Feb 2020 00:37:24 +0000 (19:37 -0500)
jan-pona-mute.py

index 7f06c90dff74c82d18134aee8d98d243cb298c8f..a7fc456a98d5ca11be56e881e86aaa6bbfa157e3 100755 (executable)
@@ -510,6 +510,7 @@ Use the 'edit' command to edit notes."""
 
     def do_post(self, line):
         """Write a post on the current stream.
+Preface with -p PATH_WITH_NO_SPACES to post a photo.
 If you just use a number as your post, it will refer to a note.
 Use the 'edit' command to edit notes."""
         if line == "":
@@ -522,7 +523,11 @@ Use the 'edit' command to edit notes."""
         if line in notes:
             print("Using note '%s'" % line)
             line = self.read_note(line)
-        self.post = self.home.post(text = line)
+        linesplit = line.split(' ', 2)
+        if (len(linesplit) == 3 and linesplit[0] == '-p'):
+            self.post = self.home.post(photo = linesplit[1], text = linesplit[2])
+        else:
+            self.post = self.home.post(text = line)
         self.post_cache[self.post.id] = self.post
         self.undo.append("delete post %s" % self.post.id)
         print("Posted. Use the 'show' command to show it. Use the 'undo' command to undo this.")