• 9 posts
  • 4 comments
Joined 3 years ago
Cake day: July 13th, 2023

I’m trying to convert a blog into an EPUB and keep running into issues with existing tools.

I first tried blog2epub, but it fails during parsing with:

lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 10 and head, line 17, column 8

I then tried WebToEpub on Firefox, providing:

  • Content selector: .article-content
  • Chapter title selector: .title

It generated an EPUB, but the file wouldn’t open in any reader.

What I’m looking for is a tool where I can point to a blog’s base URL, define CSS selectors for the article title and body, and have it automatically fetch all entries and create one chapter per post. Or something similar.

Does anyone know of a reliable tool, script, or workflow that does this well on Linux?

I’ve been switching from Vim to Helix recently. I did the built-in tutor, and whenever I need to configure something, I look it up in the docs. The problem is, I only find what I already know to look for. Without reading the documentation more broadly, I don’t really know what I can configure in the first place.

So I’m curious, do you sit down and read documentation to understand a tool, or do you just search it when you hit a specific problem?

  • Honestly, I believe that, except for Russians or anyone whose language isn’t derived from Latin, using a US keyboard for programming is best, because you won’t be missing many keys. Maybe the French will miss the ç, but you can learn the Unicode just like I did with the em dash and quotation marks:

    • Em Dash (—): U+2014
    • En Dash (–): U+2013

    Quotation marks:

    • Left double quote (“): U+201C
    • Right double quote (”): U+201D
    • Left single quote (‘): U+2018
    • Right single quote (’): U+2019

I want to create a collage of 20 screenshots from a video, arranged in a 5x4 grid, regardless of the video’s length. How can I do this efficiently on a Linux system?

Specifically, I’d like a way to automatically generate this collage of 20 thumbnails from the video, without having to manually select and arrange the screenshots. The number of thumbnails should always be 20, even if the video is longer or shorter.

Can you suggest a command-line tool or script that can handle this task efficiently on Linux? I’m looking for a solution that is automated and doesn’t require a lot of manual work.

Here’s what I’ve tried but I only get 20 black boxes:

#!/bin/bash

# Check if input video exists
if [ ! -f "$1" ]; then
    echo "Error: Input video file not found."
    exit 1
fi

# Get video duration
duration=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$1")

# Calculate interval between frames
interval=$((duration / 20))

# Extract 20 frames from the video
for i in {1..20}; do
    ffmpeg -ss $((interval * ($i - 1))) -i "$1" -vf scale=200:-1 -q:v 2 "${1%.*}_frame$i.jpg"
done

# Create collage
montage -mode concatenate -tile 5x4 -geometry +2+2 "${1%.*}_frame*.jpg" output_collage.jpg

# Clean up temporary files
rm "${1%.*}_frame*.jpg"

echo "Collage created: output_collage.jpg"