How to use the pymtp.models.LIBMTP_File function in PyMTP

To help you get started, we’ve selected a few PyMTP examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emdete / python-mtp / pymtp / models.py View on Github external
return MTPDevice(self._get_item(key))

# --------
# Beginning LibMTP_File, MTPFile and MTPFiles
# --------

class LIBMTP_File(ctypes.Structure):
	"""
		LIBMTP_File
		Contains the ctypes structure for LIBMTP_file_t
	"""

	def __repr__(self):
		return "%s (%s)" % (self.filename, self.item_id)

LIBMTP_File._fields_ = [
	("item_id", ctypes.c_uint32),
	("parent_id", ctypes.c_uint32),
	("storage_id", ctypes.c_uint32),
	("filename", ctypes.c_char_p),
	("filesize", ctypes.c_uint64),
	("modificationdate", ctypes.c_int),
	("filetype", ctypes.c_int),
	("next", ctypes.POINTER(LIBMTP_File)),
	]

LIBMTP_File_p = ctypes.POINTER(LIBMTP_File)

class MTPFile(BaseModel):
	"""
		MTPFile
github emdete / python-mtp / pymtp / models.py View on Github external
LIBMTP_File
		Contains the ctypes structure for LIBMTP_file_t
	"""

	def __repr__(self):
		return "%s (%s)" % (self.filename, self.item_id)

LIBMTP_File._fields_ = [
	("item_id", ctypes.c_uint32),
	("parent_id", ctypes.c_uint32),
	("storage_id", ctypes.c_uint32),
	("filename", ctypes.c_char_p),
	("filesize", ctypes.c_uint64),
	("modificationdate", ctypes.c_int),
	("filetype", ctypes.c_int),
	("next", ctypes.POINTER(LIBMTP_File)),
	]

LIBMTP_File_p = ctypes.POINTER(LIBMTP_File)

class MTPFile(BaseModel):
	"""
		MTPFile

		A class representing a file on an MTP device.
	"""
	@property
	def item_id(self):
		"""
			The unique identifier for the file
			@return: File identifier
			@rtype: int