Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer process jsonl files #16

Closed
Asbjoern opened this issue Mar 29, 2023 · 6 comments
Closed

No longer process jsonl files #16

Asbjoern opened this issue Mar 29, 2023 · 6 comments
Labels
question Further information is requested

Comments

@Asbjoern
Copy link

Asbjoern commented Mar 29, 2023

Describe the bug
Changes to, or new jsonl files are no longer processed and moved to the output directory for upload.
Changes to cmd files works as expected

Problem persists in v0.3.0 and v0.2.0.
Everything works in v0.1.0

To Reproduce
Steps to reproduce the behavior:

Make changes to an existing jsonl file or create a new one.
Run generate or deploy
Observe that the changes has not made its way to the output directory or devices.

Expected behavior
I expected the changes to be uploaded to the devices.

  • OS: [e.g. Linux]
    Ubuntu server Python version 3.10.6
@markusressel
Copy link
Owner

Hey @Asbjoern, thx for the report! 🤓

I have tried to reproduce your issue, but it is working as expected on my end.
Starting out with an empty output directory, all relevant jsonl files are present after deploying.
Also, modifying a jsonl file leads to changes in the output directory, and also on the plate.

This is the console output when using the --diff option:

+++ $common_page_md_content.jsonl

@@ -2,6 +2,6 @@

 {"page": 2, "id": 22, "obj": "btn", "x": 125, "y": 43, "h": 64, "w": 96, "text": "\ue3e4/\ue40a", "text_font": 32, "bg_grad_dir": "0", "bg_color": "#558B2F", "bg_color02": "#33691E", "border_color": "#FF0000", "border_width": 0, "radius": 20}
 {"page": 2, "id": 23, "obj": "btn", "x": 226, "y": 43, "h": 64, "w": 96, "text": "\ue4ad", "text_font": 32, "bg_grad_dir": "0", "bg_color": "#558B2F", "bg_color02": "#33691E", "border_color": "#FF0000", "border_width": 0, "radius": 20}
 {"page": 2, "id": 24, "obj": "btn", "x": 24, "y": 112, "h": 64, "w": 96, "text": "\ue75f/\ue57e", "text_font": 32, "bg_grad_dir": "0", "bg_color": "#558B2F", "bg_color02": "#33691E", "border_color": "#FF0000", "border_width": 0, "radius": 20}
-{"page": 2, "id": 30, "obj": "slider", "x": 20, "y": 235, "h": 30, "w": 440, "min": 10, "max": 60, "val": 10, "bg_grad_dir": "0", "bg_color": "#313131", "bg_color10": "#558B2F", "bg_color20": "#FFFFFF", "radius": 20, "radius10": 20, "radius20": 20, "border_color": "#FF0000", "border_width": 0}
+{"page": 2, "id": 30, "obj": "slider", "x": 20, "y": 235, "h": 30, "w": 440, "min": 10, "max": 50, "val": 10, "bg_grad_dir": "0", "bg_color": "#313131", "bg_color10": "#558B2F", "bg_color20": "#FFFFFF", "radius": 20, "radius10": 20, "radius20": 20, "border_color": "#FF0000", "border_width": 0}
 {"page": 2, "id": 40, "obj": "btn", "x": 374, "y": 43, "h": 64, "w": 96, "text": "GronkhTV", "bg_grad_dir": "0", "bg_color": "#558B2F", "bg_color02": "#33691E", "border_color": "#FF0000", "border_width": 0, "radius": 20}
 {"page": 2, "id": 41, "obj": "btn", "x": 374, "y": 112, "h": 64, "w": 96, "text": "Movie", "bg_grad_dir": "0", "bg_color": "#558B2F", "bg_color02": "#33691E", "border_color": "#FF0000", "border_width": 0, "radius": 20}

Is the jsonl file you want to add or modify referenced in a cmd file?
If so, how is it referenced?
If not, the file will not be processed, see #15

@markusressel markusressel added the question Further information is requested label Mar 29, 2023
@Asbjoern
Copy link
Author

One some devices with only one file is is only referenced in the config.json:

"hasp": {
        "pages": "/pages.jsonl"
    }

but the problems persists with files referenced in boot.cmd:
run /test.jsonl

I have attached a test configuration direcotry that produces no output jsonl files on my end and no error messages.
openhasp-configs-test.zip

openhasp-config-manager generate -c openhasp-configs-test/
 INFO  Analyzing files in 'openhasp-configs-test'...
 INFO  Found devices: test_plate
 INFO  Generating output for 'test_plate'...
  OK   Done!

But the output directory has no jsonl files:

ls output/test_plate/
boot.cmd  offline.cmd  online.cmd

@markusressel
Copy link
Owner

Thx for providing the example 🚀

I can already say though that I definitely forgot about the pages parameter in the config.json, makes sense that this is not considered correctly. I will create a bugfix PR for this.

As for the command reference, openhasp-config-manager assumes that files are referenced using absolute paths, starting with L:/. If you change the line:

run /test.jsonl

to

run L:/test.jsonl

it will work.

I am not sure about supporting other forms, because I do not know how they work. The L:/ is a pretty reliable indicator for a regex to find file references. Is it possible to use relative paths in cmd files? I think its not even possible to create folders on the plate, thats one of the reasons I created openhasp-config-manager in the first place.

markusressel added a commit that referenced this issue Mar 30, 2023
…es_processed

Bugfix/#16 not all jsonl files processed
@markusressel
Copy link
Owner

markusressel commented Mar 30, 2023

Just as a heads up: The config zip you uploaded references pages.jsonl in the config, but there is no such file. I think you wanted to reference the test.jsonl. openhasp-config-manager will print out a warning now if the referenced file is not found. It will also take this file into account when generating output.

Please give 0.3.1 a try 🚀

@Asbjoern
Copy link
Author

Thank you very much!
Adding L: solved the file parsing. Even though the relative path works fine standalone.
Your update also worked for the pages.jsonl reference. That however requires a relative path without L:

Now on the I get parsing errors. It does not accept urls as img src. But that seems like a different issue and I will open another issue.

@markusressel
Copy link
Owner

Your update also worked for the pages.jsonl reference. That however requires a relative path

Yes, for that one it is easy, because it is a single config option that I know beforehand contains a path. Supporting different variants for that is not as hard as for the generic CMD files. It's also possible for them, but it requires a bit more logic and I haven't yet decided how I want to tackle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants