Sunday, 15 January 2023

console client for Mastodon ?

 I hanker after a console Mastodon client, so initially have tinkered a home timeline reader, bit rough so far. Run with ./tl_json.py 1|less -r  (the -r on less make the ansi colours work) to get the latest, or ./tl_json.py|less -r to read the current tmp file (/tmp/tl.json). 

I imagine a stand alone that you could do likes, and pop-ups in a browser and push I to view jpegs and such, we'll see.  

Getting the timeline could have been done with urllib, but what with urllib, urllib2 and urllib3 all being a bit different, I couldn't get the Authorization in the header to work, so I squibbed it and just used curl.

#============================

#!/usr/bin/python3
import json , os , html2text ,sys

#ansi colours

LIGHT_CYAN="\033[1;36m"
YELLOW="\033[1;33m"
BLUE="\033[0;34m"
GREEN="\033[0;32m"
PURPLE="\033[0;35m"
LIGHT_GREEN="\033[1;32m"
BOLD="\033[1m"
RED="\033[0;31m"
NORMAL="\033[0m"

APIKEY="you need your own apikey"

masto_url="curl -k https://mastodon.social/api/v1/timelines/home?limit=40 -H 'Authorization: Bearer "+ APIKEY +" ' >/tmp/tl.json"
if len(sys.argv) > 1 :
    print ("Refreshing")
    os.system(masto_url)

f = open("/tmp/tl.json")
d = f.read()
dj = json.loads(d)
z = 0
#clean the text
text_maker = html2text.HTML2Text()
text_maker.images_to_alt = True
text_maker.ignore_links = True

while z < 39 :
    print (LIGHT_CYAN+str(z)+" "+dj[z]['account']['display_name']+" ["+dj[z]['account']['username']+"]")
    print (BLUE+dj[z]['created_at'])
    try:
        text =  dj[z]['content']
        print (NORMAL  + text_maker.handle(text).strip() )
       

        print (PURPLE+" "+dj[z]['url']+" .")
        print (PURPLE+"@"+dj[z]['account']['acct'])
       
    except:
        print("")
    try:     #is there any media ?
         y=0
         while  dj[z]['media_attachments'][y]  :
              print (BOLD+"\nDescription: < "+ dj[z]['media_attachments'][y]['description']+" >"+NORMAL )
              print (PURPLE+" "+ dj[z]['media_attachments'][y]['url']+NORMAL )
              y = y + 1
    except:
         print ("")

    # boosted posts
    try:
        text = dj[z]['reblog']['content']
        print (YELLOW + "Boost "+ dj[z]['reblog']['id'] )
        print (YELLOW +" "+  dj[z]['reblog']['url'] )
        print (YELLOW + text_maker.handle(text).strip() + NORMAL )
        print (" ")
    except:
        print ("")    
    z=z+1

#============================


Monday, 19 December 2022

It is awful here...

kanamaluka (aka River Tamar) in kinimathatakinta/George Town, lutruwita/Tasmania

Samphire succulent plants

Black bicycle in the wind shelter thing

Regent Square: the "ufo" has landed

Tuesday, 13 December 2022

Minds Do Matter 2022

Earlier this year... 

Minds Do Matter 2022 at the QVMAG community gallery. The Rant Arts (Tasmania) Minds Do Matter exhibition "explores the relationship between art and mental health, celebrating the power of art to be life enhancing and life affirming." 


    








 
  





Ross Tin Can Show 2022

Earlier this year...  

Sculpture Tasmania's Tin Can Sculpture exhibition in Ross 2022

The Thistle Inn Stable Gallery

Canned Humanity, Just Add Water - Anita Denholm


The Catalogue

We choose to go to the moon, for tea - mousehammer

The Red Herrings of Ross - Mhairi Revie

Cat Clock - Grieta Bosveld

Spike 19 - Mikayla Beaty

The exhibition is documented in a catalogue. 

There was also a "sculpture trail" around town, in shops and such, featuring items from previous exhibitions.

Unititled - Simone Mansfield

Walking Man - Robert Boldkald