Accumulated changes while server was down
This commit is contained in:
parent
45757f6ba4
commit
204738fb72
5 changed files with 97 additions and 12 deletions
|
@ -1,31 +1,31 @@
|
||||||
mpvq %U
|
umpv %U
|
||||||
^https?://invidio.us/.*
|
^https?://invidio.us/.*
|
||||||
|
|
||||||
mpvq %U
|
umpv %U
|
||||||
^https?://(m.)?(www.)?youtube.com/watch\?.*v=
|
^https?://(m.)?(www.)?youtube.com/watch\?.*v=
|
||||||
|
|
||||||
mpvq %U
|
umpv %U
|
||||||
^https?://(www.)?youtube.com/playlist\?.*list=
|
^https?://(www.)?youtube.com/playlist\?.*list=
|
||||||
|
|
||||||
mpvq %U
|
umpv %U
|
||||||
^https?://(www.)?youtu.be/
|
^https?://(www.)?youtu.be/
|
||||||
|
|
||||||
mpvq %U
|
umpv %U
|
||||||
^https?://(www.)?(m.)?twitch.tv/
|
^https?://(www.)?(m.)?twitch.tv/
|
||||||
|
|
||||||
mpvq %U
|
umpv %U
|
||||||
^https?://(?:[a-z0-9\-]+\.)+[a-z]{2,6}(?:/[^/#?]+)+\.(?:mp4|mkv|webm|avi|3gp|gif|gifv)
|
^https?://(?:[a-z0-9\-]+\.)+[a-z]{2,6}(?:/[^/#?]+)+\.(?:mp4|mkv|webm|avi|3gp|gif|gifv)
|
||||||
|
|
||||||
mpvq %U
|
umpv %U
|
||||||
^https?://www.facebook.com/.*/videos/
|
^https?://www.facebook.com/.*/videos/
|
||||||
|
|
||||||
mpvq %U
|
umpv %U
|
||||||
^https?://gfycat.com/.*
|
^https?://gfycat.com/.*
|
||||||
|
|
||||||
mpvq %U
|
umpv %U
|
||||||
^https?://vimeo.com/.*
|
^https?://vimeo.com/.*
|
||||||
|
|
||||||
mpvq %U
|
umpv %U
|
||||||
^https?://v.redd.it/.*
|
^https?://v.redd.it/.*
|
||||||
|
|
||||||
imgurviewer %U
|
imgurviewer %U
|
||||||
|
|
|
@ -2,4 +2,4 @@ title Kodi
|
||||||
initrd /amd-ucode.img
|
initrd /amd-ucode.img
|
||||||
initrd /initramfs-linux.img
|
initrd /initramfs-linux.img
|
||||||
linux /vmlinuz-linux
|
linux /vmlinuz-linux
|
||||||
options rd.luks.uuid=19fa8fab-c5fe-454a-9a17-b7185ce975ea rd.luks.name=19fa8fab-c5fe-454a-9a17-b7185ce975ea=cryptroot rd.luks.options=allow-discards root=/dev/mapper/cryptroot rootflags=subvol=root resume=/dev/mapper/cryptroot resume_offset=7345408 rw quiet splash vga=current idle=nomwait video=eDP-1:d
|
options rd.luks.uuid=19fa8fab-c5fe-454a-9a17-b7185ce975ea rd.luks.name=19fa8fab-c5fe-454a-9a17-b7185ce975ea=cryptroot rd.luks.options=allow-discards root=/dev/mapper/cryptroot rootflags=subvol=root resume=/dev/mapper/cryptroot resume_offset=10530935 rw quiet splash vga=current idle=nomwait video=eDP-1:d video=1920x1080@60
|
||||||
|
|
|
@ -2,7 +2,7 @@ MODULES=(amdgpu)
|
||||||
FILES=()
|
FILES=()
|
||||||
{%@@ if profile == "Mirkwood" @@%}
|
{%@@ if profile == "Mirkwood" @@%}
|
||||||
BINARIES=("/usr/bin/btrfs")
|
BINARIES=("/usr/bin/btrfs")
|
||||||
HOOKS=(base autodetect modconf block filesystems keyboard fsck systemd sd-welcomemessage sd-encrypt)
|
HOOKS=(base autodetect modconf block filesystems keyboard fsck systemd sd-colors sd-vconsole sd-encrypt)
|
||||||
{%@@ else @@%}
|
{%@@ else @@%}
|
||||||
BINARIES=()
|
BINARIES=()
|
||||||
HOOKS=(colors consolefont base udev autodetect modconf block filesystems keyboard fsck)
|
HOOKS=(colors consolefont base udev autodetect modconf block filesystems keyboard fsck)
|
||||||
|
|
|
@ -9,6 +9,7 @@ export MOZ_WEBRENDER=1
|
||||||
|
|
||||||
# Enable xdg-desktop-portal-wlr
|
# Enable xdg-desktop-portal-wlr
|
||||||
export XDG_CURRENT_DESKTOP=sway
|
export XDG_CURRENT_DESKTOP=sway
|
||||||
|
export XDG_SESSION_TYPE=wayland
|
||||||
|
|
||||||
# Fix java on wayland
|
# Fix java on wayland
|
||||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||||
|
|
84
root/usr/local/bin/umpv
Executable file
84
root/usr/local/bin/umpv
Executable file
|
@ -0,0 +1,84 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""
|
||||||
|
This script emulates "unique application" functionality on Linux. When starting
|
||||||
|
playback with this script, it will try to reuse an already running instance of
|
||||||
|
mpv (but only if that was started with umpv). Other mpv instances (not started
|
||||||
|
by umpv) are ignored, and the script doesn't know about them.
|
||||||
|
This only takes filenames as arguments. Custom options can't be used; the script
|
||||||
|
interprets them as filenames. If mpv is already running, the files passed to
|
||||||
|
umpv are appended to mpv's internal playlist. If a file does not exist or is
|
||||||
|
otherwise not playable, mpv will skip the playlist entry when attempting to
|
||||||
|
play it (from the GUI perspective, it's silently ignored).
|
||||||
|
If mpv isn't running yet, this script will start mpv and let it control the
|
||||||
|
current terminal. It will not write output to stdout/stderr, because this
|
||||||
|
will typically just fill ~/.xsession-errors with garbage.
|
||||||
|
mpv will terminate if there are no more files to play, and running the umpv
|
||||||
|
script after that will start a new mpv instance.
|
||||||
|
Note: you can supply custom mpv path and options with the MPV environment
|
||||||
|
variable. The environment variable will be split on whitespace, and the
|
||||||
|
first item is used as path to mpv binary and the rest is passed as options
|
||||||
|
_if_ the script starts mpv. If mpv is not started by the script (i.e. mpv
|
||||||
|
is already running), this will be ignored.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import socket
|
||||||
|
import errno
|
||||||
|
import subprocess
|
||||||
|
import fcntl
|
||||||
|
import stat
|
||||||
|
import string
|
||||||
|
|
||||||
|
files = sys.argv[1:]
|
||||||
|
|
||||||
|
# this is the same method mpv uses to decide this
|
||||||
|
def is_url(filename):
|
||||||
|
parts = filename.split("://", 1)
|
||||||
|
if len(parts) < 2:
|
||||||
|
return False
|
||||||
|
# protocol prefix has no special characters => it's an URL
|
||||||
|
allowed_symbols = string.ascii_letters + string.digits + '_'
|
||||||
|
prefix = parts[0]
|
||||||
|
return all(map(lambda c: c in allowed_symbols, prefix))
|
||||||
|
|
||||||
|
# make them absolute; also makes them safe against interpretation as options
|
||||||
|
def make_abs(filename):
|
||||||
|
if not is_url(filename):
|
||||||
|
return os.path.abspath(filename)
|
||||||
|
return filename
|
||||||
|
files = [make_abs(f) for f in files]
|
||||||
|
|
||||||
|
SOCK = os.path.join(os.getenv("HOME"), ".umpv_socket")
|
||||||
|
|
||||||
|
sock = None
|
||||||
|
try:
|
||||||
|
sock = socket.socket(socket.AF_UNIX)
|
||||||
|
sock.connect(SOCK)
|
||||||
|
except socket.error as e:
|
||||||
|
if e.errno == errno.ECONNREFUSED:
|
||||||
|
sock = None
|
||||||
|
pass # abandoned socket
|
||||||
|
elif e.errno == errno.ENOENT:
|
||||||
|
sock = None
|
||||||
|
pass # doesn't exist
|
||||||
|
else:
|
||||||
|
raise e
|
||||||
|
|
||||||
|
if sock:
|
||||||
|
# Unhandled race condition: what if mpv is terminating right now?
|
||||||
|
for f in files:
|
||||||
|
# escape: \ \n "
|
||||||
|
f = f.replace("\\", "\\\\").replace("\"", "\\\"").replace("\n", "\\n")
|
||||||
|
f = "\"" + f + "\""
|
||||||
|
sock.send(("raw loadfile " + f + " append\n").encode("utf-8"))
|
||||||
|
else:
|
||||||
|
# Let mpv recreate socket if it doesn't already exist.
|
||||||
|
|
||||||
|
opts = (os.getenv("MPV") or "mpv").split()
|
||||||
|
opts.extend(["--no-terminal", "--force-window", "--input-ipc-server=" + SOCK,
|
||||||
|
"--"])
|
||||||
|
opts.extend(files)
|
||||||
|
|
||||||
|
subprocess.check_call(opts)
|
Loading…
Reference in a new issue