more macos
This commit is contained in:
1 parent
57afff3cf0
commit
ac29fda481
4 files changed
+15
-17
No files matched your search
+5
-3
@@ -3,13 +3,15 @@
|
||||
set -ue
|
||||
|
||||
maple="$HOME/maple"
|
||||
data="$HOME/maple/data"
|
||||
metadata="$data/_metadata"
|
||||
|
||||
collection="$HOME/data/collection"
|
||||
metadata="$collection/_metadata"
|
||||
|
||||
etc="$maple/etc"
|
||||
sldl_conf="$etc/sldl-macos.conf"
|
||||
|
||||
directories() {
|
||||
mkdir -p $data
|
||||
mkdir -p $collection
|
||||
mkdir -p $metadata
|
||||
mkdir -p $etc
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
path = "~/maple/data"
|
||||
path = "~/maple/data/collection"
|
||||
index-path = "~/maple/data/_metadata/index.sldl.csv"
|
||||
username = "ntwl"
|
||||
password = "ninety nonsense nights"
|
||||
|
||||
@@ -26,7 +26,7 @@ dl trg:
|
||||
--remove-orphans \
|
||||
|
||||
link plist dir:
|
||||
python3 maple-py/link.py plist dir
|
||||
python3 maple-py/link.py {{plist}} {{dir}}
|
||||
|
||||
sync args:
|
||||
s5cmd {{args}}
|
||||
|
||||
+8
-12
@@ -3,20 +3,10 @@ import os, sys, pathlib
|
||||
|
||||
m3u8 = pathlib.Path(sys.argv[1]).resolve()
|
||||
outdir = pathlib.Path(sys.argv[2]).resolve()
|
||||
print(outdir)
|
||||
outdir.mkdir(parents=True, exist_ok=True)
|
||||
pl_dir = m3u8.parent
|
||||
|
||||
def next_free(p: pathlib.Path) -> pathlib.Path:
|
||||
if not p.exists():
|
||||
return p
|
||||
stem, suf = p.stem, p.suffix
|
||||
i = 1
|
||||
while True:
|
||||
cand = p.with_name(f"{stem}-{i}{suf}")
|
||||
if not cand.exists():
|
||||
return cand
|
||||
i += 1
|
||||
|
||||
with m3u8.open("r", encoding="utf-8") as f:
|
||||
for line in f:
|
||||
s = line.strip()
|
||||
@@ -32,8 +22,14 @@ with m3u8.open("r", encoding="utf-8") as f:
|
||||
print(f"skip (missing): {src}", file=sys.stderr)
|
||||
continue
|
||||
|
||||
dest = next_free(outdir / src.name)
|
||||
dest = outdir / src.name
|
||||
|
||||
if dest.exists():
|
||||
print(f"skip (exists): {dest}", file=sys.stderr)
|
||||
continue
|
||||
|
||||
try:
|
||||
print(f"{src} -> {dest}")
|
||||
dest.symlink_to(src)
|
||||
except OSError:
|
||||
# fallback to hardlink if symlink not permitted
|
||||
|
||||
Reference in new issue
Block a user