Media::LibMTP::API - Low-level interface to libmtp
This document describes version 0.03 of Media::LibMTP::API, released July 4, 2012 as part of Media-LibMTP-API version 0.03.
use Media::LibMTP::API qw(Get_First_Device); my $device = Get_First_Device() or die; say $device->Get_Friendlyname;
Media::LibMTP::API provides a low-level interface to libmtp (http://libmtp.sourceforge.net), which is an Initiator implementation of the Media Transfer Protocol (MTP) in the form of a library suitable primarily for POSIX compliant operating systems.
libmtp is not included with Media::LibMTP::API; you must install it separately.
Media::LibMTP::API is a thin wrapper around libmtp. It follows the libmtp API closely, even when that's not very Perlish. For example, many functions return 0 on success. Media::LibMTP will be a higher-level, more Perl-like interface built on top of Media::LibMTP::API, but it's not yet ready for release. You can follow or help with Media::LibMTP's development at https://github.com/madsen/media-libmtp.
This module is not well documented. Consult the libmtp documentation (which can be generated by Doxygen, and should have been installed along with libmtp). All functions that take a pointer to a libmtp struct as their first parameter are implemented as a method on the corresponding Perl object. Not all functions are currently implemented; consult the source for details.
Many libmtp functions return a linked list of structures. In Media::LibMTP::API, you get the next struct by calling an accessor method. You must preserve the reference to the first struct returned by libmtp until you are done with all the structures in the list, because when that reference is dropped, the entire list will be deleted. This is the purpose of the AlbumList, FileList, FolderList, MTPDeviceList, PlaylistList, and TrackList subclasses: they have a destructor that cleans up the list. For example, the
Get_Album_List method returns an AlbumList object (a subclass of Album), but
$album->next returns an Album object.
The libmtp documentation generated by Doxygen.
Media::LibMTP::API requires no configuration files or environment variables.
libmtp 1.1.0 or later
No bugs have been reported.
Christopher J. Madsen
<perl AT cjmweb.net>
Please report any bugs or feature requests to
<bug-Media-LibMTP-API AT rt.cpan.org> or through the web interface at http://rt.cpan.org/Public/Bug/Report.html?Queue=Media-LibMTP-API.
You can follow or contribute to Media-LibMTP-API's development at http://github.com/madsen/media-libmtp-api.
This software is copyright (c) 2012 by Christopher J. Madsen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.