Skip to content

juggling of profiles fix numerical order ;) not issue any more #195

@MeltTechAu

Description

@MeltTechAu

juggling of profiles fix numerical order put in kilncontroller..py :)
label like this 1186 C5 Bisc Std.json

@app.get('/api/profiles')
def get_profiles():
def extract_number(filename):
import re
match = re.search(r'\d+', filename)
return int(match.group()) if match else float('inf')

profile_files = sorted(
    [f for f in os.listdir(profile_path) if os.path.isfile(os.path.join(profile_path, f))],
    key=extract_number
)
profiles = []
for filename in profile_files:
    with open(os.path.join(profile_path, filename), 'r') as f:
        profiles.append(json.load(f))
return json.dumps(profiles)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions