doorbot icon indicating copy to clipboard operation
doorbot copied to clipboard

change needed for new naming convention used

Open david-olshefski opened this issue 5 years ago • 8 comments

I tried the download-all.js example, but it didn't quite work because I think ring has changed their URL path names since this code was developed. The new path names added "_stamp" to the timestamp portion of the path name. I changed the code to be this:


                if ((e == null) && (typeof recording != 'undefined')) {
		const datea = dateFormat(info['created_at'],"yyyy_mm_dd_HH.MM.ss_Z");
		const partFilePath = url.parse(recording).pathname.substring(0,url.parse(recording).pathname.length - 4);
		const parts = partFilePath.split('/');
		const filePath = '/' + parts[1] + '/' + datea + '_' + parts[2] + '.mp4';
		const file = path.join(base, '.', filePath);
				
		// Track the smallest ID, which is the oldest ID in this batch
		if (info['id'] < oldestFile) {
                        oldestFile = info['id'];
		} 

So I use the info['id'] to obtain the timestamp, rather than parts[2] which now has the "_stamp" suffix making the comparison not work.

Hope this helps someone. I have it working so that it pulls down every file from my ring account, skipping over existing files. Very convenient - thanks for writing this code.

david-olshefski avatar Sep 12 '19 00:09 david-olshefski

Can I please have a copy of your download all script?

yannip1234 avatar Sep 18 '19 20:09 yannip1234

Hi Yannip, I run get_all.sh which calls download-all.js...rename these uploaded files back to use the correct file extension. I run it on my MAC, Mojave 10.14.6. Of course, edit download-all.js with your own email/password. I used the timestamps to obtain all my older videos, but once I had them, they got skipped on future runs...I actually didn't/don't trust Ring to give me all the files within a time range, but once I ran it, it doesn't seem to pull down any other files except for the new ones. My impression is that ring will return only so many files if you give it a timestamp, maybe 100, then they close the connection...so I either had to re-open the connection in download-all.js, or call download-all.js with a series of timestamps as in get_all.sh (this was quicker, but not as nice). So I could tell from the files how to choose the timestamps, you may have to do that for your files.

Best of luck.

download-all.txt

get_all.txt

david-olshefski avatar Sep 19 '19 13:09 david-olshefski

Thanks for the help!

-- Yanni Pang

On September 19, 2019 at 9:47:38 AM, David Olshefski ( [email protected]) wrote:

Hi Yannip, I run get_all.sh which calls download-all.js...rename these uploaded files back to use the correct file extension. I run it on my MAC, Mojave 10.14.6. Of course, edit download-all.js with your own email/password. I used the timestamps to obtain all my older videos, but once I had them, they got skipped on future runs...I actually didn't/don't trust Ring to give me all the files within a time range, but once I ran it, it doesn't seem to pull down any other files except for the new ones. My impression is that ring will return only so many files if you give it a timestamp, maybe 100, then they close the connection...so I either had to re-open the connection in download-all.js, or call download-all.js with a series of timestamps as in get_all.sh (this was quicker, but not as nice). So I could tell from the files how to choose the timestamps, you may have to do that for your files.

Best of luck.

download-all.txt https://github.com/davglass/doorbot/files/3631445/download-all.txt

get_all.txt https://github.com/davglass/doorbot/files/3631439/get_all.txt

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/davglass/doorbot/issues/48?email_source=notifications&email_token=AASYMKL3WOIELC5HT7RZJM3QKN7HVA5CNFSM4IV3D54KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7DQZYI#issuecomment-533138657, or mute the thread https://github.com/notifications/unsubscribe-auth/AASYMKPBQJXLPMMPRD73Z4DQKN7HVANCNFSM4IV3D54A .

yannip1234 avatar Sep 19 '19 15:09 yannip1234

Thanks a lot for the update, but just a small question. I assumed the API would only work if you have the subscription plan , right? I'm able to fetch the video's but all with an error 403, and recording: { status: 'expired' }. Am I correct by saying this doorbell is useless without the subscription?

woutb avatar Dec 17 '19 22:12 woutb

Seems to be. To be honest, even with the subscription you may think it is useless. I see many skips in the video, and totally black videos. You can't really adjust the angle of the video cam either so you may see a lot of sky & clouds rather than the packages on the ground.

The ring support folks told me that the device does not store any videos locally, that all videos are immediately transmitted to the server. Poor design. There is no way to insert a micro SD card into the device. This also means that if the wifi is down or busy you may not get the video.

You need to buy an extra battery. It takes many hours to charge the battery (over night) so if you want the device up and running all the time you will need a spare battery to 'swap & charge'. They do not allow you to charge the battery while it is in the device - so no option for plugging the device into a continuous power source. Very poor design.

When I got mine, they gave me 30 days free on the video subscription. After that, I paid. If you can download the videos in the app or online, then this code should work - but if you go to the website and you cannot, or the app will not let you, then I guess this code won't work. This code requires a user ID & password - so I guess they check. But who knows, you may be able to find a loophole on their server.

The other option, which I have not researched, would be to setup a ftp server in the home, and intercept the video uploads from the device and just store them locally on my laptop - pretend to be the ring server. They do not offer a configuration option for this - it would have to be a hack. Or possibly doing a packet trace and merging the videos. You get to tell the device which network to login to, which would make this a bit easier I would think.

There are other options out there for video door cams, as I am sure you know. Some are more flexible, cheaper, but require more work.

david-olshefski avatar Dec 17 '19 22:12 david-olshefski

download-all.txt

get_all.txt

Thank you so much for your work. Your code worked very fine. It seems as if it does not work now, at least since X-Mas I was not able to download any videos with your code. Is it possible, that the name convention changed in the meantime? Or is anything wrong with logging in. i only get:

DPO doAgain called with goBack = null (then some time goes by) DPO Oldest File: 10000000000000000000 DPO about to loop, setting lastOldest to 10000000000000000000 DPO doAgain called with goBack = 10000000000000000000 DPO getting more, olderthan: 10000000000000000000 DPO Oldest File: 10000000000000000000 DPO NOT LOOPING, lastOldest is 10000000000000000000 while oldestFile is 10000000000000000000

SysErr23 avatar Jan 03 '20 16:01 SysErr23

download-all.txt

get_all.txt

I found out, that the new OAuth authentification should be the problem. I now tried to use the doorbot.js from joeyberkovitz https://github.com/joeyberkovitz/doorbot that should work with OAuth. Now i get the "Callback not defined" Error.

Can you help?

SysErr23 avatar Jan 08 '20 14:01 SysErr23

Solution for the download-all.js is here: https://github.com/davglass/doorbot/issues/54

SysErr23 avatar Jan 09 '20 17:01 SysErr23