mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-04 06:44:06 +02:00
Update addition_processed.py
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
# Code to modify the birdnet_analysis.py and restore the Processed folder
|
import os
|
||||||
# The last 15 wav files are stored in a dynamic manner in the Processed folder
|
|
||||||
|
|
||||||
def read_file(file_path):
|
def read_file(file_path):
|
||||||
with open(file_path, 'r') as file:
|
with open(file_path, 'r') as file:
|
||||||
@@ -50,17 +49,16 @@ def process_code(lines):
|
|||||||
|
|
||||||
return processed_lines
|
return processed_lines
|
||||||
|
|
||||||
# Paths to the original and new code files
|
# Hardcoded path to the birdnet_analysis.py file
|
||||||
original_code_path = 'original_code.py'
|
file_path = os.path.expanduser('~/BirdNET-Pi/scripts/birdnet_analysis.py')
|
||||||
new_code_path = 'modified_code.py'
|
|
||||||
|
|
||||||
# Read the original code
|
# Read the original code
|
||||||
original_lines = read_file(original_code_path)
|
original_lines = read_file(file_path)
|
||||||
|
|
||||||
# Process the code
|
# Process the code
|
||||||
modified_lines = process_code(original_lines)
|
modified_lines = process_code(original_lines)
|
||||||
|
|
||||||
# Write the modified code to a new file
|
# Write the modified code back to the same file
|
||||||
write_file(new_code_path, modified_lines)
|
write_file(file_path, modified_lines)
|
||||||
|
|
||||||
print(f"The code has been modified and saved to {new_code_path}")
|
print(f"The code has been modified and saved to {file_path}")
|
||||||
|
|||||||
Reference in New Issue
Block a user