Merge branch 'dev' into 'generic-face-manager'

# Conflicts:
#   plugins/deepstack-face/shinobi-deepstack-face.js
#   plugins/deepstack-object/shinobi-deepstack-object.js
face-manager-integrated
Elad Bar 2022-12-08 12:42:02 +00:00
commit be7132ae23
14 changed files with 128 additions and 113 deletions

View File

@ -99,7 +99,6 @@ RUN sed -i -e 's/\r//g' /home/Shinobi/Docker/init.sh
# RUN chmod -f +x /home/Shinobi/shinobi
VOLUME ["/home/Shinobi/videos"]
VOLUME ["/home/Shinobi/plugins"]
VOLUME ["/home/Shinobi/libs/customAutoLoad"]
VOLUME ["/config"]
VOLUME ["/var/lib/mysql"]

View File

@ -97,7 +97,6 @@ COPY ./Docker/pm2.yml ./
RUN chmod -f +x /home/Shinobi/Docker/init.sh
VOLUME ["/home/Shinobi/videos"]
VOLUME ["/home/Shinobi/plugins"]
VOLUME ["/home/Shinobi/libs/customAutoLoad"]
VOLUME ["/config"]
VOLUME ["/var/lib/mysql"]

View File

@ -106,7 +106,6 @@ RUN sed -i -e 's/\r//g' /home/Shinobi/Docker/init.sh
# RUN chmod -f +x /home/Shinobi/shinobi
VOLUME ["/home/Shinobi/videos"]
VOLUME ["/home/Shinobi/plugins"]
VOLUME ["/home/Shinobi/libs/customAutoLoad"]
VOLUME ["/config"]
VOLUME ["/var/lib/mysql"]

View File

@ -1,10 +1,9 @@
SHINOBI OPEN SOURCE SOFTWARE LICENSE AGREEMENT
==============================================
Version 1, 04 June 2018
Copyright (C) 2018 [Shinobi Systems](https://shinobi.systems)
Copyright (C) 2023 [Shinobi Systems](https://shinobi.systems)
*We'll try to keep it simple. Thanks for using Shinobi Software!*
*We'll try to keep it simple. Thanks for using Shinobi Software!*
Definitions.
-----------
@ -58,7 +57,7 @@ If you fall under any conditions for "Commercial Use" none of the following can
- Use in a non commercial area
- Used for non commercial purposes
- When used for research or educational purposes
- Testing Purposes
- Testing Purposes (5 Cameras Maximum, 14 Days)
- Usage by Primary Education or Secondary Education Schools
- Use for Emergency Services and facilities associated like Search and Rescue Services or
Ambulance Services with less than 50 cameras
@ -91,9 +90,10 @@ provided with subscription plans provided.
This software is property of Shinobi Systems. LICENSEE must keep all copyright notices
unchanged.
This software contains or uses other software with their own licenses attached. See "List of Included Software" at the bottom of this document.
#### Modification of this Software Product.
LICENSEE may modify code for but must provide these changes upon request from
Shinobi Systems or an authorized Shinobi representative. LICENSEE may not alter or change
LICENSEE may modify source code. LICENSEE may not alter or change
copyright notices. All code changes by LICENSEE shall fall under the copyright of Shinobi
Systems in the case code modified by LICENSEE is integrated into the official Shinobi code base.

View File

@ -20,28 +20,26 @@ module.exports = (s,config,lang) => {
}
if(whereGroup.length > 0)queryGroup.__separator = 'or'
whereGroup.push(queryGroup)
fs.chmod(video.dir,0o777,function(err){
fs.rm(video.dir,function(err){
++completedCheck
if(err){
fs.stat(video.dir,function(err){
if(!err){
fs.unlink(video.dir)
}
})
}
const whereGroupLength = whereGroup.length
if(whereGroupLength > 0 && whereGroupLength === completedCheck){
whereQuery[1] = whereGroup
s.knexQuery({
action: "delete",
table: "Videos",
where: whereQuery
},(err,info) => {
setTimeout(reRunCheck,1000)
})
}
})
fs.rm(video.dir,function(err){
++completedCheck
if(err){
fs.stat(video.dir,function(err){
if(!err){
fs.unlink(video.dir)
}
})
}
const whereGroupLength = whereGroup.length
if(whereGroupLength > 0 && whereGroupLength === completedCheck){
whereQuery[1] = whereGroup
s.knexQuery({
action: "delete",
table: "Videos",
where: whereQuery
},(err,info) => {
setTimeout(reRunCheck,1000)
})
}
})
if(storageIndex){
s.setDiskUsedForGroupAddStorage(groupKey,{

View File

@ -92,9 +92,7 @@ module.exports = function(s,config,lang){
insertQuery: insertQuery,
}
if(callback)callback(err,response)
fs.chmod(k.dir+k.file,0o777,function(err){
resolve(response)
})
resolve(response)
})
})
}
@ -224,36 +222,34 @@ module.exports = function(s,config,lang){
},(err,r) => {
if(r && r[0]){
r = r[0]
fs.chmod(e.dir+filename,0o777,function(err){
s.tx({
f: 'video_delete',
filename: filename,
mid: e.id,
ke: e.ke,
time: new Date(s.nameToTime(filename)),
end: s.formattedTime(new Date,'YYYY-MM-DD HH:mm:ss')
},'GRP_'+e.ke);
var storageIndex = s.getVideoStorageIndex(e)
if(storageIndex){
s.setDiskUsedForGroupAddStorage(e.ke,{
size: -(r.size / 1048576),
storageIndex: storageIndex
})
}else{
s.setDiskUsedForGroup(e.ke,-(r.size / 1048576))
s.tx({
f: 'video_delete',
filename: filename,
mid: e.id,
ke: e.ke,
time: new Date(s.nameToTime(filename)),
end: s.formattedTime(new Date,'YYYY-MM-DD HH:mm:ss')
},'GRP_'+e.ke);
var storageIndex = s.getVideoStorageIndex(e)
if(storageIndex){
s.setDiskUsedForGroupAddStorage(e.ke,{
size: -(r.size / 1048576),
storageIndex: storageIndex
})
}else{
s.setDiskUsedForGroup(e.ke,-(r.size / 1048576))
}
s.knexQuery({
action: "delete",
table: "Videos",
where: whereQuery
},(err) => {
if(err){
s.systemLog(lang['File Delete Error'] + ' : '+e.ke+' : '+' : '+e.id,err)
}
s.knexQuery({
action: "delete",
table: "Videos",
where: whereQuery
},(err) => {
if(err){
s.systemLog(lang['File Delete Error'] + ' : '+e.ke+' : '+' : '+e.id,err)
}
})
fs.rm(e.dir+filename,function(err){
resolve()
})
})
fs.rm(e.dir+filename,function(err){
resolve()
})
}else{
console.log(lang['Database row does not exist'],whereQuery)
@ -286,26 +282,24 @@ module.exports = function(s,config,lang){
time = video.time
}
time = new Date(time)
fs.chmod(video.dir + filename,0o777,function(err){
s.tx({
f: 'video_delete',
filename: filename,
mid: video.mid,
ke: video.ke,
time: s.nameToTime(filename),
end: s.formattedTime(new Date,'YYYY-MM-DD HH:mm:ss')
},'GRP_'+video.ke);
var storageIndex = s.getVideoStorageIndex(video)
if(storageIndex){
s.setDiskUsedForGroupAddStorage(video.ke,{
size: -(video.size / 1048576),
storageIndex: storageIndex
})
}else{
s.setDiskUsedForGroup(video.ke,-(video.size / 1048576))
}
s.file('delete',video.dir + filename)
});
s.tx({
f: 'video_delete',
filename: filename,
mid: video.mid,
ke: video.ke,
time: s.nameToTime(filename),
end: s.formattedTime(new Date,'YYYY-MM-DD HH:mm:ss')
},'GRP_'+video.ke);
var storageIndex = s.getVideoStorageIndex(video)
if(storageIndex){
s.setDiskUsedForGroupAddStorage(video.ke,{
size: -(video.size / 1048576),
storageIndex: storageIndex
})
}else{
s.setDiskUsedForGroup(video.ke,-(video.size / 1048576))
}
s.file('delete',video.dir + filename)
const queryGroup = {
ke: video.ke,
mid: video.mid,

View File

@ -482,9 +482,7 @@ module.exports = function(s,config,lang,app){
ke: account.ke,
}
})
fs.chmod(s.dir.videos+account.ke,0o777,function(err){
fs.rmdir(s.dir.videos+account.ke,function(err){})
})
fs.rmdir(s.dir.videos+account.ke,function(err){})
}
if(s.getPostData(req,'deleteEvents',false) == '1'){
s.knexQuery({

View File

@ -1,4 +1,3 @@
//
// Shinobi - DeepStack Face Recognition Plugin
// Copyright (C) 2021 Elad Bar
//
@ -321,19 +320,19 @@ const detectObject = (frameBuffer, d, tx, frameLocation, callback) => {
d.dir = `${s.dir.streams}${d.ke}/${d.id}/`;
const path = `${d.dir}${s.gid(5)}.jpg`;
const filePath = `${d.dir}${s.gid(5)}.jpg`;
if(!fs.existsSync(d.dir)) {
fs.mkdirSync(d.dir, dirCreationOptions);
}
fs.writeFile(path, frameBuffer, function(err) {
fs.writeFile(filePath, frameBuffer, function(err) {
if(err) {
return s.systemLog(err);
}
try {
processImage(frameBuffer, d, tx, path, callback);
processImage(frameBuffer, d, tx, filePath, callback);
} catch(ex) {
logError(`Detector failed to parse frame, Error: ${ex}`);

View File

@ -1,5 +1,5 @@
//
// Shinobi - DeepStack Face Recognition Plugin
// Shinobi - DeepStack Object Detection Plugin
// Copyright (C) 2021 Elad Bar
//
// Base Init >>
@ -321,19 +321,19 @@ const detectObject = (frameBuffer, d, tx, frameLocation, callback) => {
d.dir = `${s.dir.streams}${d.ke}/${d.id}/`;
const path = `${d.dir}${s.gid(5)}.jpg`;
const filePath = `${d.dir}${s.gid(5)}.jpg`;
if(!fs.existsSync(d.dir)) {
fs.mkdirSync(d.dir, dirCreationOptions);
}
fs.writeFile(path, frameBuffer, function(err) {
fs.writeFile(filePath, frameBuffer, function(err) {
if(err) {
return s.systemLog(err);
}
try {
processImage(frameBuffer, d, tx, path, callback);
processImage(frameBuffer, d, tx, filePath, callback);
} catch(ex) {
logError(`Detector failed to parse frame, Error: ${ex}`);

View File

@ -26,3 +26,14 @@
background: rgba(0,0,0,0.6);
color: #fff;
}
[data-status="1"] .btn-monitor-status-color {
background: #27b392!important;
border-color: #27b392!important;
}
[data-status="2"] .btn-monitor-status-color {
background-color: #2b3c4b;
border-color: #2b3c4b;
color: #fff;
}

View File

@ -435,3 +435,8 @@ ul.squeeze {
background-image: repeating-linear-gradient(rgb(204 204 204 / 50%) 0 1px, transparent 1px 100%), repeating-linear-gradient(90deg, rgb(204 204 204 / 50%) 0 1px, transparent 1px 100%);
background-size: 71px 71px;
}
.fixed-table-body {
min-height: 400px;
}

View File

@ -140,6 +140,7 @@ function toggleSideBarMenuHide(){
}
function makeMonitorListSortable(){
var monitorSideList = $('#monitorSideList')
if(isMobile)return;
var options = {
cellHeight: 80,
verticalMargin: 10,

View File

@ -639,14 +639,33 @@ function buildDefaultVideoMenuItems(file,options){
return `
<li><a class="dropdown-item" href="${href}" download>${lang.Download}</a></li>
${options.play ? `<li><a class="dropdown-item open-video" href="${href}">${lang.Play}</a></li>` : ``}
${options.play ? `<li><a class="dropdown-item mark-unread" href="${href}">${lang.Play}</a></li>` : ``}
<li><hr class="dropdown-divider"></li>
${permissionCheck('video_delete',file.mid) ? `<li><a class="dropdown-item open-video-studio" href="${href}">${lang.Slice}</a></li>` : ``}
${permissionCheck('video_delete',file.mid) ? `<li><a class="dropdown-item delete-video" href="${href}">${lang.Delete}</a></li>` : ``}
${permissionCheck('video_delete',file.mid) ? `<li><a class="dropdown-item compress-video" href="${href}">${lang.Compress}</a></li>` : ``}
`
}
function setVideoStatus(video,toStatus){
return new Promise((resolve,reject) => {
toStatus = toStatus || 2
if(video.status != toStatus){
$.get(`${video.actionUrl}/status/${toStatus}`,function(data){
resolve(data)
})
}
})
}
onWebSocketEvent(function(d){
switch(d.f){
case'video_edit':case'video_archive':
var video = loadedVideosInMemory[`${d.mid}${d.time}`]
if(video){
let filename = `${formattedTimeForFilename(convertTZ(d.time),false,`YYYY-MM-DDTHH-mm-ss`)}.${video.ext || 'mp4'}`
loadedVideosInMemory[`${d.mid}${d.time}`].status = d.status
$(`[data-mid="${d.mid}"][data-filename="${filename}"]`).attr('data-status',d.status);
}
break;
case'video_delete':
$('[file="'+d.filename+'"][mid="'+d.mid+'"]:not(.modal)').remove();
$('[data-file="'+d.filename+'"][data-mid="'+d.mid+'"]:not(.modal)').remove();
@ -656,15 +675,6 @@ onWebSocketEvent(function(d){
goBackOneTab()
}
deleteTab(videoPlayerId)
// if($.powerVideoWindow.currentDataObject&&$.powerVideoWindow.currentDataObject[d.filename]){
// delete($.timelapse.currentVideos[$.powerVideoWindow.currentDataObject[d.filename].position])
// $.powerVideoWindow.drawTimeline(false)
// }
// if($.timelapse.currentVideos&&$.timelapse.currentVideos[d.filename]){
// delete($.timelapse.currentVideosArray.videos[$.timelapse.currentVideos[d.filename].position])
// $.timelapse.drawTimeline(false)
// }
// if($.vidview.loadedVideos && $.vidview.loadedVideos[d.filename])delete($.vidview.loadedVideos[d.filename])
break;
}
})
@ -677,6 +687,7 @@ $(document).ready(function(){
var videoTime = el.attr('data-time')
var video = loadedVideosInMemory[`${monitorId}${videoTime}`]
createVideoPlayerTab(video)
setVideoStatus(video)
return false;
})
.on('click','[video-time-seeked-video-position]',function(){

View File

@ -111,11 +111,7 @@ $(document).ready(function(e){
},
{
field: 'time',
title: lang['Time Created'],
},
{
field: 'end',
title: lang['Ended']
title: lang['Time'],
},
{
field: 'objects',
@ -153,16 +149,16 @@ $(document).ready(function(e){
</div>`,
Monitor: loadedMonitor && loadedMonitor.name ? loadedMonitor.name : file.mid,
mid: file.mid,
time: formattedTime(file.time, 'DD-MM-YYYY hh:mm:ss AA'),
end: formattedTime(file.end, 'DD-MM-YYYY hh:mm:ss AA'),
time: `<div><b>${lang.Start}</b> ${formattedTime(file.time, 'DD-MM-YYYY hh:mm:ss AA')}</div>
<div><b>${lang.End}</b> ${formattedTime(file.end, 'DD-MM-YYYY hh:mm:ss AA')}</div>`,
objects: file.objects,
tags: `
${file.ext ? `<span class="badge badge-${file.ext ==='webm' ? `primary` : 'danger'}">${file.ext}</span>` : ''}
`,
objects: file.objects,
size: convertKbToHumanSize(file.size),
buttons: `
<div class="row-info" data-mid="${file.mid}" data-ke="${file.ke}" data-time="${file.time}" data-filename="${file.filename}">
<a class="btn btn-sm btn-default open-video" href="${href}" title="${lang.Play}"><i class="fa fa-play"></i></a>
<div class="row-info btn-group" data-mid="${file.mid}" data-ke="${file.ke}" data-time="${file.time}" data-filename="${file.filename}" data-status="${file.status}">
<a class="btn btn-sm btn-default btn-monitor-status-color open-video" href="${href}" title="${lang.Play}"><i class="fa fa-play"></i></a>
${permissionCheck('video_delete',file.mid) ? `<a class="btn btn-sm btn-${file.archive === 1 ? `success status-archived` : `default`} archive-video" title="${lang.Archive}"><i class="fa fa-${file.archive === 1 ? `lock` : `unlock-alt`}"></i></a>` : ''}
<div class="dropdown d-inline-block">
<a class="btn btn-sm btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false" data-bs-reference="parent">
@ -258,9 +254,14 @@ $(document).ready(function(e){
.on('click','.preview-video',function(e){
e.preventDefault()
var el = $(this)
var rowEl = $(this).parents('[data-mid]')
var monitorId = rowEl.attr('data-mid')
var videoTime = rowEl.attr('data-time')
var video = loadedVideosInMemory[`${monitorId}${videoTime}`]
var href = el.attr('href')
setPreviewedVideoHighlight(el,videosTableDrawArea)
drawPreviewVideo(href)
setVideoStatus(video)
return false;
})
.on('click','.zip-selected-videos',function(e){