koldfront

Duration on thumbnails on my desktop

🕝︎ - 2025-03-08
Screenshot of folder with two video thumbnails with their duration shown in the corner

I was looking at a folder full of videos, trying to decide which one to watch. The title and the thumbnail help me decide, but a third criteria popped up in my head - how long is the video?

So I was annoyed that this piece of information wasn't readily available.

But why not do something about that?

On my computer it turns out the thumbnails that the file manager (Nemo) shows are generated by totem-video-thumbnailer, via a configuration file in /usr/share/thumbnailers, so I set out to make a wrapper, that would put the duration into the thumbnail.

Here is the script:

#!/bin/bash

# video-duration-thumbnailer - wrapper for totem-video-thumbnailer
#
#    Adds duration to the thumbnail.
#
#    Put this script somewhere, edit
#    /usr/share/thumbnailers/totem.thumbnailer changing
#    "Exec=/usr/bin/totem-video-thumbnailer -s %s %u %o" to
#    'Exec=YOURPATH/video-duration-thumbnailer -s %s %u %o'
#
#    Thanks to Klaus for the Python snippet for url decoding.
#
# Copyright (C) 2025. Under GPLv2. By Adam Sjøgren <asjo@koldfront.dk>

INPUT=$3
OUTPUT=$4

# Run the original thumbnailer:
/usr/bin/totem-video-thumbnailer "$@"

# If possible, overlay duration:
if echo "$INPUT" | grep --quiet 'file://'; then
    FILE=$(echo "$INPUT" | python -c 'import sys; from urllib.parse import unquote; print(unquote(sys.stdin.read().strip()))')

    DURATION=$(ffprobe -i "$FILE" -show_entries format=duration -v quiet -of csv="p=0" -sexagesimal | cut -d. -f 1)

    TMPFILE=$(mktemp -t vtt-XXXXXX)
    convert "$OUTPUT" -gravity SouthEast -font DejaVu-Sans-Condensed -pointsize 24 -fill white -stroke gray -annotate +2+2 "$DURATION" "$TMPFILE"
    mv "$TMPFILE" "$OUTPUT"
fi

And now when I look at a folder of videos the duration is shown (after pressing Ctrl-R to update the thumbnails)!

I ❤️ Free Software #free software #ilovefs

🕖︎ - 2025-02-14
Use Study Share Improve

GNU Emacs, Debian GNU/Linux, Linux, Gnus, X.Org, Postfix, GHC, PostgreSQL, OpenSSH, Firefox, Apache, ejabberd, Dovecot, git, GnuPG, XMonad, jabber.el, Magit, rdiff-backup, LaTeX, Gimp, VLC, Syncthing, Sakura, chrony, Fail2ban, WeeWX, DejaVu fonts, ripgrep, lirc, MPD Flameshot, lots of GNU, the list goes on and on - thanks everybody!

New HTML elements #html

🕗︎ - 2024-11-15

A couple of days ago I used the details HTML element in anger for the first time, yay.

Recently I learned about the datalist element as well - both quite useful.

So, what other elements and attributes have been added to HTML during the past 10-15 odd years I looked away and didn't read the specifications?

Trentemøller, Pumpehuset #music

🕛︎ - 2024-11-03
The band in silhoutte

I caught the third in a row sold out Trentemøller concert in Pumpehuset, Copenhagen last night.

I was not that familiar with the music, but it was nevertheless an enjoyable concert - if you get the chance, go see them!

.... and don't let the name of the new album "Dreamweaver" fool you - it's not about Macromedia and late 90s shoddy web-technology, as far as I can tell!

RacketCon 14: Keynote presentation #programming #emacs

🕦︎ - 2024-11-03
Abelson & Sussman

The keynote presentation at RacketCon 14 was given by Hal Abelson and Gerald Sussman of "Structure and Interpretation of Computer Programs"-fame - often the book is just referred to as "SICP", which turned 40 this year.

(I'm sort of ashamed to admit that I never read it, but hey.)

During the questions after the keynote speeches I picked up a set of quotes about Emacs from Sussman:

"If I was starting again, I'm gonna say something nasty, if I was starting again, making the software for SICM, I would probably be using Julia."

"Which is basically a Scheme, with a syntax. I hate syntax, I'd rather use Lisp syntax. But I'd be using Julia, since it's even better at numerical chrunching on very, very large scales."

Another snapshot of Abelson and Sussman from the lecture

"Racket is a wonderful thing, but it has one problem for me. It doesn't play well with my most famous and favourite interface in the world, which is Emacs."

"By contrast, I know it does have an Emacs interface, but when I have tried it, it doesn't play well with Emacs. And I live in Emacs. I hardly touch a computer to do anything else than Emacs."

"The real thing I love is Emacs."

Statler & Waldorf at the keyboard

The lectures were given remotely, which gave a couple of fun moments reminding me of the Statler & Waldorf Muppet Show videos.

The video ends with a nice surprise gift for the two presenters and authors - check it out - with Abelson telling the surprise party that they are in the middle of a lecture, but do come in and say hello to everybody at the conference.

Speed alerts #activitypub #postgresql

🕘︎ - 2024-10-11

I have configured PostgreSQL to log queries that take more than some-number of milliseconds, so I can notice which queries are slow and perhaps do something about it.

Recently I have been noticing - in the window I have running tail -F on various logfiles (using autossh to my various servers, and piping it through ccze for colours) - that sometimes I had queries logged taking around 650 ms.

Last Sunday I finally decided to look at it. It was a whopper of a query coming from illuminant-nntp, when Gnus was fetching an article from illuminant.timeline by number.

The article numbers are generated by the query, so this had become slower as the number of toots in Illuminant's database has grown. Looking closer at the query, I realized that the sub-query finding the toots matching the article number also did a lot of the processing to get the information to return. Which is sub-optimal (haha) because it was doing that for all toots up until the article number that was actually needed.

So I fought the SQL for a while, changing the sub-query to only fetch/do as much as necessary to get the object id matching the wanted article number, and then moving all the formatting and information gathering "outside", to the top-query that now only had the one object and accompanying activities to get and convert to an article.

With that change the queries went from around 650 ms to around 200-220 ms. A nice improvement.

What's interesting is that I did not feel opening an article in illuminant.timeline in Gnus was slow - I guess the rule of thumb of a second is pretty good. But after making the improvement, opening articles feels snappy - so the preemptive optimization was a boon. And hopefully it will be a while until I have to figure out some other optimization to drop the query time again.

Yay monitoring!

Stupid DNS DoS again #net

🕢︎ - 2024-10-07
Smokeping graph towards my router, showing it not being able to keep up

After taking most of August off the annoying Denial of Service "attack" hit me again (previously: March, May, June), culminating in so many requests yesterday that my feeble home router was starting to fall over.

So I threw the towel in the ring and moved the DNS for asjo.org to domæne.shop.

Munin graph showing firewall throughput peaking on my home server

I really like hosting things myself. I think it healthy for me and the internet in general that people do so - instead of having megacorps silo everything.

And more often than not, it's really not that complicated. Not even for email, regardless of what people always say.

So I did not like giving up, but I was growing tired of trying to block /8 networks and still having my servers receiving several thousand packets a second.

Completely ridiculous network usage graph from one of my VPS DNS servers

For looking up asjo.org, for crying out loud: the zone is 36 lines long:

virgil:/etc/bind$ wc -l db.asjoorg
36 db.asjoorg

Anyway, now it takes several minutes for each of my three DNS-servers to receive 1000 DNS packets.

The other VPS DNS server's completely ridiculous network graph

It is no 3.8 Tbps DDoS attack - I don't even know my case is actually an attack, but annoying nonetheless.

I still have no idea why, who, or what the hell. I guess it is just one of those things.

Lille langebro

Today

Thames Tunnel (182).

Treaty of Rome (68).

koldfront (the company) closed (11).

Tomorrow

Peter Lundholm Jensen (60).

Thursday

Carl Barks (124).

Friday

Three Mile Island accident (46).

Saturday

Syahriany Tengku Syahril (47).

Sunday

Vincent van Gogh (172).

Monday

Kristian Zahrtmann (182).

First usenet spam (32).

Netscape releases Communicator client source code (27).

Johnny Madsen (74).

Kammeratx (54).