Code Monkey home page Code Monkey logo

Comments (1)

jeffreydwalter avatar jeffreydwalter commented on May 16, 2024

Hi @joel-bryant,
The demo script actually downloads and deletes videos for the last seven days, not just from the seventh day.

From the demo, it is this code that writes the file:

	# Get all of the recordings for a date range.
	library = arlo.GetLibrary(seven_days_ago, today)

	# Iterate through the recordings in the library.
	for recording in library:

                # Make a filename to use for each file (could be anything you want).
		videofilename = datetime.datetime.fromtimestamp(int(recording['name'])//1000).strftime('%Y-%m-%d %H-%M-%S') + ' ' + recording['uniqueId'] + '.mp4'

                # StreamRecording() opens the video stream and returns a generator which is used to download the video file.
                stream = arlo.StreamRecording(recording['presignedContentUrl'])
                # Open the file for writing.
                # Loop over the stream generator and write the chunks to the file.
		with open('videos/'+videofilename, 'w') as f:
			for chunk in stream:
                                # f.write() below is where the actual chunks are written.
				# Support both Python 2.7 and 3.
				if sys.version[0] == '2':
					f.write(chunk)
				else:
					f.buffer.write(chunk)
			f.close()

from arlo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.