copyparty 1.16.4__py3-none-any.whl → 1.16.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
copyparty/httpsrv.py CHANGED
@@ -168,15 +168,16 @@ class HttpSrv(object):
168
168
  env = jinja2.Environment()
169
169
  env.loader = jinja2.FunctionLoader(lambda f: load_jinja2_resource(self.E, f))
170
170
  jn = [
171
- "splash",
172
- "shares",
173
- "svcs",
174
171
  "browser",
175
172
  "browser2",
176
- "msg",
173
+ "cf",
177
174
  "md",
178
175
  "mde",
179
- "cf",
176
+ "msg",
177
+ "rups",
178
+ "shares",
179
+ "splash",
180
+ "svcs",
180
181
  ]
181
182
  self.j2 = {x: env.get_template(x + ".html") for x in jn}
182
183
  self.prism = has_resource(self.E, "web/deps/prism.js.gz")
copyparty/mtag.py CHANGED
@@ -188,7 +188,7 @@ def au_unpk(
188
188
 
189
189
  except Exception as ex:
190
190
  if ret:
191
- t = "failed to decompress audio file [%s]: %r"
191
+ t = "failed to decompress audio file %r: %r"
192
192
  log(t % (abspath, ex))
193
193
  wunlink(log, ret, vn.flags if vn else VF_CAREFUL)
194
194
 
@@ -576,7 +576,7 @@ class MTag(object):
576
576
  raise Exception()
577
577
  except Exception as ex:
578
578
  if self.args.mtag_v:
579
- self.log("mutagen-err [{}] @ [{}]".format(ex, abspath), "90")
579
+ self.log("mutagen-err [%s] @ %r" % (ex, abspath), "90")
580
580
 
581
581
  return self.get_ffprobe(abspath) if self.can_ffprobe else {}
582
582
 
@@ -693,8 +693,8 @@ class MTag(object):
693
693
  ret[tag] = zj[tag]
694
694
  except:
695
695
  if self.args.mtag_v:
696
- t = "mtag error: tagname {}, parser {}, file {} => {}"
697
- self.log(t.format(tagname, parser.bin, abspath, min_ex()))
696
+ t = "mtag error: tagname %r, parser %r, file %r => %r"
697
+ self.log(t % (tagname, parser.bin, abspath, min_ex()), 6)
698
698
 
699
699
  if ap != abspath:
700
700
  wunlink(self.log, ap, VF_CAREFUL)
copyparty/smbd.py CHANGED
@@ -260,7 +260,7 @@ class SMB(object):
260
260
  time.time(),
261
261
  "",
262
262
  ):
263
- yeet("blocked by xbu server config: " + vpath)
263
+ yeet("blocked by xbu server config: %r" % (vpath,))
264
264
 
265
265
  ret = bos.open(ap, flags, *a, mode=chmod, **ka)
266
266
  if wr:
copyparty/sutil.py CHANGED
@@ -104,7 +104,7 @@ def errdesc(
104
104
  report = ["copyparty failed to add the following files to the archive:", ""]
105
105
 
106
106
  for fn, err in errors:
107
- report.extend([" file: {}".format(fn), "error: {}".format(err), ""])
107
+ report.extend([" file: %r" % (fn,), "error: %s" % (err,), ""])
108
108
 
109
109
  btxt = "\r\n".join(report).encode("utf-8", "replace")
110
110
  btxt = vol_san(list(vfs.all_vols.values()), btxt)
copyparty/tcpsrv.py CHANGED
@@ -399,17 +399,17 @@ class TcpSrv(object):
399
399
  if not netdevs:
400
400
  continue
401
401
 
402
- added = "nothing"
403
- removed = "nothing"
402
+ add = []
403
+ rem = []
404
404
  for k, v in netdevs.items():
405
405
  if k not in self.netdevs:
406
- added = "{} = {}".format(k, v)
406
+ add.append("\n added %s = %s" % (k, v))
407
407
  for k, v in self.netdevs.items():
408
408
  if k not in netdevs:
409
- removed = "{} = {}".format(k, v)
409
+ rem.append("\nremoved %s = %s" % (k, v))
410
410
 
411
- t = "network change detected:\n added {}\033[0;33m\nremoved {}"
412
- self.log("tcpsrv", t.format(added, removed), 3)
411
+ t = "network change detected:\033[32m%s\033[33m%s"
412
+ self.log("tcpsrv", t % ("".join(add), "".join(rem)), 3)
413
413
  self.netdevs = netdevs
414
414
  self._distribute_netdevs()
415
415
 
copyparty/tftpd.py CHANGED
@@ -354,7 +354,7 @@ class Tftpd(object):
354
354
  time.time(),
355
355
  "",
356
356
  ):
357
- yeet("blocked by xbu server config: " + vpath)
357
+ yeet("blocked by xbu server config: %r" % (vpath,))
358
358
 
359
359
  if not self.args.tftp_nols and bos.path.isdir(ap):
360
360
  return self._ls(vpath, "", 0, True)
copyparty/th_cli.py CHANGED
@@ -106,13 +106,13 @@ class ThumbCli(object):
106
106
  fmt = sfmt
107
107
 
108
108
  elif fmt[:1] == "p" and not is_au and not is_vid:
109
- t = "cannot thumbnail [%s]: png only allowed for waveforms"
110
- self.log(t % (rem), 6)
109
+ t = "cannot thumbnail %r: png only allowed for waveforms"
110
+ self.log(t % (rem,), 6)
111
111
  return None
112
112
 
113
113
  histpath = self.asrv.vfs.histtab.get(ptop)
114
114
  if not histpath:
115
- self.log("no histpath for [{}]".format(ptop))
115
+ self.log("no histpath for %r" % (ptop,))
116
116
  return None
117
117
 
118
118
  tpath = thumb_path(histpath, rem, mtime, fmt, self.fmt_ffa)
copyparty/th_srv.py CHANGED
@@ -236,7 +236,7 @@ class ThumbSrv(object):
236
236
  def get(self, ptop , rem , mtime , fmt ) :
237
237
  histpath = self.asrv.vfs.histtab.get(ptop)
238
238
  if not histpath:
239
- self.log("no histpath for [{}]".format(ptop))
239
+ self.log("no histpath for %r" % (ptop,))
240
240
  return None
241
241
 
242
242
  tpath = thumb_path(histpath, rem, mtime, fmt, self.fmt_ffa)
@@ -246,7 +246,7 @@ class ThumbSrv(object):
246
246
  with self.mutex:
247
247
  try:
248
248
  self.busy[tpath].append(cond)
249
- self.log("joined waiting room for %s" % (tpath,))
249
+ self.log("joined waiting room for %r" % (tpath,))
250
250
  except:
251
251
  thdir = os.path.dirname(tpath)
252
252
  bos.makedirs(os.path.join(thdir, "w"))
@@ -263,11 +263,11 @@ class ThumbSrv(object):
263
263
  allvols = list(self.asrv.vfs.all_vols.values())
264
264
  vn = next((x for x in allvols if x.realpath == ptop), None)
265
265
  if not vn:
266
- self.log("ptop [{}] not in {}".format(ptop, allvols), 3)
266
+ self.log("ptop %r not in %s" % (ptop, allvols), 3)
267
267
  vn = self.asrv.vfs.all_aps[0][1]
268
268
 
269
269
  self.q.put((abspath, tpath, fmt, vn))
270
- self.log("conv {} :{} \033[0m{}".format(tpath, fmt, abspath), c=6)
270
+ self.log("conv %r :%s \033[0m%r" % (tpath, fmt, abspath), 6)
271
271
 
272
272
  while not self.stopping:
273
273
  with self.mutex:
@@ -372,8 +372,8 @@ class ThumbSrv(object):
372
372
  fun(ap_unpk, ttpath, fmt, vn)
373
373
  break
374
374
  except Exception as ex:
375
- msg = "{} could not create thumbnail of {}\n{}"
376
- msg = msg.format(fun.__name__, abspath, min_ex())
375
+ msg = "%s could not create thumbnail of %r\n%s"
376
+ msg = msg % (fun.__name__, abspath, min_ex())
377
377
  c = 1 if "<Signals.SIG" in msg else "90"
378
378
  self.log(msg, c)
379
379
  if getattr(ex, "returncode", 0) != 321:
copyparty/u2idx.py CHANGED
@@ -130,7 +130,7 @@ class U2idx(object):
130
130
  ptop = vn.realpath
131
131
  histpath = self.asrv.vfs.histtab.get(ptop)
132
132
  if not histpath:
133
- self.log("no histpath for [{}]".format(ptop))
133
+ self.log("no histpath for %r" % (ptop,))
134
134
  return None
135
135
 
136
136
  db_path = os.path.join(histpath, "up2k.db")
@@ -145,7 +145,7 @@ class U2idx(object):
145
145
  db = sqlite3.connect(uri, timeout=2, uri=True, check_same_thread=False)
146
146
  cur = db.cursor()
147
147
  cur.execute('pragma table_info("up")').fetchone()
148
- self.log("ro: {}".format(db_path))
148
+ self.log("ro: %r" % (db_path,))
149
149
  except:
150
150
  self.log("could not open read-only: {}\n{}".format(uri, min_ex()))
151
151
  # may not fail until the pragma so unset it
@@ -155,7 +155,7 @@ class U2idx(object):
155
155
  # on windows, this steals the write-lock from up2k.deferred_init --
156
156
  # seen on win 10.0.17763.2686, py 3.10.4, sqlite 3.37.2
157
157
  cur = sqlite3.connect(db_path, timeout=2, check_same_thread=False).cursor()
158
- self.log("opened {}".format(db_path))
158
+ self.log("opened %r" % (db_path,))
159
159
 
160
160
  self.cur[ptop] = cur
161
161
  return cur