Hi,
Is it possible somehow to make a link in a device to a file?
I tried this: “file://192.168.0.10/NAS_private/Ipcameras/20160628175215.mp4” but it doesn’t work.
This way I want to download the latest record of an Ip camera.
Thanks in advance.
Link, Download file
Hi,
Is it possible somehow to make a link in a device to a file?
I tried this: “file://192.168.0.10/NAS_private/Ipcameras/20160628175215.mp4” but it doesn’t work.
This way I want to download the latest record of an Ip camera.
Thanks in advance.
@lschip Maybe you can use “pimatic filebrowser”, alternatively. It can be used to let pimatic serve files in a given directory.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
Great, thanks.
Still another question related to this issue.
Now I can browse though files from a xLink.
Opening a file is also possible, great.
Butt now I want to open the last created file in a directory. I have that file in a variable.
It would be possible when variables could be used in the Xlink but it isn’t.
I tried several workarounds but can’t find one.
Han anyone suggestions?
Thanks.
To get the last created file you can use a script an set it as shellsensor…
script:
cd /path/to/folder
ls -rt1 | tail -1
And then set the script as shellsensor.
So you get a variable, in my config (lognextpicture.tag)
And you can use it in a rule.
My example:
when $lognextpicture.tag changes then load iframe-id with "http://ip.to.pimatic:port/files/path/to/folder/$lognextpicture.tag
So he alsways puts the always newest picture in my iframe.
Hope this helps a bit.
mfg
Chris
I am sorry, I had to tell, its not a picture but a MP4 file from my webcam.
And I don’t want to open it in the Pimatic Gui but in my browser.
This works now with Xlink but only with a fixed filename…:
http://192.168.0.xxx/Ipcameras/Ipcameras/20170628175215.mp4
I like to open it with:
http://192.168.0.xxx/Ipcameras/Ipcameras/$IpCamera-Achter-LastRecord
which doesn’t work…
Extending @chris sollution to determine the last file you could create a symbolic link to that file and use the link name as part of xlink. However, as ls
will also find the symbolic link in the same directory this may produce wrong results. Thus, my suggestion is to use find
to limiting the search to regular files. The symbolic link created is named lastfile.mp4
in the given example
For example:
cd /path/to/folder && ln -sf $(find . -maxdepth 1 \! -type l \! -type d | xargs ls -t | head -1) lastfile.mp4
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig
Thanks, nice creative solution!
Works for me!
@lschip That’s great. I am glad it is working for you
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law