Commit Graph

24 Commits

Author SHA1 Message Date
MasterofJOKers c2f5732351 mirror-yt: Handle returncode 1
We switch from `subprocess.run` to manually handling a `Popen` object so
we can decide whether a returncode of 1 is fine or now depending on the
output we see. Since we want live output during the download, we cannot
just capture all the output. Instead, we have to regularly print
whatever we captured. Therefore, we need a `Popen` object and need to
call `communicate()` with a timeout on it.
2024-04-21 23:18:54 +02:00
MasterofJOKers 16de972f7b mirror-yt: Add a sleep between downloads
We want to play nice in the internet.
2024-04-21 23:18:19 +02:00
MasterofJOKers 171163b3d9 Add mirror-yt.py - a wrapper around yt-dlp
This script is supposed to run regularly to mirror videos of certain
YouTube channels locally for archiving purposes.
2024-03-08 16:21:32 +01:00
MasterofJOKers 28901649dc udev-device-plug-handler: Handle Canon LiDE400
When this scanner is plugged in, we want to start `scanimage` in batch
mode with button support, scanning into a pre-defined directory. Since
plug and unplug might happen multiple times a day and batch mode
overwrites files with the same name, we use date and time to define
directory and filename.
2024-02-03 13:59:22 +01:00
MasterofJOKers 0c2dd51ac1 udev-device-plug-handler: Support more than bind
There can be cases where we want to support more than "bind" events -
e.g. "remove". Therefore, we rewrite how things work in the spirit of
the STLs `SimpleHTTPRequestHandler`: any "handle_{action}" method of a
`KnownDevice` subclass allows the class to receive events for that
action.

To not use `getattr()` on every `KnownDevice` on every event, we use
`__init_subclass__()` to build a list of `KnownDevice` registered for
each `action`.
2024-02-03 13:55:52 +01:00
MasterofJOKers d17af01e2f rip-py: Split things and support Blu-ray
We're using a `libbluray2` wrapper by the same person that also built
`pydvdread`. At the same time, we dump supporting to parse `mpv` output,
because that was too unreliable anyways and keeping it just means more
maintenance overhead.

To provide a better overview, we've split up the DVD and Blu-ray
functionality into own modules
2024-01-05 22:32:55 +01:00
MasterofJOKers cf53e5dd3d rip-py: Fix leftover PEP8 errors 2023-12-06 00:06:56 +01:00
MasterofJOKers 074b368b82 rip-py: Add all the latest things
This is the latest version having new commands and support for dvdread
to reach chapters, because the mpv output was unreliable (iirc it forgot
to output the last chapter) and slower and harder to parse.
2023-12-06 00:04:29 +01:00
MasterofJOKers a95febccc3 rip-py: Support overriding the quality
This is a backup from 2021-01-01 which adds the `--quality` option to
the `all` and `single` commands.
2023-12-05 23:54:12 +01:00
MasterofJOKers 37f03fe6bd rip-py: Add a split-file command
This is a backup from 2020-11-29 which added a split-file command to the
toolkit, which can be used to e.g. split DVDs of concerts into its
songs.
2023-12-05 23:51:35 +01:00
MasterofJOKers 32edd53cfb Add rip-py project
This is a backup from 2020-08-19 - the oldest version I still have
around.
2023-12-05 23:50:04 +01:00
MasterofJOKers ae52d4962a lxc: Move remap-uid-and-gid-for-lv to fuidshift
Instead of my custom-baked implementation, that doesn't support
file system ACLs and is quite slow, we switch to `fuidshift` from the
`lxd-tools` Debian package.
2023-06-28 23:42:40 +02:00
MasterofJOKers ec3618d5f7 lxc: Fix checking for -h/--help in get-lxc-idmap-config
The previous version wasn't dash - Debian's default /bin/sh -
compatible.
2023-06-28 19:14:59 +02:00
MasterofJOKers e09ee60593 lxc: Handle symlinks in rempa-uid-and-gid-for-lv
I previously thought that handling symlinks would not be necessary and
also not possible. Then, I found out about the `--no-dereference` option
for `chown` ...
2023-06-28 18:25:29 +02:00
MasterofJOKers 73fdc6b27a lxc-debian-userns: Handle uid-mapping with lxc-create
lxc-create will pass "--mapped-uid" and "--mapped-gid" into the
template, if there's an "lxc.idmap" option in the config file. We now
support getting these parameters as options.

Since an "lxc.idmap" option in the config makes lxc-create already
change the userns, we cannot support it. Therefore, we error out if we
see these options. Instead, we write the "lxc.idmap" options ourselves
based on the "--uidmap" and "--gidmap" options passed by the user.
2023-03-08 00:29:02 +01:00
MasterofJOKers b5243aaa2b Add lxc-debian-userns LXC template script
This script can be used as LXC template to install a Debian into a
directory using `mmdebstrap`. It's intended use is to create a container
filesystem with appropriate uids/gids for use in an unprivileged
container. The script assumes that it runs as root and only changes the
userns to install Debian.
2023-02-26 00:24:25 +01:00
MasterofJOKers 845e3fe30e Add remap-uid-and-gid-for-lv
I've used this script to remap files' uids/gids of containers created
without a custom userns into their new range.  It's inferior to
`fuidshift` from the `lxc` project in that it doesn't handle ACLs and is
quite slow - probably because it calls a binary for every file.

By default, it runs in debug mode only printing the chown command
instead of executing it. You need to edit the file to use it.

It also only works with LVs (logical volumes from LVM), mounting them
automatically.
2023-02-25 17:15:23 +01:00
MasterofJOKers 271d7009cf Add get-lxc-idmap-config script
This script handles uid/gid ranges for creating unprivileged containers as root.
2023-02-25 17:13:12 +01:00
MasterofJOKers 2f9f69ec77 Add udev-device-plug-handler
This command runs in the background and listens for udev bind events,
comparing the attributes of those events to known implemented devices.
If any match, we call their handle() method. The same handle() method is
called on startup if the presence of the device is detected via the
check_available() method.

Currently implemented devices are my Logitech G930 headset and my TEX
Shinobi keyboard.
2022-09-06 20:47:01 +02:00
MasterofJOKers 7729a8a9db Add cronplayer
This command's main purpose is to get run regularly via cron and play (a
list of) files possibly repeated to a specific PulseAudio device.
Additonally, it can just play a command or start as an HTTP server
providing an interface to play local files, stop the current playback
and show the current status.

Actual playback is done via ffmpeg and paplay.
2022-05-17 23:41:31 +02:00
MasterofJOKers e558da4427 Add switch-pa-sink
This script can be used to switch the pulseaudio sink of an application
to the next sink in the list of sinks. The sink is found by querying the
currently focused window from i3 and retrieving the PID via _NET_WM_PID
attribute using xprop. If that PID doesn't directly have sink attached,
the script searches for children of this PID having a sink and switches
those. This is useful to switch e.g. an mpv running inside a terminal.
2022-01-26 00:00:57 +01:00
MasterofJOKers 12c3ac9c05 Add sorted-co.py
This is a script to copy files onto an USB stick or an MP3 player in
sorted order so stupd mp3 players or radios that play files in the order
they were added to the directory instead of by sorted filename still
play the files in the right order.
2022-01-25 23:33:53 +01:00
MasterofJOKers 38fe8c0a82 Add *.swp to .gitignore 2022-01-25 23:33:41 +01:00
MasterofJOKers a7d5c21c45 Initial commit 2020-12-15 23:06:45 +00:00