~dschwarz

Recent activity

[PATCH] support for server translation of status messages 1 year, 11 months ago

From Daniel Schwarz to ~ihabunek/toot-discuss

This is a Mastodon 4 feature. It is not enabled on all Mastodon servers, 
but where it is available, you can now translate between supported 
language pairs (support will vary by server, as the admins can install 
different translation software).

Tested with toad.social which uses LibreTranslate on the back end. 
Successfully translates German to English, French to English.


diff --git a/toot/api.py b/toot/api.py
index 5868430..ffce8d3 100644
--- a/toot/api.py
+++ b/toot/api.py
@@ -209,6 +209,10 @@ def unbookmark(app, user, status_id):
[message trimmed]

[PATCH] Emit terminal codes so that clicking on line wrapped URLs works properly 1 year, 11 months ago

From Daniel Schwarz to ~ihabunek/toot-discuss

This addresses one of the complaints in issue #247.
https://github.com/ihabunek/toot/issues/247

The code works but could use a lot of review. Tested with Windows Terminal 
and Terminator (works well),  also tested with Kitty (doesn't work; likely 
the fault of Kitty.)  Other VTE descended terminals should support this as 
well, and the terminal codes are harmless on nonsupported terminals.

27KB patch follows

diff --git a/toot/tui/URLText.py b/toot/tui/URLText.py
new file mode 100644
index 0000000..9e5a55a
--- /dev/null
[message trimmed]

[PATCH] Display polls in command line status output, also display your own votes in toot tui poll displays 1 year, 11 months ago

From Daniel Schwarz to ~ihabunek/toot-discuss

These are read only enhancements to the poll display functionality.

diff --git a/toot/output.py b/toot/output.py
index 5804bb5..daee4c6 100644
--- a/toot/output.py
+++ b/toot/output.py
@@ -168,6 +168,7 @@ def print_status(status, width):
     content = reblog['content'] if reblog else status['content']
     media_attachments = reblog['media_attachments'] if reblog else status['media_attachments']
     in_reply_to = status['in_reply_to_id']
    poll = reblog['poll'] if reblog else status['poll']

     time = parse_datetime(status['created_at'])
     time = time.strftime('%Y-%m-%d %H:%M %Z')
[message trimmed]

Re: [PATCH] improved support for media viewing and in-terminal image viewing 1 year, 11 months ago

From Daniel Schwarz to ~ihabunek/toot-discuss

Ah, I now see an issue from 2020 where Ivan commented that the media
feature was deliberately hidden pending implementation of a user
configuration mechanism. As it is there’s no way to choose a preferred
image viewer or add a new one without editing code, as I have done.
Perhaps the chafa viewer support could be added via this patch while
leaving the “m” command hidden.

Dan

[PATCH] improved support for media viewing and in-terminal image viewing 1 year, 11 months ago

From Daniel Schwarz to ~ihabunek/toot-discuss

'm' command to view images is now surfaced in help and on the status 
detail page.  Also, an in-console image viewer "chafa" is now supported. 
(Try it; it's surprisingly good, and supports pixel accurate image display 
if you use kitty or xterm)  https://github.com/hpjansson/chafa

diff --git a/toot/tui/app.py b/toot/tui/app.py
index f0fc425..49b3711 100644
--- a/toot/tui/app.py
+++ b/toot/tui/app.py
@@ -188,6 +188,7 @@ class TUI(urwid.Frame):

          def _media(timeline, status):
              self.show_media(status)
+            self.loop.screen.clear()

[PATCH] fix for crash bug in comma-refresh feature 1 year, 11 months ago

From Daniel Schwarz to ~ihabunek/toot-discuss

Fixed this comparison; was causing a crash in some cases.

diff --git a/toot/tui/app.py b/toot/tui/app.py
index 2a7b285..f0fc425 100644
--- a/toot/tui/app.py
+++ b/toot/tui/app.py
@@ -524,7 +524,7 @@ class TUI(urwid.Frame):
             if not self.overlay:
                 self.show_help()

        elif key == ',':
        elif key in (','):
             if not self.overlay:
                 self.timeline_generator = api.home_timeline_generator(
[message trimmed]

[Patch] Show edited status timestamps in status detail window 1 year, 11 months ago

From Daniel Schwarz to ~ihabunek/toot-discuss

My Python knowledge is not 100% so this code might be improved upon, but 
it does work.  Statuses that have been edited (on any server that supports 
editing) carry an edited_at timestamp.  This patch shows that timestamp 
for any edited status.

diff --git a/toot/tui/entities.py b/toot/tui/entities.py
index 3cf2122..265938b 100644
--- a/toot/tui/entities.py
+++ b/toot/tui/entities.py
@@ -55,6 +55,11 @@ class Status:
         self.url = data.get("url")
         self.mentions = data.get("mentions")
         self.reblog = self._get_reblog()
        self.edited = data.get("edited_at", False)
[message trimmed]

[PATCH] toot edit status feature 1 year, 11 months ago

From Daniel Schwarz to ~ihabunek/toot-discuss

diff --git a/toot/api.py b/toot/api.py
index 3b2ffcf..69585bd 100644
--- a/toot/api.py
+++ b/toot/api.py
@@ -97,7 +97,7 @@ def post_status(
 ):
     """
     Posts a new status.
    https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#posting-a-new-status
    https://docs.joinmastodon.org/methods/statuses/#create
     """

     # Idempotency key assures the same status is not posted multiple times
@@ -120,6 +120,45 @@ def post_status(
[message trimmed]