Skip to content

Instantly share code, notes, and snippets.

@tobiasglen
tobiasglen / toggle-chatgpt.sh
Created December 18, 2024 00:33
toggle focus between firefox chatgpt tab and most recent used application/tab
#!/usr/bin/bash
# required programms: kdotool, ydotool, firefox
# - chatgpt needs to be open/pinned to the first tab of firefox
# - Make sure the chatgpt tab is renamed to include "chatgpt" in the title
# - Use something like https://github.com/Lazyuki/ReTitle to do this (e.g. $0 - chatgpt)
command -v kdotool >/dev/null 2>&1 || { echo "DEBUG: Missing kdotool."; exit 1; }
command -v ydotool >/dev/null 2>&1 || { echo "DEBUG: Missing ydotool."; exit 1; }
@tobiasglen
tobiasglen / emby_poster_auto_download.py
Last active June 12, 2023 06:24
On my server, the 4K TV primary posters rarely download automatically. This script handles that for me. Finds shows with missing primary poster & using Emby API only finds & sets the top poster from whichever image/metadata provider returns a response. Written by me and for my use case specifically. Run on Emby Server 4.7.12.0
import requests
import json
HOST_URL = 'https://emby.example.com'
API_KEY = '*************************'
TARGET_LIB_ID = '*************************' # Used library GUID
class EmbyHelper:
@tobiasglen
tobiasglen / sonarr-stats.py
Created December 26, 2022 12:40
Uses Sonarr V3's API endpoint /history to generate monthly or yearly summaries of its activity (TB's downloaded, top groups, etc.)
import requests
import json
import time
start_time = time.time()
# ----------------- CONFIG ----------------- #
SONARR_URL = 'https://sonarr.example.com'
SONARR_PORT = 443
@tobiasglen
tobiasglen / active_emby_streams.py
Created August 4, 2021 04:27
script to quickly show whats being played in Emby using a rich table
import sys
import requests
from rich.table import Table
from rich.console import Console
emby_base_url = 'https://emby.example.com'
emby_api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
@tobiasglen
tobiasglen / emby_4k_title.py
Last active August 4, 2021 02:08
Edit Emby 4K library items to include (4K) in the title | e.g. --> TV Show Title (4K)
import sys
import json
import logging
import requests
import argparse
from rich.progress import track
emby_base_url = 'https://emby.domain.com'
emby_api_key = 'fill_me_out'
@tobiasglen
tobiasglen / stop_4k_transcodes.py
Last active May 6, 2025 04:04
Stop-Emby-transcodes-automatically
# this requires your content naming scheme includes the resolution in the file name
# --> (Show Title - s01e02 - Episode Name - WEBDL-2160p - (h265 EAC3 Atmos) - GROUP.mkv)
# the script will then first check locally to make sure the ffmpeg transcode process is transcoding video (audio and container is allowed)
# and makes sure "2160p" is in the file name, if both cases are true then the script will kill the process and show the user an error message
import os
import re
import requests
import time
import logging