Skip to content

Commit 62ceef8

Browse files
committed
fs: add sizeout to -pf
1 parent 70d4797 commit 62ceef8

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

library/folders/filter_src.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import os
1+
import os, sys
22
from fnmatch import fnmatch
33
from pathlib import Path
44

@@ -28,10 +28,10 @@ def filter_src(args, path):
2828
return False
2929

3030
if args.timeout_size and processes.sizeout(args.timeout_size, stat.st_size):
31-
print(f"\nReached sizeout... ({args.timeout_size})")
31+
print(f"\nReached sizeout... ({args.timeout_size})", file=sys.stderr)
3232
raise SystemExit(124)
3333
elif args.move_limit and args.move_limit <= MOVED_COUNT:
34-
print(f"\nReached file move limit... ({args.move_limit})")
34+
print(f"\nReached file move limit... ({args.move_limit})", file=sys.stderr)
3535
raise SystemExit(124)
3636

3737
return True

library/playback/media_printer.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,26 @@ def media_printer(args, data, units: str | None = "media", media_len=None) -> No
103103
cols = getattr(args, "cols", [])
104104
m_columns = db_utils.columns(args, "media")
105105

106-
media = deepcopy(list(data))
106+
if "path" in data[0].keys():
107+
new_data = []
108+
MOVED_COUNT = 0
109+
for d in data:
110+
try:
111+
stat = os.stat(d["path"])
112+
except FileNotFoundError:
113+
continue
114+
115+
if args.timeout_size and processes.sizeout(args.timeout_size, stat.st_size):
116+
print(f"\nReached sizeout... ({args.timeout_size})", file=sys.stderr)
117+
break
118+
119+
new_data.append(d)
120+
MOVED_COUNT += 1
121+
data = new_data
122+
else:
123+
data = list(data)
124+
125+
media = deepcopy(data)
107126

108127
if args.verbose >= consts.LOG_DEBUG and cols and "*" in cols:
109128
breakpoint()

0 commit comments

Comments
 (0)