Thread: calibredb list
View Single Post
Old 10-12-2011, 10:57 AM   #7
iomari
Zealot
iomari doesn't litteriomari doesn't litter
 
Posts: 146
Karma: 100
Join Date: Aug 2003
Location: Nigeria
Device: galaxy tab
Starson17 I just finished this quick and dirty script and it works. However I'll look at the routines you wrote and see it I can use them instead.

Ok, here is my first draft. It works exactly the way I want. Unfortunately I'm just starting with python so I wrote it in Perl first then i'll port it later tonight. If anyone can improve on this please do so: (of course you'll change the variables as needed"
Let me also say that running this takes a very long time as it scans through the database for each format. I presently have 1300 books.

#!/usr/bin/perl
my $dfolder = "/temp2/iomari/all" ;
my $lfolder = "/home/iomari/calibre_library/iomari/" ;
my $database = "metadata.db" ;
my @format = `sqlite3 $lfolder$database \"select \* from data\;\" | cut -d \"|\" -f 3 | sort | uniq` ;
my $dest = "/temp2/all/iomari" ;
my $buff ;

print "\ndeleting previous backed up books................." ;
`rm -rf $dest."/*"` ;
print "\n" ;
for $buff (@format)
{
chomp($buff) ;
print "exporting $buff files..............\n" ;
print "calibredb export --formats=$buff --template=\"$buff/{#supercat}/{tags}/{authors}/{title} - {authors}\" --to-dir=$dest --to-lowercase --all\n" ;
system "calibredb export --formats=$buff --template=\"$buff/{#supercat}/{tags}/{authors}/{title} - {authors}\" --to-dir=$dest --to-lowercase --all" ;
}
print "\nfinished\n" ;
exit ;

Last edited by iomari; 10-12-2011 at 11:02 AM.
iomari is offline   Reply With Quote