Corrects the filenames and metadata of music files.
You want your music files named:
ALBUM/TRACK-NUMBER - ARTIST - TRACK-TITLE.EXT
from tastypie.resources import ModelResource as BaseModelResource | |
class ReadOnlyFieldsAfterAddMeta(BaseModelResource.__metaclass__): | |
def __new__(cls, name, bases, attrs): | |
new_class = super(ReadOnlyFieldsAfterAddMeta, cls).__new__(cls, name, bases, attrs) | |
read_only_fields_after_add = getattr(new_class._meta, 'read_only_after_add', ()) | |
for field_name in read_only_fields_after_add: |
#!/bin/bash | |
# | |
# Usage: watch-and-revert.sh filename | |
# | |
BACKUP="$(dirname $1)/.backup-$(basename $1)" | |
function cleanup { | |
rm $BACKUP | |
} | |
trap cleanup EXIT | |
cat $1 > $BACKUP |
#!env python3 | |
import argparse | |
import datetime | |
import enum | |
import math | |
import os.path | |
import shlex | |
import shutil | |
import subprocess |
import decimal | |
class FixedPoint(decimal.Decimal): | |
def to_fixed_point(self, whole_bits, fraction_bits, signed=False): | |
# returns bytes aligned to the last fraction bit | |
total = round(self * (1 << fraction_bits)) | |
num_bytes = (whole_bits + fraction_bits) / 8 | |
if num_bytes % 1: |
LOGGING = { | |
'handlers': { | |
'console': { | |
# ... | |
}, | |
# ... | |
}, | |
'loggers': { | |
'django.db.backends': { | |
'handlers': ['console'], |
FROM alpine:latest | |
EXPOSE 8123 | |
VOLUME ["/root/.homeassistant"] | |
RUN ["apk", "update"] | |
RUN ["apk", "add", "--no-cache", "g++", "python3-dev", "python3", "linux-headers"] | |
RUN ["python3", "-m", "pip", "install", "homeassistant", "netdisco", "sqlalchemy", "warrant", "xmltodict"] | |
# Trim the fat |
#!/usr/bin/env python3 | |
import csv | |
import datetime | |
import getpass | |
import os | |
import re | |
import sys | |
import time |
#!/bin/sh | |
plex_token="YOUR TOKEN HERE" | |
plex_rpm_url="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=redhat&X-Plex-Token=$plex_token" | |
current_version="$(rpm -q --queryformat '%{VERSION}\n' plexmediaserver)" | |
latest_version="$(curl -I $plex_rpm_url 2>/dev/null | egrep '^Location:' | cut -d'/' -f 5 | cut -d'-' -f1)" | |
if [ "$current_version" != "$latest_version" ]; then | |
rpm -Uvh $plex_rpm_url >/dev/null 2>&1 | |
success="$?" |
I have no idea if this is a correct implementation or not, as I have no reference implementation to compare it to. I swear there used to be an implementation as part of Android but I can't find it now.