mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 00:52:16 -06:00
v0.9.9
This commit is contained in:
parent
49e4fb7e12
commit
7f8d7d6006
|
@ -1,8 +1,8 @@
|
|||
# coding: utf-8
|
||||
|
||||
VERSION = (0, 9, 8)
|
||||
VERSION = (0, 9, 9)
|
||||
CODENAME = "the strongest music server"
|
||||
BUILD_DT = (2021, 3, 15)
|
||||
BUILD_DT = (2021, 3, 21)
|
||||
|
||||
S_VERSION = ".".join(map(str, VERSION))
|
||||
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
|
||||
|
|
|
@ -350,7 +350,7 @@ class AuthSrv(object):
|
|||
a = a.split("=")[0]
|
||||
local_mtp[a] = True
|
||||
local = True
|
||||
for b in self.args.mtp:
|
||||
for b in self.args.mtp or []:
|
||||
b = b.split("=")[0]
|
||||
if a == b:
|
||||
local = False
|
||||
|
@ -376,7 +376,7 @@ class AuthSrv(object):
|
|||
self.log(m.format(vol.vpath, mtp), 1)
|
||||
errors = True
|
||||
|
||||
for mtp in self.args.mtp:
|
||||
for mtp in self.args.mtp or []:
|
||||
mtp = mtp.split("=")[0]
|
||||
if mtp not in all_mte:
|
||||
m = 'metadata tag "{}" is defined by "-mtm" or "-mtp", but is not used by "-mte" (or by any "cmte" volume-flag)'
|
||||
|
|
|
@ -140,7 +140,7 @@ class U2idx(object):
|
|||
|
||||
q += " where " + (" and ".join(where))
|
||||
|
||||
self.log("q2: {} {}".format(q, repr(v)))
|
||||
# self.log("q2: {} {}".format(q, repr(v)))
|
||||
|
||||
ret = []
|
||||
lim = 1000
|
||||
|
@ -182,6 +182,12 @@ class U2idx(object):
|
|||
done_flag.append(True)
|
||||
self.active_id = None
|
||||
|
||||
# undupe hits from multiple metadata keys
|
||||
if len(ret) > 1:
|
||||
ret = [ret[0]] + [
|
||||
y for x, y in zip(ret[:-1], ret[1:]) if x["rp"] != y["rp"]
|
||||
]
|
||||
|
||||
return ret, list(taglist.keys())
|
||||
|
||||
def terminator(self, identifier, done_flag):
|
||||
|
|
|
@ -29,6 +29,7 @@ from .util import (
|
|||
s3enc,
|
||||
s3dec,
|
||||
statdir,
|
||||
s2hms,
|
||||
)
|
||||
from .mtag import MTag
|
||||
from .authsrv import AuthSrv
|
||||
|
@ -499,12 +500,17 @@ class Up2k(object):
|
|||
return ret
|
||||
|
||||
def _run_all_mtp(self):
|
||||
t0 = time.time()
|
||||
self.mtp_force = {}
|
||||
self.mtp_parsers = {}
|
||||
for ptop, flags in self.flags.items():
|
||||
if "mtp" in flags:
|
||||
self._run_one_mtp(ptop)
|
||||
|
||||
td = time.time() - t0
|
||||
msg = "mtp finished in {:.2f} sec ({})"
|
||||
self.log(msg.format(td, s2hms(td, True)))
|
||||
|
||||
def _run_one_mtp(self, ptop):
|
||||
db_path = os.path.join(ptop, ".hist", "up2k.db")
|
||||
sz0 = os.path.getsize(db_path) // 1024
|
||||
|
@ -651,9 +657,6 @@ class Up2k(object):
|
|||
wcur.close()
|
||||
cur.close()
|
||||
|
||||
if n_done:
|
||||
self.log("mtp finished")
|
||||
|
||||
def _start_mpool(self):
|
||||
if WINDOWS and False:
|
||||
nah = open(os.devnull, "wb")
|
||||
|
|
|
@ -550,6 +550,16 @@ def get_spd(nbyte, t0, t=None):
|
|||
return "{} \033[0m{}/s\033[0m".format(s1, s2)
|
||||
|
||||
|
||||
def s2hms(s, optional_h=False):
|
||||
s = int(s)
|
||||
h, s = divmod(s, 3600)
|
||||
m, s = divmod(s, 60)
|
||||
if not h and optional_h:
|
||||
return "{}:{:02}".format(m, s)
|
||||
|
||||
return "{}:{:02}:{:02}".format(h, m, s)
|
||||
|
||||
|
||||
def undot(path):
|
||||
ret = []
|
||||
for node in path.split("/"):
|
||||
|
|
|
@ -67,6 +67,12 @@ wget -S --header='Accept-Encoding: gzip' -U 'MSIE 6.0; SV1' http://127.0.0.1:392
|
|||
shab64() { sp=$1; f="$2"; v=0; sz=$(stat -c%s "$f"); while true; do w=$((v+sp*1024*1024)); printf $(tail -c +$((v+1)) "$f" | head -c $((w-v)) | sha512sum | cut -c-64 | sed -r 's/ .*//;s/(..)/\\x\1/g') | base64 -w0 | cut -c-43 | tr '+/' '-_'; v=$w; [ $v -lt $sz ] || break; done; }
|
||||
|
||||
|
||||
##
|
||||
## poll url for performance issues
|
||||
|
||||
command -v gdate && date() { gdate "$@"; }; while true; do t=$(date +%s.%N); (time wget http://127.0.0.1:3923/?ls -qO- | jq -C '.files[]|{sz:.sz,ta:.tags.artist,tb:.tags.".bpm"}|del(.[]|select(.==null))' | awk -F\" '/"/{t[$2]++} END {for (k in t){v=t[k];p=sprintf("%" (v+1) "s",v);gsub(/ /,"#",p);printf "\033[36m%s\033[33m%s ",k,p}}') 2>&1 | awk -v ts=$t 'NR==1{t1=$0} NR==2{sub(/.*0m/,"");sub(/s$/,"");t2=$0;c=2; if(t2>0.3){c=3} if(t2>0.8){c=1} } END{sub(/[0-9]{6}$/,"",ts);printf "%s \033[3%dm%s %s\033[0m\n",ts,c,t2,t1}'; sleep 0.1 || break; done
|
||||
|
||||
|
||||
##
|
||||
## sqlite3 stuff
|
||||
|
||||
|
|
Loading…
Reference in a new issue