diff --git a/README.md b/README.md index 95df0ba..45394f0 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,9 @@ Alternatively, the host and port on which to bind can be defined via the configu Configuration ------------- -The config-file for Printer WebUI is expected at `~/.printerwebui/config.ini` for Linux, at `%APPDATA%/PrinterWebUI/config.ini` -for Windows and at `~/Library/Application Support/config.ini` for MacOS X. +The config-file `config.ini` for Printer WebUI is expected at `~/.printerwebui` for Linux, at `%APPDATA%/PrinterWebUI` +for Windows and at `~/Library/Application Support` for MacOS X. + The following example config should explain the available options: [serial] @@ -64,16 +65,23 @@ The following example config should explain the available options: port = 5000 [webcam] - # use this option to enable display of a webcam stream in the UI, e.g. via MJPG-Streamer - stream = http://10.0.0.2:8080/?action=stream - # use this option to enable timelapse support via snapshot, e.g. via MJPG-Streamer - snapshot = http://10.0.0.1:8080/?action=snapshot + # use this option to enable display of a webcam stream in the UI, e.g. via MJPG-Streamer. + # Webcam support will be disabled if not set + stream = http://:/?action=stream + # use this option to enable timelapse support via snapshot, e.g. via MJPG-Streamer. + # Timelapse support will be disabled if not set + snapshot = http://:/?action=snapshot + # path to ffmpeg binary to use for creating timelapse recordings. + # Timelapse support will be disabled if not set + ffmpeg = /path/to/ffmpeg [folder] # absolute path where to store gcode uploads. Defaults to the uploads folder in the Printer WebUI settings dir uploads = /path/to/upload/folder - # absolute path where to store gcode uploads. Defaults to the timelapse folder in the Printer WebUI settings dir + # absolute path where to store finished timelapse recordings. Defaults to the timelapse folder in the Printer WebUI settings dir timelapse = /path/to/timelapse/folder + # absolute path where to store temporary timelapse files. Defaults to the timelapse/tmp folder in the Printer WebUI settings dir + timelapse_tmp = /path/timelapse/tmp/folder Setup on a Raspberry Pi running Raspbian ---------------------------------------- @@ -95,7 +103,7 @@ You should then be able to start the WebUI server: If you also want webcam support, you'll need to download and compile MJPG-Streamer: cd ~ - sudo apt-get install libjpeg8-dev imagemagick + sudo apt-get install libjpeg8-dev imagemagick ffmpeg wget -Omjpg-streamer.tar.gz http://mjpg-streamer.svn.sourceforge.net/viewvc/mjpg-streamer/mjpg-streamer/?view=tar tar xfz mjpg-streamer.tar.gz cd mjpg-streamer @@ -120,6 +128,8 @@ Open `~/.printerwebui/config.ini` and add the following lines to it: [webcam] stream = http://:8080/?action=stream + snapshot = http://127.0.0.1:8080/?action=snapshot + ffmpeg = /usr/bin/ffmpeg Restart the WebUI server and reload its frontend. You should now see a Webcam tab with content. diff --git a/printer_webui/server.py b/printer_webui/server.py index a163b77..6e68b34 100644 --- a/printer_webui/server.py +++ b/printer_webui/server.py @@ -12,8 +12,8 @@ import timelapse import os import fnmatch -BASEURL="/ajax/" -SUCCESS={} +BASEURL = "/ajax/" +SUCCESS = {} UPLOAD_FOLDER = settings().getBaseFolder("uploads") @@ -22,7 +22,11 @@ printer = Printer() @app.route("/") def index(): - return render_template("index.html", webcamStream = settings().get("webcam", "stream")) + return render_template( + "index.html", + webcamStream=settings().get("webcam", "stream"), + enableTimelapse=(settings().get("webcam", "snapshot") is not None and settings().get("webcam", "ffmpeg") is not None) + ) #~~ Printer state diff --git a/printer_webui/static/css/ui.css b/printer_webui/static/css/ui.css index bfa7c2c..5434690 100644 --- a/printer_webui/static/css/ui.css +++ b/printer_webui/static/css/ui.css @@ -61,7 +61,7 @@ table th.gcode_files_action, table td.gcode_files_action { overflow: hidden; } -#temp_newTemp, #temp_newBedTemp, #speed_innerWall, #speed_outerWall, #speed_fill, #speed_support { +#temp_newTemp, #temp_newBedTemp, #speed_innerWall, #speed_outerWall, #speed_fill, #speed_support, #webcam_timelapse_interval { text-align: right; } @@ -107,12 +107,6 @@ table th.gcode_files_action, table td.gcode_files_action { margin: auto; } -#webcam_container { - height: 440px; - background-color: #000000; - margin-bottom: 20px; -} - table th.timelapse_files_name, table td.timelapse_files_name { text-overflow: ellipsis; text-align: left; diff --git a/printer_webui/templates/index.html b/printer_webui/templates/index.html index 1d75774..f4d62fc 100644 --- a/printer_webui/templates/index.html +++ b/printer_webui/templates/index.html @@ -218,6 +218,7 @@ + {% if enableTimelapse %}

Timelapse Configuration

@@ -229,7 +230,10 @@
- +
+ + sec +
@@ -254,6 +258,7 @@ + {% endif %}
{% endif %}