Motion-Project / motion

Motion, a software motion detector. Home page: https://motion-project.github.io/
GNU General Public License v2.0
3.64k stars 547 forks source link

View recorded files via web interface / api #720

Closed ninze closed 4 years ago

ninze commented 6 years ago

Hi,

Are there any active projects allowing to preview files recorded by motion in the web browser? Full featured GUI like motioneye or their operating system seems like an overkill for my use case. I like the command line approach to motion, but I can't find any easy ways to view the results in the browser.

Another question is about rest api. In one of the issues I've read that there were plans to do rest api (I assumed json, not sure if this was correct) for easier integration with third party apps. Is the api already available, or planned for the future, or more like abandoned :) ?

thanks Karolis

Mr-Dave commented 6 years ago

I do not know of any current activity to build functionality to view recordings in the browser. I have thought about it but wanted to keep the interface "simple". If someone determines that it is only a few hundred lines of code, then sure, it could go in. If it is a few thousand lines of code to make it happen, then probably not. I don't envision that the interface will get to the point of MotionEye. The latest change to the web interface was really driven off of the need to simplify the code base and make it maintainable.

With respect to the rest api, I will say that I would need to see a prototype of what others are contemplating as a RESTfull api. I'm not programmer (all evidence to the contrary) and don't have any applications that wrap Motion so from my vantage point it seems that the text variation of the web interface (webcontrol_interface 1) is pretty restful. (From what I read on being restful). Perhaps those with a degree in CS can propose a interface that passes the restful laws and illustrate by example how the text interface doesn't pass.

ninze commented 6 years ago

I think the most flexible approach would be to separate the ui from the daemon and create an easy to use api for other programmers to use. This way other developers could create their own interfaces to motion and maintain them as separate projects. Motioneye is big and heavy and honestly quite slow on my device and seems like an overkill in general, while the original motion web interface lacks some important features to make it an "install and forget" kind of tool.

Is there any documentation about webcontrol_interface or do I just need to click around and see how it works?

I might be willing to work on a javascript UI for motion as long as I have enough data to create a functional interface. For example, if I could query the API and ask to "give me a list of movies that were recorded between this and this timestamp".

Mr-Dave commented 6 years ago

There was never any documentation put together on the text variant of the web interface that lists commands and syntax other than it follows the methods/syntax of the regular html interface. This is something that could be enhanced now that there is just a single web page served up and users can not see the URI in the address bar. In the interim, you can revert to an earlier version of Motion and see the URI called in the address bar or view the source HTML/Javascript when using code from the master branch. (webcontrol_interface 0 and then view page source)

With respect to your last paragraph, I'd say determine what you need and possibly take a look at the webu.c module. It is basically self contained and should be much easier to follow than the previous code.

As stated in the news I'm generally not going to be able to work on much for another few months.

Mr-Dave commented 6 years ago

Re-opening. Issue was inadvertently closed by the merge of libmicrohttp.

For this issue, I believe it can now be accomplished much easier via libmicrohttp. (Sample code already exists on how to download a file to a user). At this time, I'd anticipate a dropdown of files on the html interface and the option to send back a list when using the text(programmatic) interface. (Very similar to how the configuration parameters work in both)

(If there is interest in this from the community, indicate with a thumbs up emoji on this comment.)

dave-code-ruiz commented 6 years ago

If you use Home Assistant you can use my Hass-Gallery in https://github.com/dave-code-ruiz/hass-gallery

Not is great develop code but work fine

francisuk1989 commented 5 years ago

if is just the recordings you wonted then you could just install something like lighttpd or any other webserver and then point to say /home/xxx/cameras and then inside the cameras folder make cam1 cam2 so then you should access it via http://192.168.1.250 and have folders for cam1, cam2 with the recordings of your choice, was just an idea :+1:

spidgorny commented 4 years ago

If you use Apache for this, you can enable Options +Indexes so that Apache generates a list of files from the directory.