Add searching videos by monitor tag
parent
911f9f8b39
commit
98b4fcb1ba
|
@ -7756,6 +7756,7 @@ module.exports = function(s,config,lang){
|
||||||
icon: 'barcode',
|
icon: 'barcode',
|
||||||
label: `${lang['Timeline']}`,
|
label: `${lang['Timeline']}`,
|
||||||
pageOpen: 'timeline',
|
pageOpen: 'timeline',
|
||||||
|
addUl: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'film',
|
icon: 'film',
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
"Accuracy Mode": "Accuracy Mode",
|
"Accuracy Mode": "Accuracy Mode",
|
||||||
"Client ID": "Client ID",
|
"Client ID": "Client ID",
|
||||||
"Tags": "Tags",
|
"Tags": "Tags",
|
||||||
|
"addTagText": "Add Tags to your monitors to get more choices here.",
|
||||||
"tagsCannotAddText": "Cannot add Tag",
|
"tagsCannotAddText": "Cannot add Tag",
|
||||||
"tagsTriggerCannotAddText": "Trigger tags must match an existing tag that was added to a Monitor previously or is pending to be added to this monitor that is currently being edited.",
|
"tagsTriggerCannotAddText": "Trigger tags must match an existing tag that was added to a Monitor previously or is pending to be added to this monitor that is currently being edited.",
|
||||||
"tagsFieldText": "Automatically group Monitors based on a common identifier.",
|
"tagsFieldText": "Automatically group Monitors based on a common identifier.",
|
||||||
|
|
|
@ -7,6 +7,7 @@ $(document).ready(function(){
|
||||||
var timeStripPreBuffers = $('#timeline-pre-buffers');
|
var timeStripPreBuffers = $('#timeline-pre-buffers');
|
||||||
var timeStripObjectSearchInput = $('#timeline-video-object-search');
|
var timeStripObjectSearchInput = $('#timeline-video-object-search');
|
||||||
var dateSelector = $('#timeline-date-selector');
|
var dateSelector = $('#timeline-date-selector');
|
||||||
|
var sideMenuList = $(`#side-menu-link-timeline ul`)
|
||||||
var playToggles = timeStripControls.find('[timeline-action="playpause"]')
|
var playToggles = timeStripControls.find('[timeline-action="playpause"]')
|
||||||
var speedButtons = timeStripControls.find('[timeline-action="speed"]')
|
var speedButtons = timeStripControls.find('[timeline-action="speed"]')
|
||||||
var gridSizeButtons = timeStripControls.find('[timeline-action="gridSize"]')
|
var gridSizeButtons = timeStripControls.find('[timeline-action="gridSize"]')
|
||||||
|
@ -27,6 +28,7 @@ $(document).ready(function(){
|
||||||
var timeStripItemColors = {}
|
var timeStripItemColors = {}
|
||||||
var timeStripAutoGridSizer = false
|
var timeStripAutoGridSizer = false
|
||||||
var timeStripListOfQueries = []
|
var timeStripListOfQueries = []
|
||||||
|
var timeStripSelectedMonitors = []
|
||||||
var loadedVideosOnTimeStrip = []
|
var loadedVideosOnTimeStrip = []
|
||||||
var loadedVideosOnCanvas = {}
|
var loadedVideosOnCanvas = {}
|
||||||
var loadedVideoElsOnCanvas = {}
|
var loadedVideoElsOnCanvas = {}
|
||||||
|
@ -83,12 +85,14 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
return gaps;
|
return gaps;
|
||||||
}
|
}
|
||||||
async function getVideosInGaps(gaps){
|
async function getVideosInGaps(gaps,monitorIds){
|
||||||
var searchQuery = timeStripObjectSearchInput.val()
|
var searchQuery = timeStripObjectSearchInput.val()
|
||||||
var videos = []
|
var videos = []
|
||||||
|
async function loopOnGaps(monitorId){
|
||||||
for (let i = 0; i < gaps.length; i++) {
|
for (let i = 0; i < gaps.length; i++) {
|
||||||
var range = gaps[i]
|
var range = gaps[i]
|
||||||
videos.push(...(await getVideos({
|
videos.push(...(await getVideos({
|
||||||
|
monitorId,
|
||||||
startDate: range[0],
|
startDate: range[0],
|
||||||
endDate: range[1],
|
endDate: range[1],
|
||||||
searchQuery,
|
searchQuery,
|
||||||
|
@ -96,15 +100,25 @@ $(document).ready(function(){
|
||||||
// customVideoSet: wantCloudVideo ? 'cloudVideos' : null,
|
// customVideoSet: wantCloudVideo ? 'cloudVideos' : null,
|
||||||
},null,true)).videos);
|
},null,true)).videos);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(monitorIds && monitorIds.length > 0){
|
||||||
|
for (let ii = 0; ii < monitorIds.length; ii++) {
|
||||||
|
var monitorId = monitorIds[ii]
|
||||||
|
await loopOnGaps(monitorId)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
await loopOnGaps('')
|
||||||
|
}
|
||||||
return videos;
|
return videos;
|
||||||
}
|
}
|
||||||
async function getVideosByTimeStripRange(addOrOverWrite){
|
async function getVideosByTimeStripRange(addOrOverWrite){
|
||||||
|
// timeStripSelectedMonitors = selected monitors
|
||||||
var stripDate = getTimestripDate()
|
var stripDate = getTimestripDate()
|
||||||
var startDate = stripDate.start
|
var startDate = stripDate.start
|
||||||
var endDate = stripDate.end
|
var endDate = stripDate.end
|
||||||
var gaps = findGapsInSearchRanges(timeStripListOfQueries, [startDate,endDate])
|
var gaps = findGapsInSearchRanges(timeStripListOfQueries, [startDate,endDate])
|
||||||
timeStripListOfQueries.push(...gaps)
|
timeStripListOfQueries.push(...gaps)
|
||||||
var videos = await getVideosInGaps(gaps);
|
var videos = await getVideosInGaps(gaps,timeStripSelectedMonitors);
|
||||||
videos = addVideoBeforeAndAfter(videos);
|
videos = addVideoBeforeAndAfter(videos);
|
||||||
loadedVideosOnTimeStrip.push(...videos)
|
loadedVideosOnTimeStrip.push(...videos)
|
||||||
resetTimelineItems(loadedVideosOnTimeStrip)
|
resetTimelineItems(loadedVideosOnTimeStrip)
|
||||||
|
@ -530,6 +544,52 @@ $(document).ready(function(){
|
||||||
picker.setStartDate(startDate);
|
picker.setStartDate(startDate);
|
||||||
picker.setEndDate(endDate);
|
picker.setEndDate(endDate);
|
||||||
}
|
}
|
||||||
|
function drawFoundCamerasSubMenu(){
|
||||||
|
var tags = getListOfTagsFromMonitors()
|
||||||
|
var allFound = [
|
||||||
|
{
|
||||||
|
attributes: `timeline-menu-action="selectMonitorGroup" tag=""`,
|
||||||
|
class: `cursor-pointer`,
|
||||||
|
color: 'green',
|
||||||
|
label: lang['All Monitors'],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
$.each(tags,function(tag,monitors){
|
||||||
|
allFound.push({
|
||||||
|
attributes: `timeline-menu-action="selectMonitorGroup" tag="${tag}"`,
|
||||||
|
class: `cursor-pointer`,
|
||||||
|
color: 'blue',
|
||||||
|
label: tag,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if(allFound.length === 1){
|
||||||
|
allFound.push({
|
||||||
|
attributes: ``,
|
||||||
|
class: ``,
|
||||||
|
color: ' d-none',
|
||||||
|
label: `<small class="mt-1">${lang.addTagText}</small>`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
var html = buildSubMenuItems(allFound)
|
||||||
|
sideMenuList.html(html)
|
||||||
|
}
|
||||||
|
sideMenuList.on('click','[timeline-menu-action]',function(){
|
||||||
|
var el = $(this)
|
||||||
|
var type = el.attr('timeline-menu-action')
|
||||||
|
switch(type){
|
||||||
|
case'selectMonitorGroup':
|
||||||
|
var tag = el.attr('tag')
|
||||||
|
if(!tag){
|
||||||
|
timeStripSelectedMonitors = []
|
||||||
|
}else{
|
||||||
|
var tags = getListOfTagsFromMonitors()
|
||||||
|
var monitorIds = tags[tag]
|
||||||
|
timeStripSelectedMonitors = [...monitorIds];
|
||||||
|
}
|
||||||
|
refreshTimeline()
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})
|
||||||
timelineActionButtons.click(function(){
|
timelineActionButtons.click(function(){
|
||||||
var el = $(this)
|
var el = $(this)
|
||||||
var type = el.attr('timeline-action')
|
var type = el.attr('timeline-action')
|
||||||
|
@ -574,10 +634,12 @@ $(document).ready(function(){
|
||||||
addOnTabOpen('timeline', function () {
|
addOnTabOpen('timeline', function () {
|
||||||
createTimeline()
|
createTimeline()
|
||||||
reloadTimeline()
|
reloadTimeline()
|
||||||
|
drawFoundCamerasSubMenu()
|
||||||
})
|
})
|
||||||
addOnTabReopen('timeline', function () {
|
addOnTabReopen('timeline', function () {
|
||||||
// createTimeline()
|
// createTimeline()
|
||||||
// reloadTimeline()
|
// reloadTimeline()
|
||||||
|
drawFoundCamerasSubMenu()
|
||||||
})
|
})
|
||||||
addOnTabAway('timeline', function () {
|
addOnTabAway('timeline', function () {
|
||||||
// destroyTimeline()
|
// destroyTimeline()
|
||||||
|
|
Loading…
Reference in New Issue