NAME
Device::KOBOeReader - interface with KOBO eReader
SYNOPSIS
use Device::KOBOeReader;
my $kobo = Device::KOBOeReader->new;
$kobo->backup_sql
or die $kobo->error;
my $now_reading = $kobo->get_now_reading_list;
$kobo->finish_book_by_id( map $_->{id}, @$now_reading );
WARNING!!!
This module was implemented by poking through the UNDOCUMENTED innards of a single device. As a result, this code might not work for you, or even cause your device to blow up! Backup your data and use at your own risk.
DESCRIPTION
If you own a KOBO eBook reader, you probably know there's no easy way to get rid of a book on your I'm reading list of books, aside from scrolling past last page, or other methods that at first glance seem complicated.
This module was born out of need to remove some of the (boring) books on my I'm reading list, and that's pretty much the only useful thing it does right now. If you have any extra ideas, submit them as a bug tickets.
METHODS
new
my $kobo = Device::KOBOeReader->new;
my $kobo = Device::KOBOeReader->new( device => '/media/kobo' );
Returns a freshly baked Device::KOBOeReader
object. Takes arguments in a key/value form. Available arguments are as follows:
device
my $kobo = Device::KOBOeReader->new( device => '/media/kobo' );
Optional. Takes a path to the mount point of your KOBO reader. Will croak if the device's SQLite database, located in $device-mount-point$/.kobo/KoboReader.sqlite
, is not found. Defaults to: /media/KOBOeReader
error
$kobo->backup_sql
or die $kobo->error;
Takes no arguments. Returns a human readable string that is the explanation of the error that happened after a call to some of the methods of the object.
backup_sql
$kobo->backup_sql;
$kobo->backup_sql('/tmp/')
or die $kobo->error;
Copies eReader's SQLite file that contains device's guts. Takes one optional argument that specifies the directory where to backup the file. If not specified, defaults to current directory. If an error occurs, returns undef
or an empty list, depending on the context, and the human readable description of the error will be available through error()
method.
get_raw_content
my $raw_content_array_ref = $kobo->get_raw_content;
Takes no arguments. Returns an arrayref that contains all records in device's content
table. Each element of the arrayref is a hashref that represents one row in the table and whose keys are column names.
set_read_status_by_id
$kobo->set_read_status_by_id(
2,
'file:///mnt/onboard/Books-to-Read/Kobo_eReader_User_Guide.epub'
);
Sets the ReadStatus
column in device's content
table to one of three possible values. The row will be identified by ContentID
column.
The method takes two mandatory arguments. First is the ReadStatus
value; where 0
is unfinished book that is not on I'm reading list, 1
is unfinished book that is on the I'm reading
list, and 2
is finished book.
The second argument is the ContentID
of the items whose ReadStatus
you want to change.
set_read_status_by_title
$kobo->set_read_status_by_title(
2,
'Crime And Punishment'
);
Same as set_read_status_by_id()
above, except instead of ContentID
, it uses the value in Title
column that is specified by the second argument.
finish_book_by_id
$kobo->finish_book_by_id(
'cab2c7bb-9c32-4758-b898-d16d05e0ec78',
'file:///mnt/onboard/Digital Editions/Breaking_the_Time_Barrier.epub',
'file:///mnt/onboard/Digital Editions/Multiple_Intelligences.epub',
);
Sets ReadStatus
column to value 2
(finished book) for one or more books identified via their ContentID
column. Takes one or more arguments that represent the ContentID
values of the books.
finish_book_by_title
$kobo->finish_book_by_title(
'Crime And Punishment',
'Breaking the Time Barrier',
'Multiple Intelligences',
);
Same as finish_book_by_id()
above, except will find right items using values in Title
column. These titles is what the method expects as arguments.
get_now_reading_list
my $now_reading_books = $kobo->get_now_reading_list;
# Output:
$VAR1 = [
{
'percent_read' => 22,
'author' => 'Fyodor Dostoevsky',
'id' => 'cab2c7bb-9c32-4758-b898-d16d05e0ec78',
'title' => 'Crime And Punishment'
},
....
];
Takes no arguments. Returns a possibly empty arrayref, each item of which is a hashref that represents one item on your I'm reading list. Each hashref will contain the following keys/values:
id
{
'id' => 'cab2c7bb-9c32-4758-b898-d16d05e0ec78',
...
This is the value of ContentID
column in device's table. This is what *_by_id
methods want.
title
{
'title' => 'Crime And Punishment'
...
This is the value of Title
column in device's table. Represents the title of the item; this is what *_by_title
methods want.
author
{
'author' => 'Fyodor Dostoevsky',
...
This will be the value of Attribution
column in device's table, which, I understand, contains the author of the book/item.
percent_read
{
'percent_read' => 22,
...
Returns a number or an undef
that represents how much of the item you have read (the ___PercentRead
column in device's table).
EXAMPLES
The examples/
directory of this distibution contains a short example script that you can use to selectively mark the books on your I'm reading list as finished.
REQUIRED MODULES
As a balanced diet, this module requires the following modules/versions:
Carp => 1.11,
DBI => 1.609,
DBD::SQLite => 1.29,
File::Copy => 2.14,
File::Spec::Functions => 3.33,
AUTHOR
Zoffix Znet, <zoffix at cpan.org>
(http://zoffix.com/, http://haslayout.net/, http://mind-power-book.com/)
BUGS
Please report any bugs or feature requests to bug-device-koboereader at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Device-KOBOeReader. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Device::KOBOeReader
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
LICENSE AND COPYRIGHT
Copyright 2010 Zoffix Znet.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.