{"action":"created","issue":{"url":"https://api.github.com/repos/guysoft/OctoPi/issues/58","labels_url":"https://api.github.com/repos/guysoft/OctoPi/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/guysoft/OctoPi/issues/58/comments","events_url":"https://api.github.com/repos/guysoft/OctoPi/issues/58/events","html_url":"https://github.com/guysoft/OctoPi/issues/58","id":55292138,"number":58,"title":"Provide means to control camera's enablement via a lock file","user":{"login":"wolfspyre","id":1680659,"avatar_url":"https://avatars.githubusercontent.com/u/1680659?v=3","gravatar_id":"","url":"https://api.github.com/users/wolfspyre","html_url":"https://github.com/wolfspyre","followers_url":"https://api.github.com/users/wolfspyre/followers","following_url":"https://api.github.com/users/wolfspyre/following{/other_user}","gists_url":"https://api.github.com/users/wolfspyre/gists{/gist_id}","starred_url":"https://api.github.com/users/wolfspyre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolfspyre/subscriptions","organizations_url":"https://api.github.com/users/wolfspyre/orgs","repos_url":"https://api.github.com/users/wolfspyre/repos","events_url":"https://api.github.com/users/wolfspyre/events{/privacy}","received_events_url":"https://api.github.com/users/wolfspyre/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/guysoft/OctoPi/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-23T15:12:13Z","updated_at":"2015-02-06T18:04:33Z","closed_at":null,"body":"Hi there,\r\n\r\nI have a proposed means to provide a way to both improve the efficiency of the camera script, but also provide a lock file which can disable/enable the camera that I'd like to run by you\r\n\r\nif you look at scripts/webcamDaemon, in your while loop you always fire the start functions if the camera is present. \r\nif we additionally validate that the process isn't already running before running the start(Usb|Raspi) functions we could save a bunch of IO and executions. Granted, it's only once every 120s, but still.\r\n\r\nadditionally, if you wrap both of the enablement if stanza's in another if statement which checks for the existence of the file /home/pi/.octoprint/cam_enabled,\r\nyou could decide at that point if you should start, or stop the camera process. This would give you a way to control this process fairly easily with the api/gui by altering the existence, or lack thereof of /home/pi/.octopi/cam_enabled\r\n\r\nThoughts? I'm happy to do the script work and sub a PR if you like the idea."},"comment":{"url":"https://api.github.com/repos/guysoft/OctoPi/issues/comments/73283778","html_url":"https://github.com/guysoft/OctoPi/issues/58#issuecomment-73283778","issue_url":"https://api.github.com/repos/guysoft/OctoPi/issues/58","id":73283778,"user":{"login":"wolfspyre","id":1680659,"avatar_url":"https://avatars.githubusercontent.com/u/1680659?v=3","gravatar_id":"","url":"https://api.github.com/users/wolfspyre","html_url":"https://github.com/wolfspyre","followers_url":"https://api.github.com/users/wolfspyre/followers","following_url":"https://api.github.com/users/wolfspyre/following{/other_user}","gists_url":"https://api.github.com/users/wolfspyre/gists{/gist_id}","starred_url":"https://api.github.com/users/wolfspyre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wolfspyre/subscriptions","organizations_url":"https://api.github.com/users/wolfspyre/orgs","repos_url":"https://api.github.com/users/wolfspyre/repos","events_url":"https://api.github.com/users/wolfspyre/events{/privacy}","received_events_url":"https://api.github.com/users/wolfspyre/received_events","type":"User","site_admin":false},"created_at":"2015-02-06T18:04:33Z","updated_at":"2015-02-06T18:04:33Z","body":"Sorry, I was trying to explain the pseudo code.\n\nI'll write the script and explain the logic more succinctly \n\nMobileMail\n\n> On Feb 5, 2015, at 05:37, Guy Sheffer <notifications@github.com> wrote:\n> \n> There are too many ifs there, how does that help anyone? (For the record I have 0 time to write this even if it does).\n> Even this psudocode is hard to understand, maintaining such a thing is even worse.\n> \n> —\n> Reply to this email directly or view it on GitHub.\n> \n"}}