mirror of
https://github.com/9001/copyparty.git
synced 2025-10-10 02:22:21 -06:00
add rename counters; closes #854
This commit is contained in:
parent
09e6f29e5e
commit
d05a88d2ee
|
@ -998,6 +998,8 @@ available functions:
|
||||||
* `$lpad(text, length, pad_char)`
|
* `$lpad(text, length, pad_char)`
|
||||||
* `$rpad(text, length, pad_char)`
|
* `$rpad(text, length, pad_char)`
|
||||||
|
|
||||||
|
two counters are available; `.n.s` is the nth file in the selection, and `.n.d` the nth file in the folder, for example rename-output `file(.n.d).(ext)` gives `file5.bin`, and `beach-$lpad((.n.s),3,0).(ext)` is `beach-017.jpg`
|
||||||
|
|
||||||
so,
|
so,
|
||||||
|
|
||||||
say you have a file named [`meganeko - Eclipse - 07 Sirius A.mp3`](https://www.youtube.com/watch?v=-dtb0vDPruI) (absolutely fantastic album btw) and the tags are: `Album:Eclipse`, `Artist:meganeko`, `Title:Sirius A`, `tn:7`
|
say you have a file named [`meganeko - Eclipse - 07 Sirius A.mp3`](https://www.youtube.com/watch?v=-dtb0vDPruI) (absolutely fantastic album btw) and the tags are: `Album:Eclipse`, `Artist:meganeko`, `Title:Sirius A`, `tn:7`
|
||||||
|
|
|
@ -15933,7 +15933,8 @@ var fileman = (function () {
|
||||||
|
|
||||||
r.rename = function (e) {
|
r.rename = function (e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
var sel = msel.getsel();
|
var sel = msel.getsel(),
|
||||||
|
all = msel.all;
|
||||||
if (!sel.length)
|
if (!sel.length)
|
||||||
return toast.err(3, L.fr_emore);
|
return toast.err(3, L.fr_emore);
|
||||||
|
|
||||||
|
@ -15957,9 +15958,11 @@ var fileman = (function () {
|
||||||
return toast.err(0, esc('bug:\n' + base + '\n' + vsp[0]));
|
return toast.err(0, esc('bug:\n' + base + '\n' + vsp[0]));
|
||||||
|
|
||||||
var vars = ft2dict(ebi(sel[a].id).closest('tr'));
|
var vars = ft2dict(ebi(sel[a].id).closest('tr'));
|
||||||
mkeys = vars[1].concat(vars[2]);
|
mkeys = [".n.d", ".n.s"].concat(vars[1], vars[2]);
|
||||||
|
|
||||||
var md = vars[0];
|
var md = vars[0];
|
||||||
|
md[".n.s"] = '' + (1 + a);
|
||||||
|
md[".n.d"] = '' + (1 + all.indexOf(sel[a]));
|
||||||
for (var k in md) {
|
for (var k in md) {
|
||||||
if (!md.hasOwnProperty(k))
|
if (!md.hasOwnProperty(k))
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue