-
Notifications
You must be signed in to change notification settings - Fork 2
/
start_ip_camera.m
56 lines (50 loc) · 1.43 KB
/
start_ip_camera.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
%starts vlc rtps stream specified in am xml file for kepecs' lab rat rigs.
%specific to default vlc installation folder on Win10 and kepecs rat rig
%xml file.
%Torben Ott, CSHL, 2017
%hostname
[~,hostname] = system('hostname');
hostname=strcat(hostname);%hack to remove spaces
%get ip address from xml file
try
%WUSTL
XML=xmlread('ip_cameras.xml');
catch
%CSHL
try
XML = xmlread('http://uncertainty.cshl.edu/observer/rigdata/rigs.xml');
catch
warning('Could not find ip camera address.')
end
end
try
rigs = XML.getElementsByTagName('rig');
address = [];
for k =0:rigs.getLength-1
rig=rigs.item(k);
name = char(rig.getElementsByTagName('name').item(0).getFirstChild.getData);
if strcmpi(name,hostname)
address = char(rig.getElementsByTagName('address').item(0).getFirstChild.getData);
break
end
end
catch
warning('Could not find rig in ip camera address file.')
end
%find vlc
if exist('C:\Program Files (x86)\VideoLAN\VLC\VLC.exe','file')==2
path = 'C:\Program Files (x86)\VideoLAN\VLC\VLC.exe';
elseif exist('C:\Program Files\VideoLAN\VLC\VLC.exe','file')==2
path = 'C:\Program Files\VideoLAN\VLC\VLC.exe';
% elseif exist('C:\Program Files\VideoLAN\VLC\VLC.exe','file')==2
else
fprintf('Starting VLC from command failed.');
return
end
ss
%start vlc
try
system(['start "" "',path,'" "', address,'"']);
catch
fprintf('Starting VLC from command failed.');
end