How to use the pymtp.models.LIBMTP_Error 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
# ---------
# Defining LIBMTP_Error, MTPError, and MTPErrors
# ---------

class LIBMTP_Error(ctypes.Structure):
	"""
		LIBMTP_Error

		Contains the ctypes structure for LIBMTP_error_struct
	"""

	def __repr__(self):
		return int(self.errornumber)

LIBMTP_Error._fields_ = [
	("errornumber", ctypes.c_int),
	("error_text", ctypes.c_char_p),
	("next", ctypes.POINTER(LIBMTP_Error)),
	]

LIBMTP_Error_p = ctypes.POINTER(LIBMTP_Error)

class MTPError(BaseModel):
	"""
		MTPError

		An object representing an single MTP error.
	"""
	@property
	def errornumber(self):
		"""
github emdete / python-mtp / pymtp / models.py View on Github external
"""
		LIBMTP_MTPDevice

		Contains the ctypes structure for LIBMTP_mtpdevice_struct
	"""

	def __repr__(self):
		return 'Device with object_bitsize=%s, maximum_battery_level=%s, cached=%s, storage=%s'% (
			self.object_bitsize, self.maximum_battery_level, self.cached, self.storage, )

LIBMTP_MTPDevice._fields_ = [
	("object_bitsize", ctypes.c_uint8),
	("params", ctypes.c_void_p),
	("usbinfo", ctypes.c_void_p),
	("storage", ctypes.POINTER(LIBMTP_DeviceStorage)),
	("errorstack", ctypes.POINTER(LIBMTP_Error)),
	("maximum_battery_level", ctypes.c_uint8),
	("default_music_folder", ctypes.c_uint32),
	("default_playlist_folder", ctypes.c_uint32),
	("default_picture_folder", ctypes.c_uint32),
	("default_video_folder", ctypes.c_uint32),
	("default_organizer_folder", ctypes.c_uint32),
	("default_zencast_folder", ctypes.c_uint32),
	("default_album_folder", ctypes.c_uint32),
	("default_text_folder", ctypes.c_uint32),
	("cd", ctypes.c_void_p),
	("extensions", ctypes.c_void_p),
	("cached", ctypes.c_int),
	("next", ctypes.POINTER(LIBMTP_MTPDevice)),
	]

LIBMTP_MTPDevice_p = ctypes.POINTER(LIBMTP_MTPDevice)