Skip to content

Instantly share code, notes, and snippets.

View iwalton3's full-sized avatar

Izzie Walton iwalton3

View GitHub Profile

Keybase proof

I hereby claim:

  • I am iwalton3 on github.
  • I am iwalton3 (https://keybase.io/iwalton3) on keybase.
  • I have a public key ASBzhEskQ2k2K7HWtpODJCJcVGYtkXMpMRWmmvhDVf5xngo

To claim this, I am signing this object:

@iwalton3
iwalton3 / raise_mpv.py
Created January 16, 2020 04:17
Raise MPV
# Depends on Python 3 and pywin32.
# https://www.python.org/downloads/
# pip install pywin32
import win32gui
# Mode 5 = Raise to top
# Mode 9 = Unminimize and raise to top
WINDOW_MODE = 5
@iwalton3
iwalton3 / __init__.py
Created February 21, 2020 18:51
Fix for mijofa/jellyfin-mpv-shim pywebview version 3.2.
import threading
import importlib.resources
import webview as webview_module # Python3-webview in Debian, pywebview in pypi
import jinja2 # python3-jinja2 in Debian, Jinja2 in pypi
from ..clients import clientManager
from . import helpers
import threading
function getMediaTitle(media) {
let parts = media.Part;
for (let k = 0; k < parts.length; k++) {
if (!parts[k].hasOwnProperty("file")) continue;
const format = parts[k].file.match(".*{([^}]*)}.*$");
if (format != null) return format[1];
}
return "Unknown";
}
function getMediaTitle(media) {
let parts = media.Part;
for (let k = 0; k < parts.length; k++) {
if (!parts[k].hasOwnProperty("file")) continue;
const format = parts[k].file.match(".*[\\\\/]+([^\\\\/]\+)$");
if (format != null) return format[1];
}
return "Unknown";
}
function getMediaTitle(media) {
let parts = media.Part;
for (let k = 0; k < parts.length; k++) {
if (!parts[k].hasOwnProperty("Stream")) continue;
let streams = parts[k].Stream;
for (let l = 0; l < streams.length; l++) {
if (streams[l].streamType == 1 && streams[l].hasOwnProperty("displayTitle")) {
const format = streams[l].displayTitle.match(".* \\((.*)\\)$");
if (format != null) return format[1] + " " + media.container;
else return media.container;
#!/usr/bin/env python3
import sys
import subprocess
from align_videos_by_soundtrack.align import SyncDetector, cli_common
remove = []
remove_specified = False
remove_all = False
add = []
add_specified = False
@iwalton3
iwalton3 / gpaeq-print.py
Created April 3, 2020 23:49
gpaeq pulseaudio-equalizer, but it is patched to print how many dB you adjust each slider. From: https://github.com/pulseaudio/pulseaudio/blob/master/src/utils/qpaeq
#!/usr/bin/env python3
# qpaeq is a equalizer interface for pulseaudio's equalizer sinks
# Copyright (C) 2009 Jason Newton <nevion@gmail.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 2.1 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@iwalton3
iwalton3 / nvenc-yuv420p10le.md
Last active April 15, 2020 13:07
Patch in Nvenc yuv420p10le on latest ffmpeg.

These instructions will allow you to encode yuv420p10le with ffmpeg while using nvenc. Note that other pixel formats have not been tested and may be broken. I do not suggest using this as your main ffmpeg installation. You also need to install the nv-codec-headers and other dependencies as required by ./configure when building.

git clone https://github.com/FFmpeg/FFmpeg
cd FFmpeg
git apply nvenc-yuv420p10le.patch
./configure pkg_config='pkg-config --static' --prefix=/usr/local --extra-version=ntd_20150126 --disable-shared --enable-static --enable-gpl --enable-pthreads --enable-nonfree --enable-fontconfig --enable-libfreetype --enable-libass --enable-libfdk-aac  --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-filters --enable-runtime-cpudetect
make -j8
# Do not run sudo make install, just use the ffmpeg as-is.
@iwalton3
iwalton3 / fingerprint-compare2.py
Last active May 20, 2020 22:03
Chromaprint Duplicate Finder (License: MIT)
#!/usr/bin/env python3
import numpy as np
import numba
import json
@numba.jit(nopython=True)
def dist(listx: numba.types.uint32[:], listy: numba.types.uint32[:]):
covariance = 0
xlen = min(len(listx),len(listy))
if xlen < 50: