Compare commits

..

7 Commits

Author SHA1 Message Date
ed
fb81de3b36 v0.11.24 2021-06-22 17:28:09 +02:00
ed
aa4f352301 prefer audio tags in audio files 2021-06-22 17:21:24 +02:00
ed
f1a1c2ea45 recover from opening a corrupt database 2021-06-22 17:19:56 +02:00
ed
6249bd4163 add pebkac hints 2021-06-22 17:18:34 +02:00
ed
2579dc64ce update notes 2021-06-21 22:49:28 +00:00
ed
356512270a file extensions dont contain whitespace 2021-06-21 23:50:35 +02:00
ed
bed27f2b43 mention fix for the OSD popup on windows 2021-06-21 23:43:07 +02:00
7 changed files with 39 additions and 15 deletions

View File

@@ -168,15 +168,16 @@ summary: all planned features work! now please enjoy the bloatening
## hotkeys ## hotkeys
the browser has the following hotkeys the browser has the following hotkeys
* `B` toggle breadcrumbs / directory tree
* `I/K` prev/next folder * `I/K` prev/next folder
* `P` parent folder * `M` parent folder
* `G` toggle list / grid view * `G` toggle list / grid view
* `T` toggle thumbnails / icons * `T` toggle thumbnails / icons
* when playing audio: * when playing audio:
* `0..9` jump to 10%..90% * `0..9` jump to 10%..90%
* `U/O` skip 10sec back/forward * `U/O` skip 10sec back/forward
* `J/L` prev/next song * `J/L` prev/next song
* `M` play/pause (also starts playing the folder) * `P` play/pause (also starts playing the folder)
* in the grid view: * in the grid view:
* `S` toggle multiselect * `S` toggle multiselect
* `A/D` zoom * `A/D` zoom
@@ -184,9 +185,9 @@ the browser has the following hotkeys
## tree-mode ## tree-mode
by default there's a breadcrumbs path; you can replace this with a tree-browser sidebar thing by clicking the 🌲 by default there's a breadcrumbs path; you can replace this with a tree-browser sidebar thing by clicking the `🌲` or pressing the `B` hotkey
click `[-]` and `[+]` to adjust the size, and the `[a]` toggles if the tree should widen dynamically as you go deeper or stay fixed-size click `[-]` and `[+]` (or hotkeys `A`/`D`) to adjust the size, and the `[a]` toggles if the tree should widen dynamically as you go deeper or stay fixed-size
## thumbnails ## thumbnails
@@ -280,6 +281,8 @@ up2k has saved a few uploads from becoming corrupted in-transfer already; caught
* you can link a particular timestamp in an audio file by adding it to the URL, such as `&20` / `&20s` / `&1m20` / `&t=1:20` after the `.../#af-c8960dab` * you can link a particular timestamp in an audio file by adding it to the URL, such as `&20` / `&20s` / `&1m20` / `&t=1:20` after the `.../#af-c8960dab`
* if you are using media hotkeys to switch songs and are getting tired of seeing the OSD popup which Windows doesn't let you disable, consider https://ocv.me/dev/?media-osd-bgone.ps1
# searching # searching

View File

@@ -1,8 +1,8 @@
# coding: utf-8 # coding: utf-8
VERSION = (0, 11, 23) VERSION = (0, 11, 24)
CODENAME = "the grid" CODENAME = "the grid"
BUILD_DT = (2021, 6, 21) BUILD_DT = (2021, 6, 22)
S_VERSION = ".".join(map(str, VERSION)) S_VERSION = ".".join(map(str, VERSION))
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT) S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)

View File

@@ -10,7 +10,6 @@ import json
import string import string
import socket import socket
import ctypes import ctypes
import traceback
from datetime import datetime from datetime import datetime
import calendar import calendar
@@ -50,6 +49,7 @@ class HttpCli(object):
self.tls = hasattr(self.s, "cipher") self.tls = hasattr(self.s, "cipher")
self.bufsz = 1024 * 32 self.bufsz = 1024 * 32
self.hint = None
self.absolute_urls = False self.absolute_urls = False
self.out_headers = {"Access-Control-Allow-Origin": "*"} self.out_headers = {"Access-Control-Allow-Origin": "*"}
@@ -72,6 +72,7 @@ class HttpCli(object):
"""returns true if connection can be reused""" """returns true if connection can be reused"""
self.keepalive = False self.keepalive = False
self.headers = {} self.headers = {}
self.hint = None
try: try:
headerlines = read_header(self.sr) headerlines = read_header(self.sr)
if not headerlines: if not headerlines:
@@ -130,6 +131,9 @@ class HttpCli(object):
if v is not None: if v is not None:
self.log("[H] {}: \033[33m[{}]".format(k, v), 6) self.log("[H] {}: \033[33m[{}]".format(k, v), 6)
if "&" in self.req and "?" not in self.req:
self.hint = "did you mean '?' instead of '&'"
# split req into vpath + uparam # split req into vpath + uparam
uparam = {} uparam = {}
if "?" not in self.req: if "?" not in self.req:
@@ -199,6 +203,9 @@ class HttpCli(object):
self.log("{}\033[0m, {}".format(str(ex), self.vpath), 3) self.log("{}\033[0m, {}".format(str(ex), self.vpath), 3)
msg = "<pre>{}\r\nURL: {}\r\n".format(str(ex), self.vpath) msg = "<pre>{}\r\nURL: {}\r\n".format(str(ex), self.vpath)
if self.hint:
msg += "hint: {}\r\n".format(self.hint)
self.reply(msg.encode("utf-8", "replace"), status=ex.code) self.reply(msg.encode("utf-8", "replace"), status=ex.code)
return self.keepalive return self.keepalive
except Pebkac: except Pebkac:
@@ -1305,7 +1312,7 @@ class HttpCli(object):
ext = "folder" ext = "folder"
exact = True exact = True
bad = re.compile(r"[](){}/[]|^[0-9_-]*$") bad = re.compile(r"[](){}/ []|^[0-9_-]*$")
n = ext.split(".")[::-1] n = ext.split(".")[::-1]
if not exact: if not exact:
n = n[:-1] n = n[:-1]

View File

@@ -3,7 +3,6 @@ from __future__ import print_function, unicode_literals
import re import re
import os import os
import sys
import time import time
import socket import socket

View File

@@ -115,6 +115,19 @@ def parse_ffprobe(txt):
ret = {} # processed ret = {} # processed
md = {} # raw tags md = {} # raw tags
is_audio = fmt.get("format_name") in ["mp3", "ogg", "flac", "wav"]
if fmt.get("filename", "").split(".")[-1].lower() in ["m4a", "aac"]:
is_audio = True
# if audio file, ensure audio stream appears first
if (
is_audio
and len(streams) > 2
and streams[1].get("codec_type") != "audio"
and streams[2].get("codec_type") == "audio"
):
streams = [fmt, streams[2], streams[1]] + streams[3:]
have = {} have = {}
for strm in streams: for strm in streams:
typ = strm.get("codec_type") typ = strm.get("codec_type")
@@ -134,9 +147,7 @@ def parse_ffprobe(txt):
] ]
if typ == "video": if typ == "video":
if strm.get("DISPOSITION:attached_pic") == "1" or fmt.get( if strm.get("DISPOSITION:attached_pic") == "1" or is_audio:
"format_name"
) in ["mp3", "ogg", "flac"]:
continue continue
kvm = [ kvm = [
@@ -180,7 +191,7 @@ def parse_ffprobe(txt):
k = k[4:].strip() k = k[4:].strip()
v = v.strip() v = v.strip()
if k and v: if k and v and k not in md:
md[k] = [v] md[k] = [v]
for k in [".q", ".vq", ".aq"]: for k in [".q", ".vq", ".aq"]:

View File

@@ -653,7 +653,7 @@ class Up2k(object):
try: try:
parser = MParser(parser) parser = MParser(parser)
except: except:
self.log("invalid argument: " + parser, 1) self.log("invalid argument (could not find program): " + parser, 1)
return return
for tag in entags: for tag in entags:
@@ -901,7 +901,7 @@ class Up2k(object):
except: except:
self.log("WARN: could not list files; DB corrupt?\n" + min_ex()) self.log("WARN: could not list files; DB corrupt?\n" + min_ex())
elif ver > DB_VER: if (ver or 0) > DB_VER:
m = "database is version {}, this copyparty only supports versions <= {}" m = "database is version {}, this copyparty only supports versions <= {}"
raise Exception(m.format(ver, DB_VER)) raise Exception(m.format(ver, DB_VER))

View File

@@ -103,6 +103,9 @@ cat warks | while IFS= read -r x; do sqlite3 up2k.db "delete from mt where w = '
# dump all dbs # dump all dbs
find -iname up2k.db | while IFS= read -r x; do sqlite3 "$x" 'select substr(w,1,12), rd, fn from up' | sed -r 's/\|/ \| /g' | while IFS= read -r y; do printf '%s | %s\n' "$x" "$y"; done; done find -iname up2k.db | while IFS= read -r x; do sqlite3 "$x" 'select substr(w,1,12), rd, fn from up' | sed -r 's/\|/ \| /g' | while IFS= read -r y; do printf '%s | %s\n' "$x" "$y"; done; done
# unschedule mtp scan for all files somewhere under "enc/"
sqlite3 -readonly up2k.db 'select substr(up.w,1,16) from up inner join mt on mt.w = substr(up.w,1,16) where rd like "enc/%" and +mt.k = "t:mtp"' > keys; awk '{printf "delete from mt where w = \"%s\" and +k = \"t:mtp\";\n", $0}' <keys | tee /dev/stderr | sqlite3 up2k.db
## ##
## media ## media
@@ -200,3 +203,4 @@ mk() { rm -rf /tmp/foo; sudo -u ed bash -c 'mkdir /tmp/foo; echo hi > /tmp/foo/b
mk && t0="$(date)" && while true; do date -s "$(date '+ 1 hour')"; systemd-tmpfiles --clean; ls -1 /tmp | grep foo || break; done; echo "$t0" mk && t0="$(date)" && while true; do date -s "$(date '+ 1 hour')"; systemd-tmpfiles --clean; ls -1 /tmp | grep foo || break; done; echo "$t0"
mk && sudo -u ed flock /tmp/foo sleep 40 & sleep 1; ps aux | grep -E 'sleep 40$' && t0="$(date)" && for n in {1..40}; do date -s "$(date '+ 1 day')"; systemd-tmpfiles --clean; ls -1 /tmp | grep foo || break; done; echo "$t0" mk && sudo -u ed flock /tmp/foo sleep 40 & sleep 1; ps aux | grep -E 'sleep 40$' && t0="$(date)" && for n in {1..40}; do date -s "$(date '+ 1 day')"; systemd-tmpfiles --clean; ls -1 /tmp | grep foo || break; done; echo "$t0"
mk && t0="$(date)" && for n in {1..40}; do date -s "$(date '+ 1 day')"; systemd-tmpfiles --clean; ls -1 /tmp | grep foo || break; tar -cf/dev/null /tmp/foo; done; echo "$t0" mk && t0="$(date)" && for n in {1..40}; do date -s "$(date '+ 1 day')"; systemd-tmpfiles --clean; ls -1 /tmp | grep foo || break; tar -cf/dev/null /tmp/foo; done; echo "$t0"