-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess_file.py
32 lines (24 loc) · 1.03 KB
/
process_file.py
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
import os
from file_processor import FileProcessor
def main():
# Get the file path from the environment variable
new_file_env = os.getenv('NEW_FILE')
if not new_file_env:
print("No file path provided in the environment variable 'NEW_FILE'. Exiting.")
return
# Split the environment variable if it is a tuple-like string
new_file_parts = new_file_env.split(',')
if len(new_file_parts) != 2:
print(f"Invalid NEW_FILE format: {new_file_env}. Expected format: '<file_path>,<file_type>'. Exiting.")
return
file_path = new_file_parts[0].strip()
file_type = new_file_parts[1].strip()
print(f"Starting processing for file {file_path} of type {file_type}")
# Create a tuple with the file path and file type
file_info = (file_path, file_type)
# Create an instance of FileProcessor with the file info
processor = FileProcessor(file_info)
# Call the method to start processing the file
processor.process_image()
if __name__ == "__main__":
main()