How to specify a date range when requesting to download clips?
tresrottn opened this issue · 5 comments
This project is saving my mental well being, I cannot lie, You and the person who pointed me in this direction are genuine superheros to me. The clips I'm downloading are more precious than diamonds. I only wish I had known about this sooner.
Thank you so very much for this hard work.
I don't have much idea of what I'm doing(ok, I have NO idea what I'm doing) but I've managed to start the download process but it's started well out of the time range I'm looking for.
I used the "since" command since that was what was there in the documentation
Can you please help me write a command line to specify the date ranges of video clips like 2022-12-01 to 2022-12-30?
This is my current command:
blink.download_videos('directory path', since='2022/11/27', delay=2)
I'm into the second day, and it has made it backward to 2022-12-30.
AND THEN,
I had been messing around with the code and changed it (by accident) to:
blink.download_videos('directory path', '2022/11/27', delay=2)
It seems the changed command has caused it to hop and started from 2022-11-30 working backwards (thank the gods, I'm racing the Blink deletion clock here)
I know the month exists, I've got it in my clips library, the system wasn't disarmed during this time.
If I rewrite the request (after the november videos stop downloading) to:
blink.download_videos('directory path', '2022/12/01', delay=2)
would it pick up from Dec 31'st and work backward to Dec 1st?
Or, is there a way to write the line to start from a specified date and move forward for those people who find themselves needing to save clips from the time frame (60 day) deletion monster?
Again, thank you!
First off:
Thank you so very much for this hard work.
I appreciate that! Always happy when someone finds a good use for this library!
Alright, so it's been awhile since I implemented this feature so the exact workings may be a little bit different than I explain here, but it should be relatively close.
If I rewrite the request (after the november videos stop downloading) to:
blink.download_videos('directory path', '2022/12/01', delay=2)
would it pick up from Dec 31'st and work backward to Dec 1st?
Yes, this is precisely how the function is designed to work. You give it a "since" keyword argument and the library will look for all clips with that timestamp up to the timestamp of the request. So if you have clips dating back to December 1st 2022 and today is January 29th 2023, providing the since='2022/12/01'
argument will grab all videos between December 1st 2022 and January 29th 2023.
Additionally, there are other arguments that can be provided as explained here (I'm not sure if you found that page in the documentation, it's kind of buried). I point this out because I think there are some useful arguments that may be useful to you:
debug=True
: if you supply this argument, the videos will not be downloaded and instead the library will just report what clips it found. This is handy if you are unsure of the command you're providing and want to double check you didn't mess something updelay=<number>
: the README uses thedelay=2
parameter, which may be insufficient if you're downloading a lot of clips. The Blink servers can sometimes be slow, so thedelay
keyword allows a pause between subsequent clip retrieval to make sure there's no timeouts. It's not clear if you're running into a problem of missing clips, but if you are you can likely avoid the issue by bumping that number up to5
or greater. If you haven't had an issue with missing clips or incomplete downloads, you can ignore this advice.stop=<number>
: This tells the library what 'page' to stop on. The way Blink's API works is it requires you to provide both a timestamp and a page number for the clip you want to retrieve. The definition of apage
is a bit murky, but by experimentation one page seems to hold up to 25 clips. If you do not specify anything here, the library uses10
as default. You can play around with this value in conjunction withdebug=True
to see which one might be best for your use case.
And a final note: the way Blink handles timestamps can be...bizarre. If you specify a since
date and get videos +/- 1 day around that value, don't be surprised. Again, this is where debug=True
my come in handy to just see what the library finds and then adjust the command as necessary.
I hope this helps!
(I'm going to close this issue since it's just a question and not a bug or feature request, but please feel free to keep responding!)
You have no idea how helpful this has been. These clips contain the last days of the sweetest cat in the world, and losing them is too devastating to imagine. It's been a rollercoaster of pure pain downloading these individually.
Yes, you're a godsblessed hero in my book. Forever.
If I understand correctly, the arguments have no way to specify a specific date range like 12/01-12/15. These are the last ones I would need.
We're talking thousands of clips (3 cameras and a cat, lol), and I'm unable (so far) to get past 2022-30-12, it starts on today, gets back to dec 30th, then leaps from there to 2022-11-30.
Then, getting timeouts. I believe I am missing clips, each time I do it I get a couple more new ones here and there. I tried adding the camera=all, it didn't seem to make much difference.
Increasing the delay time, that's a new option, I'm thinking perhaps 10 seconds may be better so it will stop throwing up all over itself after x amount of time.
I think I want to try the debug=true request. (ok, that was a massive fail, lol)
I'm including the timeout error I've been getting, and the weird results I'm getting for 2022
Link because it hates the file.
https://i.imgur.com/2nzPqH9.jpg
https://i.imgur.com/NKrKGJh.jpg
Ok, update time.
It timed out again with a 10 second delay, still stopping at Dec 29th.
I finally got the debug=True to work, and after about 12 hours, I have finally seen Dec 28th.
I feel it's going to keep timing out without ever reaching December.
I'm feeling stupid. If I delete January's clips, it should be able to go right to December and start from there, yes?
I've been deleting clips as they downloaded, got to the 27th, there are 558 clips left and it's not responding to the request now.
I rearmed the system and it instantly downloaded the clips made just after I did.
I swear, Blink is really going head over heels to force me to download these December clips individually by hand. It's like they actively want to torture me. This is simply unreal at this point.
I don't know why it will not allow me to download them.
Day 12,385: I got it going again, it seems that a 7 second delay is the sweet spot. It ran all day yesterday (and still didn't download them all) before stopping with a message about connection ended or throttled.
I waited a few hours and restarted it, and it started without issue.
I've had to delete more days downward, hopefully today will be the day it gets the last of them. I'll post the download totals, I know it's got to be at least 3-4000.
It appears that one pass doesn't download all the videos for any given day, so I' make 3-4 passes before getting a full day. I would include that caveat in the documentation.
You're right, the process (API?) is pretty convoluted and seems as poorly executed as the end used interface.