[ipcamera] GIF recording bug fix, compatibility fix for http headers (#8654)

+ Bug fix: Recording to GIF would only record for 5 seconds.

+ Clean up readme to remove channels and configs that don't exist after
moving to actions.

+ Compatibility fix for http headers.

Signed-off-by: Matthew Skinner <matt@pcmus.com>
This commit is contained in:
Matthew Skinner
2020-10-05 03:01:25 +11:00
committed by GitHub
parent 112f46c95e
commit e1cde78557
3 changed files with 9 additions and 27 deletions

View File

@@ -552,8 +552,8 @@ public class IpCameraHandler extends BaseThingHandler {
FullHttpRequest request;
if (!"PUT".equals(httpMethod) || (useDigestAuth && digestString == null)) {
request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, new HttpMethod(httpMethod), httpRequestURL);
request.headers().set(HttpHeaderNames.HOST, cameraConfig.getIp());
request.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
request.headers().set("Host", cameraConfig.getIp() + ":" + port);
request.headers().set("Connection", HttpHeaderValues.KEEP_ALIVE);
} else {
request = putRequestWithBody;
}
@@ -563,13 +563,13 @@ public class IpCameraHandler extends BaseThingHandler {
logger.warn("Camera at IP:{} had both Basic and Digest set to be used", cameraConfig.getIp());
setBasicAuth(false);
} else {
request.headers().set(HttpHeaderNames.AUTHORIZATION, "Basic " + basicAuth);
request.headers().set("Authorization", "Basic " + basicAuth);
}
}
if (useDigestAuth) {
if (digestString != null) {
request.headers().set(HttpHeaderNames.AUTHORIZATION, "Digest " + digestString);
request.headers().set("Authorization", "Digest " + digestString);
}
}
@@ -1116,6 +1116,7 @@ public class IpCameraHandler extends BaseThingHandler {
public void recordGif(String filename, int seconds) {
gifFilename = filename;
gifRecordTime = seconds;
if (cameraConfig.getGifPreroll() > 0) {
snapCount = seconds;
} else {

View File

@@ -112,7 +112,6 @@
<channel id="gifHistory" typeId="gifHistory"/>
<channel id="gifHistoryLength" typeId="gifHistoryLength"/>
<channel id="recordingMp4" typeId="recordingMp4"/>
<channel id="mp4Preroll" typeId="mp4Preroll"/>
<channel id="mp4History" typeId="mp4History"/>
<channel id="mp4HistoryLength" typeId="mp4HistoryLength"/>
<channel id="lastMotionType" typeId="lastMotionType"/>
@@ -335,7 +334,6 @@
<channel id="gifHistory" typeId="gifHistory"/>
<channel id="gifHistoryLength" typeId="gifHistoryLength"/>
<channel id="recordingMp4" typeId="recordingMp4"/>
<channel id="mp4Preroll" typeId="mp4Preroll"/>
<channel id="mp4History" typeId="mp4History"/>
<channel id="mp4HistoryLength" typeId="mp4HistoryLength"/>
<channel id="lastMotionType" typeId="lastMotionType"/>
@@ -605,7 +603,6 @@
<channel id="gifHistory" typeId="gifHistory"/>
<channel id="gifHistoryLength" typeId="gifHistoryLength"/>
<channel id="recordingMp4" typeId="recordingMp4"/>
<channel id="mp4Preroll" typeId="mp4Preroll"/>
<channel id="mp4History" typeId="mp4History"/>
<channel id="mp4HistoryLength" typeId="mp4HistoryLength"/>
<channel id="lastMotionType" typeId="lastMotionType"/>
@@ -877,7 +874,6 @@
<channel id="gifHistory" typeId="gifHistory"/>
<channel id="gifHistoryLength" typeId="gifHistoryLength"/>
<channel id="recordingMp4" typeId="recordingMp4"/>
<channel id="mp4Preroll" typeId="mp4Preroll"/>
<channel id="mp4History" typeId="mp4History"/>
<channel id="mp4HistoryLength" typeId="mp4HistoryLength"/>
<channel id="lastMotionType" typeId="lastMotionType"/>
@@ -1161,7 +1157,6 @@
<channel id="gifHistory" typeId="gifHistory"/>
<channel id="gifHistoryLength" typeId="gifHistoryLength"/>
<channel id="recordingMp4" typeId="recordingMp4"/>
<channel id="mp4Preroll" typeId="mp4Preroll"/>
<channel id="mp4History" typeId="mp4History"/>
<channel id="mp4HistoryLength" typeId="mp4HistoryLength"/>
<channel id="lastMotionType" typeId="lastMotionType"/>
@@ -1418,7 +1413,6 @@
<channel id="gifHistory" typeId="gifHistory"/>
<channel id="gifHistoryLength" typeId="gifHistoryLength"/>
<channel id="recordingMp4" typeId="recordingMp4"/>
<channel id="mp4Preroll" typeId="mp4Preroll"/>
<channel id="mp4History" typeId="mp4History"/>
<channel id="mp4HistoryLength" typeId="mp4HistoryLength"/>
<channel id="lastMotionType" typeId="lastMotionType"/>
@@ -1695,7 +1689,6 @@
<channel id="gifHistory" typeId="gifHistory"/>
<channel id="gifHistoryLength" typeId="gifHistoryLength"/>
<channel id="recordingMp4" typeId="recordingMp4"/>
<channel id="mp4Preroll" typeId="mp4Preroll"/>
<channel id="mp4History" typeId="mp4History"/>
<channel id="mp4HistoryLength" typeId="mp4HistoryLength"/>
<channel id="lastMotionType" typeId="lastMotionType"/>
@@ -1978,7 +1971,6 @@
<channel id="gifHistory" typeId="gifHistory"/>
<channel id="gifHistoryLength" typeId="gifHistoryLength"/>
<channel id="recordingMp4" typeId="recordingMp4"/>
<channel id="mp4Preroll" typeId="mp4Preroll"/>
<channel id="mp4History" typeId="mp4History"/>
<channel id="mp4HistoryLength" typeId="mp4HistoryLength"/>
<channel id="lastMotionType" typeId="lastMotionType"/>
@@ -2291,14 +2283,6 @@
<description>How many mp4 recordings are stored in the history.</description>
</channel-type>
<channel-type id="mp4Preroll">
<item-type>Number</item-type>
<label>MP4 preroll</label>
<description>Set this channel to a number of how many seconds you wish to record for using the HLS files as a source.</description>
<category>Time</category>
<state min="0" max="10" step="1" pattern="%.1f Seconds" readOnly="false"/>
</channel-type>
<channel-type id="imageUrl">
<item-type>String</item-type>
<label>Image URL</label>