Skip to content

Instantly share code, notes, and snippets.

View BenMcLean's full-sized avatar

Benjamin McLean BenMcLean

View GitHub Profile
@BenMcLean
BenMcLean / matroska_tagger.py
Last active April 28, 2026 14:14
MusicBrainz Picard plugin: Adds support for reading and writing tags in Matroska (.mkv, .mka) files via MKVToolNix.
# -*- coding: utf-8 -*-
PLUGIN_NAME = "Matroska Tagger"
PLUGIN_AUTHOR = "Ben McLean"
PLUGIN_VERSION = "0.1"
PLUGIN_API_VERSIONS = [
"2.0",
"2.1",
"2.2",
"2.3",
@BenMcLean
BenMcLean / ac3.bat
Last active April 13, 2026 21:32
Extract Dolby Digital 5.1 tracks from decrypted Audio DVDs (tested against Weird Al Yankovic's Straight Outta Lynwood)
@ECHO OFF
cd /d "%~dp0"
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%~dpn0.ps1' \"%1\" \"%2\" \"%3\" \"%4\" \"%5\" \"%6\" \"%7\" \"%8\""
@PAUSE
@BenMcLean
BenMcLean / extract_games_lib.py
Last active March 19, 2026 18:08
Art assets extraction for Muppets Inside (1996, Starwave)
#!/usr/bin/env python3
r"""
extract_games_lib.pyGAMES.LIB extractor for Muppets Inside (1996, Starwave)
===============================================================================
Zero dependenciesstdlib only. DCL decompressor inlined at the bottom.
Usage:
python3 extract_games_lib.py <games_lib> [output_dir] [filter]
games_lib path to GAMES.LIB (absolute or relative)
@BenMcLean
BenMcLean / organize-roms.ps1
Created January 17, 2026 19:57
Organize ROMs into Alphabetical Range Folders
# Organize ROMs into Alphabetical Range Folders
# This script moves ROM files into folders based on alphabetical ranges and truncates long filenames
param(
[string]$Path = ".",
[int]$MaxFilesPerFolder = 256,
[int]$MaxFilenameLength = 99,
[switch]$WhatIf
)
@BenMcLean
BenMcLean / rvz_to_iso.sh
Last active May 5, 2026 20:01
Batch convert RVZ to ISO using Dolphin's command-line tool
#!/bin/bash
# Check if source argument provided
if [ $# -eq 0 ]; then
echo "Usage: $0 <source_directory> [destination_directory]"
echo "Example: $0 /path/to/rvz/archive /path/to/sdcard"
echo ""
echo "If destination is not provided, files will be converted to the script's directory"
exit 1
fi
@BenMcLean
BenMcLean / iso_to_chd.sh
Last active November 2, 2025 23:58
Use mame-tools chdman to mass convert WAV/BIN/cue CD images to CHD format
#!/bin/bash
# Check if directory argument provided
if [ $# -eq 0 ]; then
echo "Usage: $0 <directory>"
echo "Example: $0 /path/to/psx"
exit 1
fi
TARGET_DIR="$1"
@BenMcLean
BenMcLean / organize_movies.sh
Last active July 4, 2025 00:49
Organize Jellyfin movies into folders based on titles from .nfo files
#!/bin/bash
# Jellyfin Movie Organizer Script
# This script organizes movie files into folders based on titles from .nfo files
# Usage: ./organize_movies.sh [--dry-run] /path/to/your/movie/library
set -e
# Check for xmlstarlet dependency
if ! command -v xmlstarlet >/dev/null 2>&1; then
@BenMcLean
BenMcLean / Safe85.cs
Created November 3, 2024 00:06
Safe85 C# Implementation
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Text;
/// <summary>
/// Specification: https://github.com/kstenerud/safe-encoding/blob/master/safe85-specification.md
/// Reference implementation: https://github.com/kstenerud/safe-encoding/tree/master/reference-implementation/safe85
/// </summary>
public static class Safe85
@BenMcLean
BenMcLean / ShadedColorRect.cs
Last active September 9, 2024 09:49
Draw a procedurally-generated palette-indexed texture using a shader in Godot.
public partial class ShadedColorRect : ColorRect
{
public const string GodotShaderCode = @"
shader_type canvas_item;
render_mode blend_disabled;
uniform vec4[7] u_palette;
uniform sampler2D u_texture : filter_nearest;
void fragment(){
vec2 texture_size = vec2(textureSize(u_texture, 0));
//COLOR = texture(u_texture, (floor(UV * texture_size) + .5) / texture_size);
@BenMcLean
BenMcLean / NoHyphensForJellyfin.py
Last active October 3, 2025 13:23
Replace hyphens in Jellyfin movie titles with colons.
import argparse
import glob
import os
import sys
import xml.etree.ElementTree
parser = argparse.ArgumentParser(description='Replaces hyphens in Jellyfin movie titles with colons instead.')
parser.add_argument('-f', '--folder', metavar='folder', type=str, nargs=1, required=True, default=[1], help='Root directory')
def error(msg, exitcode=3):
print(msg, file=sys.stderr)
sys.exit(exitcode)