Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 07-26-2012, 03:11 AM   #1
deufeufeu
Junior Member
deufeufeu has a complete set of Star Wars action figures.deufeufeu has a complete set of Star Wars action figures.deufeufeu has a complete set of Star Wars action figures.deufeufeu has a complete set of Star Wars action figures.deufeufeu has a complete set of Star Wars action figures.
 
Posts: 1
Karma: 462
Join Date: Jul 2012
Device: Kobo Touch
Python script for building shelf automatically

Hi,
I just got a new Kobo Touch yesterday but the shelves feature seemed broken by the fact that I couldn't do a "check all" while searching to add books.
So I wrote a python script that will build shelves based on the directory in which your ebooks are located. For example if you have all IronThrones books in the folder /mnt/onboard/IronThrones it will make a shelf named IronThrones with all books of this folder added.
The script is here http://pastebin.com/hX2kqQ9b .
I don't have time to explain how to make it works, but I'm sure those having rooted their kobos will have no problem.
deufeufeu is offline   Reply With Quote
Old 01-05-2013, 03:59 PM   #2
DigitalWarS
Junior Member
DigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a Texan
 
Posts: 6
Karma: 18180
Join Date: Jan 2013
Device: Kobo Glo
GREAT JOB!

Anyone checked this out? This is a great feature I've been hoping for...
Yet.. I'm a newbie...
I'd need some help. Anyone available ?
DigitalWarS is offline   Reply With Quote
Old 01-05-2013, 06:54 PM   #3
ewphoenix123
Groupie
ewphoenix123 understands when you whisper 'The dog barks at midnight.'ewphoenix123 understands when you whisper 'The dog barks at midnight.'ewphoenix123 understands when you whisper 'The dog barks at midnight.'ewphoenix123 understands when you whisper 'The dog barks at midnight.'ewphoenix123 understands when you whisper 'The dog barks at midnight.'ewphoenix123 understands when you whisper 'The dog barks at midnight.'ewphoenix123 understands when you whisper 'The dog barks at midnight.'ewphoenix123 understands when you whisper 'The dog barks at midnight.'ewphoenix123 understands when you whisper 'The dog barks at midnight.'ewphoenix123 understands when you whisper 'The dog barks at midnight.'ewphoenix123 understands when you whisper 'The dog barks at midnight.'
 
Posts: 159
Karma: 42238
Join Date: Oct 2012
Device: PRS-500, PRS-700, PRS-650, PRS-T1, Kobo Glo, Kobo Aura HD
If you don't know what to do with this, you should probably just use calibre.

http://www.mobileread.com/forums/sho...d.php?t=193184

Very userfriendly and gives you the same result.
ewphoenix123 is offline   Reply With Quote
Old 01-11-2013, 05:52 PM   #4
DigitalWarS
Junior Member
DigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a TexanDigitalWarS might easily be mistaken for a Texan
 
Posts: 6
Karma: 18180
Join Date: Jan 2013
Device: Kobo Glo
Quote:
Originally Posted by ewphoenix123 View Post
If you don't know what to do with this, you should probably just use calibre.

http://www.mobileread.com/forums/sho...d.php?t=193184

Very userfriendly and gives you the same result.
Thank you very much for the advice, I'll try!
DigitalWarS is offline   Reply With Quote
Old 01-30-2013, 08:52 AM   #5
jkgeyti
Member
jkgeyti is a marvel to beholdjkgeyti is a marvel to beholdjkgeyti is a marvel to beholdjkgeyti is a marvel to beholdjkgeyti is a marvel to beholdjkgeyti is a marvel to beholdjkgeyti is a marvel to beholdjkgeyti is a marvel to beholdjkgeyti is a marvel to beholdjkgeyti is a marvel to beholdjkgeyti is a marvel to behold
 
Posts: 17
Karma: 11628
Join Date: Oct 2012
Device: Kobo Touch
I'm having trouble running this on the kobo touch:

Quote:
Traceback (most recent call last):
File "build-shelves.py", line 1, in <module>
import sqlite3
File "/mnt/onboard/.python/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/mnt/onboard/.python/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named _sqlite3
I've installed python 2.7 from the KoboWeather download
I've tried downloading a couple of armel sqlite libs, but nothing that made any difference. Can anyone help me getting sqlite to run?

Thanks in advance
jkgeyti is offline   Reply With Quote
Old 06-10-2013, 07:42 PM   #6
evgeniy
Junior Member
evgeniy began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Sep 2010
Device: Kindle 3, Aura HD
This script works on Kobo Aura HD ?
evgeniy is offline   Reply With Quote
Old 06-10-2013, 08:52 PM   #7
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 7,192
Karma: 45329895
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
Should do; in effect all Kobo eReaders use the same basic software. But many people find using calibre to manage shelves a lot easier.
PeterT is online now   Reply With Quote
Old 01-27-2014, 10:59 AM   #8
lormac
Junior Member
lormac began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jan 2014
Device: kobo glo
wasn't working for kobo glo, I had to tweak it a little bit, here it is:

#!/usr/bin/python

import sqlite3

conn = sqlite3.connect('KoboReader.sqlite')

c = conn.cursor()

c.execute('''SELECT DISTINCT BookID FROM content''')

import re
re_path = re.compile(r'^file:///mnt/(?P<dev>[^/]*)/(?P<path>.*)/(?P<filename>[^/]*)$')
#(r'^file:///mnt/(?P<dev>)([^/]?P<path>)([^/]?P<filename>)$')
#(r'^file:///mnt/(?P<dev>[^/]*)/(?P<path>.*)/(?P<filename>[^/]*)$')

def splitpath(p):
m = re_path.match(p)
# print('qui',m)
return (m.group('dev'), m.group('path'), m.group('filename'))

database = {}
for v in c.fetchall():
p = v[0]
if p and p.startswith('file:///mnt/'):
dev, dirpath, filename = splitpath(p)
print(dev , dirpath , filename)
if (dev,dirpath) not in database:
database[(dev,dirpath)] = []
database[(dev,dirpath)].append(filename)

for dev,dirpath in database:
shelf = dirpath.replace('/','_')
print('shelf',shelf)
c.execute("SELECT * FROM Shelf WHERE InternalName='prova'")
print(c.fetchone())
c.execute("SELECT * FROM Shelf WHERE InternalName='%s'" % shelf)
temp = c.fetchone()
print(temp)
if temp is None:
c.execute("INSERT INTO Shelf VALUES ('2014-01-27T15:09:57Z', '%s', '%s', '2014-01-27T15:09:57Z', '%s', NULL, 'false', 'true', 'false')" % (shelf,shelf,shelf))
c.execute("SELECT * FROM Shelf WHERE InternalName='%s'" % shelf)
for f in database[(dev,dirpath)]:
fullname = u'file:///mnt/%s/%s/%s' % (dev,dirpath,f)
fullname = fullname.replace("'","''")
c.execute("SELECT * FROM ShelfContent WHERE ShelfName='%s' AND ContentId='%s'" % (shelf, fullname))
r = c.fetchone()
print(r)
if r is None:
c.execute("INSERT INTO ShelfContent VALUES ('%s','%s','2014-01-27T15:09:57Z','false','false')" % (shelf,fullname))

conn.commit()
c.close()
lormac is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to automatically populate a tag with the decade from the pubdate via python smoothrolla Library Management 5 11-19-2011 07:41 AM
how to use python script with windows xp tuufbiz1 Other formats 12 01-08-2011 09:22 AM
How do I get a shortcut for a Python script onto the taskbar in W7? Sydney's Mom Workshop 6 03-28-2010 09:11 PM
Nedd a little help with a python script gandor62 Calibre 1 08-07-2008 10:59 PM
Python script to create collections gwynevans Sony Reader Dev Corner 2 03-13-2008 01:29 PM


All times are GMT -4. The time now is 03:05 PM.


MobileRead.com is a privately owned, operated and funded community.