91JJ
(91JJ)
December 21, 2021, 7:54am
1
Below is the config I’m using to download/save video’s from my Ring doorbell.
It’s working fine, however, I’d like it to save the files into their own folders based on the month/year.
Is there a way to create the folder if it doesn’t exist, then save the video into that folder for each month?
e.g.
December_2021
January_2022
service: downloader.download_file
data:
url: '{{ state_attr(''camera.front_door'', ''video_url'') }}'
subdir: '{{state_attr(''camera.front_door'', ''friendly_name'')}}'
filename: >-
{{ state_attr('camera.front_door', 'friendly_name') }} - {{
now().strftime("%d-%m-%Y- %H.%M.%S") }} - TEST.mp4
Try this:
service: downloader.download_file
data:
url: '{{ state_attr("camera.front_door", "video_url") }}'
subdir: '{{state_attr("camera.front_door", "friendly_name")}}/{{ now().strftime("%m.%Y") }}'
filename: >-
{{ state_attr('camera.front_door', 'friendly_name') }} - {{
now().strftime("%d-%m-%Y- %H.%M.%S") }} - TEST.mp4
I would also like to recommend that you use the ISO8601 format for the dates. That way, the file list will be in the correct chronological order when sorted alphabetically.
service: downloader.download_file
data:
url: '{{ state_attr("camera.front_door", "video_url") }}'
subdir: '{{state_attr("camera.front_door", "friendly_name")}}/{{ now().strftime("%Y-%m") }}'
filename: >-
{{ state_attr('camera.front_door', 'friendly_name') }} - {{
now().strftime("%Y%m%dT%H%M%S") }} - TEST.mp4
Colons in filenames are ugly, so I used the form without delimiters for filename
.
1 Like
91JJ
(91JJ)
December 21, 2021, 11:35am
3
ondras12345:
service: downloader.download_file
data:
url: '{{ state_attr("camera.front_door", "video_url") }}'
subdir: '{{state_attr("camera.front_door", "friendly_name")}}/{{ now().strftime("%m.%Y") }}'
filename: >-
{{ state_attr('camera.front_door', 'friendly_name') }} - {{
now().strftime("%d-%m-%Y- %H.%M.%S") }} - TEST.mp4
Thanks, This works perfectly!
For the formatting, I’m from the UK, so rather weird with how I’m familiar with viewing the dates (DD/MM/YYYY)
91JJ
(91JJ)
December 21, 2021, 12:13pm
4
Another question on this (I’m sure I’ve seen a post about it before)
But is there a way to view ‘Todays’ downloaded files via a drop down list and play them back within A card?
Sorry, I don’t know. You might be better off starting a new topic for that.
If it was here on the forum, try searching with some keywords and in:seen
.
1 Like
91JJ
(91JJ)
February 25, 2022, 10:28am
6
Just wanting to bump this as I’d like to add another sub folder for the day, I did gave it a go buy my code is really bad and doesn’t work.
Can anybody help add another folder to this code?
service: downloader.download_file
data:
url: '{{ state_attr("camera.front_door", "video_url") }}'
subdir: '{{state_attr("camera.front_door", "friendly_name")}}/{{ now().strftime("%m.%Y") }}'
filename: >-
{{ state_attr('camera.front_door', 'friendly_name') }} - {{
now().strftime("%d-%m-%Y- %H.%M.%S") }} - TEST.mp4
See if this works:
service: downloader.download_file
data:
url: '{{ state_attr("camera.front_door", "video_url") }}'
subdir: '{{state_attr("camera.front_door", "friendly_name")}}/{{ now().strftime("%m.%Y") }}/{{ now().strftime("%d") }}'
filename: >-
{{ state_attr('camera.front_door', 'friendly_name') }} - {{
now().strftime("%d-%m-%Y- %H.%M.%S") }} - TEST.mp4
2 Likes
91JJ
(91JJ)
February 25, 2022, 3:43pm
8
So easy when you see it!
Thanks again!!!