Skip to content

Instantly share code, notes, and snippets.

@movalex
movalex / album_pack.py
Created July 15, 2026 08:12
Pack Albums into a single flac for gapless playback on Mechen M30
#!/usr/bin/env python3
"""
album_pack.py - Make albums Mechen-M30-ready (gapless single FLAC + sidecar cue).
Point it at ANY folder. It walks the tree and treats every folder that directly
contains audio as one album (nested libraries like Artist/.../Year - Album/*.flac
are fully discovered; pure artwork subfolders are ignored). Each album is one of:
CASE A single audio file (e.g. an already-concatenated EAC rip, with or without a .cue)
-> used as-is, NO re-encode (unless --cd-quality forces a resample). Fixes/normalizes
@movalex
movalex / fix_flac_covers.sh
Created July 14, 2026 06:30
Flac fix the cover tags
#!/usr/bin/env bash
# fix_flac_covers.sh - retag embedded FLAC cover art to picture type 3 (Front cover), in place.
#
# Why: ffmpeg embeds FLAC covers as picture type 0 ("Other"). Some players (e.g. Mechen M30)
# choke on that and then ignore the ENTIRE metadata block - so album/artist vanish too.
# Rewriting the cover as type 3 ("Cover (front)") fixes it. This does the export -> remove ->
# re-import-as-type-3 dance for every FLAC found, recursively.
#
# Usage:
# ./fix_flac_covers.sh [--dry-run] [DIR]
import re
import os
import time
import googleapiclient.discovery
from datetime import timedelta
from functools import reduce
API_TEST_CHANNEL = "UC_x5XG1OV2P6uZZ5FSM9Ttw" # Google Developers YouTube channel
MAX_RESULTS = 10
@movalex
movalex / get_files_without_extensions.ps1
Created January 11, 2024 00:52
Powershell get file list without extensions
Get-ChildItem | Select-Object -ExpandProperty Name | ForEach-Object { $_.Substring(0, $_.LastIndexOf(".")) }
@movalex
movalex / ParseDuration.m
Last active January 10, 2024 18:57
Power Query Youtube API parse Songs
// ParseDuration
let
ParseDuration = (duration as text) as nullable time =>
let
minutesText = Text.BetweenDelimiters(duration, "PT", "M"),
secondsText = Text.BetweenDelimiters(duration, "M", "S"),
minutes = if minutesText <> "" then Number.FromText(minutesText) else 0,
seconds = if secondsText <> "" then Number.FromText(secondsText) else 0,
time = #time(0, minutes, seconds)
in
@movalex
movalex / download_cloudapp_data.py
Last active January 3, 2024 21:40
Download CloudApp Data
import argparse
import os
import pandas as pd
import requests
from requests.adapters import HTTPAdapter, Retry
import concurrent.futures
from pathlib import Path
from tqdm import tqdm
from datetime import datetime
@movalex
movalex / https_server_setup_simple.py
Created December 22, 2023 09:26
Setup simple https server
from http.server import HTTPServer, SimpleHTTPRequestHandler
import ssl
import socketserver
httpd = HTTPServer(('0.0.0.0', 4443), SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket,
keyfile=r"C:/Users/username/.certs/key.pem",
certfile=r'C:/Users/username/.certs/cert.pem', server_side=True)
@movalex
movalex / install_qbittorrent-nox_macos.md
Last active December 10, 2025 07:01
Install qbittorrent-nox on macos 12+

Requirements

  • zlib >= 1.2.11
  • Qt 6.5.0 - 6.5.5
    • Despite building headless application, the QT library should be installed
  • CMake >= 3.16
  • Boost >= 1.76
  • libtorrent-rasterbar >= 1.2.19
  • Python >= 3.7.0
@movalex
movalex / ydl_40sec.sh
Created October 9, 2023 11:57
download first n seconds from youtube video
yt-dlp.exe --downloader ffmpeg --downloader-args "ffmpeg:-t 40"
@movalex
movalex / 01. remove_zero_sized_onedrive_items.ps1
Last active August 29, 2023 10:00
Remove unsynced OneDrive files with Zero Disk Size
$files = Get-ChildItem -Recurse "*.*"
foreach ($f in $files) {
If ($f.attributes -eq 4199968) {
$outfile = $f.FullName
$attrs = $f.attributes
Write-Output "file: $outFile`nlen: $((Get-Item $f).length)`nattrs: $attrs"
Remove-Item $f
echo $outfile >> files.txt
}