Skip to content

Commit 27f65e6

Browse files
committed
fs --sizeout: use existing metadata if available
1 parent 62ceef8 commit 27f65e6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

library/playback/media_printer.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,15 @@ def media_printer(args, data, units: str | None = "media", media_len=None) -> No
107107
new_data = []
108108
MOVED_COUNT = 0
109109
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):
110+
filesize = d.get("size")
111+
if not filesize:
112+
try:
113+
stat = os.stat(d["path"])
114+
filesize = stat.st_size
115+
except FileNotFoundError:
116+
continue
117+
118+
if args.timeout_size and processes.sizeout(args.timeout_size, filesize):
116119
print(f"\nReached sizeout... ({args.timeout_size})", file=sys.stderr)
117120
break
118121

0 commit comments

Comments
 (0)