358.20. kdos-transcribe-1.0.0
Transcribe in the file manager's menu for audio and video, offline, while a speech model is installed
| Version | 1.0.0, release 1 |
| Source tree | src/desktop/kdos-transcribe/ |
| Phase | 50_desktop (Desktop), 75 of 92 in build order |
| Licence | MIT |
| Homepage | https://github.com/kunaldawn/kdos |
| Build time | 0.1 SBU |
| Installed size | 53.3 KiB in 1 file |
| Recipe | src/desktop/kdos-transcribe/kpkgbuild |
About
kdos-transcribe adds Transcribe to the right-click menu of Dolphin and of every KDE file dialog, for audio and video files. It is one plugin, /usr/lib/qt6/plugins/kf6/kfileitemaction/kdostranscribe.so. Choosing it runs kdos speech transcribe --notify -- <files>, which uses whisper.cpp to write what is said in each file into a .txt file beside it, and shows a notification when it is done. Nothing leaves the machine.
The entry appears only while it can work, which means all of these hold:
whisper-cliis on thePATHandkdosis installed;- every selected item is a local audio or video file;
- a speech model is where
kdos speechlooks for one: the file$KDOS_WHISPER_MODELnames, if it names a file; otherwise the firstggml-*.binin~/.local/share/whisper.cpp/models; otherwise the first in each system data directory’swhisper.cpp/models, where whisper-model-base-en puts its model.
Why it is in KDOS
The comment above it in script/phases/50_desktop/packages.txt:
Transcribe in Dolphin's menu for audio and video, offline.
Sources
None: the port builds from its own directory, /kdos/src/desktop/kdos-transcribe.
Dependencies
Depends on: cmake, ninja, extra-cmake-modules, qt6-qtbase, kcoreaddons, ki18n, kio, kdos-tools.
Required by (1): kde-plasma.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/50_desktop/phase.env && kpkg install kdos-transcribe'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /kdos/src/desktop/kdos-transcribe.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/kdos-transcribe
SRC=$SRC_ROOT/kdos-transcribe-1.0.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
cmake -S "$PORT_SRC" -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D KDE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
-D BUILD_TESTING=OFF \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
The switches, and why each is set:
-S "$PORT_SRC"— The sources are the port’s own directory: a port of KDOS’s own has no tarball, and the build tree is made in the empty$SRC.-D KDE_INSTALL_USE_QT_SYS_PATHS=ON— Install the plugin into Qt’s own plugin directory,/usr/lib/qt6/plugins/kf6/kfileitemaction, where KIO looks for file-item actions.-D BUILD_TESTING=OFF— Build no tests into the package. The QtTest suite intests/is run bymake plasmatestin the development container, not by the image build.-D CMAKE_INSTALL_PREFIX=/usr,-D KDE_INSTALL_LIBDIR=lib,-D CMAKE_BUILD_TYPE=Release— The tree’s prefix and library directory, which ECM would otherwise put underlib64, and an optimised build.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/kdos-transcribe, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf kdos-transcribe-1.0.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/kdos-transcribe, and runs the triggers its paths call for.
Other files in the port directory, read by build.sh: CMakeLists.txt, src/, tests/.
Notes
Transcribe is a file-item action plugin rather than a service menu. A service menu is a desktop file KIO lists whenever it is installed, and KIO 6 has no condition that hides one while a program or a file is missing. The plugin decides each time the menu opens, so the entry is absent on a machine with no model. Its metadata names application/octet-stream, which every audio and video type inherits, and the plugin itself narrows that to audio/ and video/ types.
The file names go to kdos as separate arguments after --, so a name that starts with - is never read as an option.