Compare commits

...
3 Commits
Author SHA1 Message Date
tangent e4c90473ea Upload files to "/" 2026-08-13 14:42:31 -06:00
tangent 95f4c85f32 Upload files to "/"
This better fucking recognize that it was chmodded but I don't expect it to.
2026-08-08 02:06:44 -06:00
tangent 513d77f5e4 Update ReadMe.md 2026-06-27 06:37:20 -06:00
3 changed files with 78 additions and 4 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
one-off-scripts one-off-scripts
=============== ===============
This repo is hosted at https://gitea.tangentfox.com/tangent/one-off-scripts and force-pushed to GitHub when commits are made. This repo is hosted at https://gitea.tangentfox.com/tangent/one-off-scripts
and force-pushed to https://github.com/TangentFoxy/one-off-scripts when commits are made.
Feel free to submit pull requests or whatever, but know that I would have to manage them over there. Feel free to submit pull requests or whatever, but know that I would have to manage them over there.
+11 -3
View File
@@ -4,14 +4,14 @@ local pause_between_opens = false
math.randomseed(os.time()) math.randomseed(os.time())
local books = { local books = {
read = 857, read = 1966,
unread = 3093, unread = 4103,
per_calibre_page = 6, per_calibre_page = 6,
} }
books.total = books.read + books.unread books.total = books.read + books.unread
local ratings = { local ratings = {
91, 130, 222, 158, 41 210, 384, 587, 383, 87,
} }
local average_rating = (function() local average_rating = (function()
local count, rating = 0, 0 local count, rating = 0, 0
@@ -37,6 +37,13 @@ books.average_page_count = books.average_page_count * (1 - 0.17)
-- 2025-11-19 -- 2025-11-19
-- this was approximately 124.9, but a current estimate is 148.72 -- this was approximately 124.9, but a current estimate is 148.72
books.average_page_count = 148.72 books.average_page_count = 148.72
-- 2026-06-20
-- read + DNF + owned
books.average_page_count = 136909/1096 + 33597/170 + 207799/1421
print("Estimated average page count per book: " .. books.average_page_count) print("Estimated average page count per book: " .. books.average_page_count)
local function to_calibre_pages(count) local function to_calibre_pages(count)
@@ -81,3 +88,4 @@ print("Press enter to open 9 random pages on Calibre. :D Or close this window /
io.read("*line") io.read("*line")
open_random_links("unread", 9) open_random_links("unread", 9)
-- open_random_links("read", 9)
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env bash
set -e
OUTPUT="audiobook.m4b"
FILES="files.txt"
CHAPTERS="chapters.txt"
# list of MP3 files in filename order
find . -maxdepth 1 -name '*.mp3' -print0 |
sort -z |
while IFS= read -r -d '' file; do
file="${file#./}"
printf "file '%s'\n" "$file"
done > "$FILES"
# start chapter metadata file
{
echo ";FFMETADATA1"
} > "$CHAPTERS"
START=0
while IFS= read -r line; do
FILE="${line#file \'}"
FILE="${FILE%\'}"
# duration in milliseconds
DURATION=$(ffprobe \
-v error \
-show_entries format=duration \
-of csv=p=0 \
"$FILE")
DURATION_MS=$(awk "BEGIN {printf \"%.0f\", $DURATION * 1000}")
END=$((START + DURATION_MS))
# filename as the chapter title
TITLE="${FILE%.mp3}"
cat >> "$CHAPTERS" <<EOF
[CHAPTER]
TIMEBASE=1/1000
START=$START
END=$END
title=$TITLE
EOF
START=$END
done < "$FILES"
read -p "Press Enter key after making any corrections to $CHAPTERS"
ffmpeg \
-f concat \
-safe 0 \
-i "$FILES" \
-i "$CHAPTERS" \
-map 0:a \
-map_metadata 1 \
-c:a aac \
-b:a 128k \
-movflags +faststart \
"$OUTPUT"