Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
list.
"""
if (self.tracks == None):
self.tracks = ctypes.pointer(ctypes.c_uint32(0))
self.no_tracks += 1
self.tracks[(self.no_tracks - 1)] = value
def __len__(self):
"""
This returns the number of tracks in the playlist
"""
return self.no_tracks
LIBMTP_Playlist._fields_ = [("playlist_id", ctypes.c_uint32),
("parent_id", ctypes.c_uint32),
("storage_id", ctypes.c_uint32),
("name", ctypes.c_char_p),
("tracks", ctypes.POINTER(ctypes.c_uint32)),
("no_tracks", ctypes.c_uint32),
("next", ctypes.POINTER(LIBMTP_Playlist))]
class LIBMTP_Folder(ctypes.Structure):
"""
LIBMTP_Folder
Contains the ctypes structure for LIBMTP_folder_t
"""
def __repr__(self):
return "%s (%s)" % (self.name, self.folder_id)
# ----------
# 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
"""