mirror of
https://github.com/master-of-zen/Av1an.git
synced 2024-11-25 02:29:40 +00:00
Move file validation
This commit is contained in:
parent
b9193124ba
commit
5eb7039c94
1 changed files with 23 additions and 0 deletions
23
Startup/file_validation.py
Normal file
23
Startup/file_validation.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/env python
|
||||
import numpy as np
|
||||
|
||||
|
||||
def process_inputs(inputs):
|
||||
# Check input file for being valid
|
||||
if not inputs:
|
||||
print('No input file')
|
||||
exit()
|
||||
|
||||
if inputs[0].is_dir():
|
||||
inputs = [x for x in inputs[0].iterdir() if x.suffix in (".mkv", ".mp4", ".mov", ".avi", ".flv", ".m2ts")]
|
||||
|
||||
valid = np.array([i.exists() for i in inputs])
|
||||
|
||||
if not all(valid):
|
||||
print(f'File(s) do not exist: {", ".join([str(inputs[i]) for i in np.where(not valid)[0]])}')
|
||||
exit()
|
||||
|
||||
return inputs
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue