Skip to content

Commit

Permalink
Revert "encapp: add os walk and regexp search to video file path"
Browse files Browse the repository at this point in the history
This reverts commit 69713a7.
  • Loading branch information
JohanBlome authored Oct 15, 2024
1 parent 69713a7 commit b41c202
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions scripts/encapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,13 @@
".raw",
".yuv",
".ivf",
".mkv",
]


def isVideoExtension(filename):
ending = f".{filename.rsplit('.')[-1]}"
if ending is not None and ending in video_extensions:
return True

return False


Expand Down Expand Up @@ -816,27 +814,20 @@ def createTestsFromDefinitionExpansion(testsuite):


def expand_filepath(path):
# Check if path is a folder
basename = ""
folder = ""
path = os.path.expanduser(path)
if os.path.isdir(path):
folder = path
else:
basename = os.path.basename(path)
folder = os.path.dirname(path)
# Allow regexp on filenam
basename = os.path.basename(path)
folder = os.path.dirname(path)
folder = os.path.expanduser(folder)
video_files = []
for root, _dirs, files in os.walk(folder):
for file in files:
if isVideoExtension(file):
if len(basename) > 0:
m = re.search(basename, file)
if m:
file = f"{root}/{m.group(0)}"
file = f"{folder}/{m.group(0)}"
else:
continue
else:
file = f"{root}/{file}"
video_files.append(file)

return video_files
Expand Down

0 comments on commit b41c202

Please sign in to comment.