File size: 1,165 Bytes
50d6ddc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
import shutil
import shortuuid


def clear_all():
    """
    Removes the 'output/' directory along with its content.
    
    Returns:
        None
    """
    shutil.rmtree('output/', ignore_errors=True)

def clear_value_tab(path):
    """
    Removes a specific sub-directory under 'output/'.
    
    Parameters:
        path (str): Sub-directory to remove.
    
    Returns:
        None
    """
    print(path)
    shutil.rmtree(os.path.join('output/', path), ignore_errors=True)

def get_all_file_paths(directory):
    """
    Collects all image file paths under a given directory.
    
    Parameters:
        directory (str): Directory to search for image files.
    
    Returns: 
        list: List of image file paths.
    """
    allowed_extensions = ('.png', '.jpg', '.jpeg', '.gif', '.bmp')
    return [
        os.path.join(root, file)
        for root, _, files in os.walk(directory)
        for file in files
        if file.lower().endswith(allowed_extensions)
    ]

def generate_uuid():
    """
    Generates a short unique identifier.
    
    Returns:
        str: Unique identifier string.
    """
    return str(shortuuid.uuid())