Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
("FreeSpaceInObjects", ctypes.c_uint64),
("StorageDescription", ctypes.c_char_p),
("VolumeIdentifier", ctypes.c_char_p),
("next", ctypes.POINTER(LIBMTP_DeviceStorage)),
("prev", ctypes.POINTER(LIBMTP_DeviceStorage))]
class LIBMTP_MTPDevice(ctypes.Structure):
"""
LIBMTP_MTPDevice
Contains the ctypes structure for LIBMTP_mtpdevice_t
"""
def __repr__(self):
return self.interface_number
LIBMTP_MTPDevice._fields_ = [("interface_number", 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),
("next", ctypes.POINTER(LIBMTP_MTPDevice))]
# ----------
# Type Definitions
# ----------
_libmtp.LIBMTP_Get_Friendlyname.restype = ctypes.c_char_p
_libmtp.LIBMTP_Get_Serialnumber.restype = ctypes.c_char_p
_libmtp.LIBMTP_Get_Modelname.restype = ctypes.c_char_p
_libmtp.LIBMTP_Get_Manufacturername.restype = ctypes.c_char_p
_libmtp.LIBMTP_Get_Deviceversion.restype = ctypes.c_char_p
_libmtp.LIBMTP_Get_Filelisting_With_Callback.restype = ctypes.POINTER(LIBMTP_File)
_libmtp.LIBMTP_Get_Tracklisting_With_Callback.restype = ctypes.POINTER(LIBMTP_Track)
_libmtp.LIBMTP_Get_Filetype_Description.restype = ctypes.c_char_p
_libmtp.LIBMTP_Get_Filemetadata.restype = ctypes.POINTER(LIBMTP_File)
_libmtp.LIBMTP_Get_Trackmetadata.restype = ctypes.POINTER(LIBMTP_Track)
_libmtp.LIBMTP_Get_First_Device.restype = ctypes.POINTER(LIBMTP_MTPDevice)
_libmtp.LIBMTP_Get_Playlist_List.restype = ctypes.POINTER(LIBMTP_Playlist)
_libmtp.LIBMTP_Get_Playlist.restype = ctypes.POINTER(LIBMTP_Playlist)
_libmtp.LIBMTP_Get_Folder_List.restype = ctypes.POINTER(LIBMTP_Folder)
_libmtp.LIBMTP_Find_Folder.restype = ctypes.POINTER(LIBMTP_Folder)
_libmtp.LIBMTP_Get_Errorstack.restype = ctypes.POINTER(LIBMTP_Error)
# This is for callbacks with the type of LIBMTP_progressfunc_t
Progressfunc = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_uint64, ctypes.c_uint64)
# ----------
# End Type Definitions
# ----------
class MTP:
"""
The MTP object
This is the main wrapper around libmtp