Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Sony Reader > Sony Reader Dev Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 05-03-2007, 05:34 PM   #31
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
At the moment it looks like I'm going to fork pylrs as I need to make too many changes for html2lrf. Nonetheless, the patches are easily viewable via the source code browser on my website, so if Falstaff wants to backport some of them he is welcome to do so.
kovidgoyal is offline   Reply With Quote
Old 06-04-2007, 06:35 PM   #32
athlonkmf
Guru
athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.athlonkmf ought to be getting tired of karma fortunes by now.
 
Posts: 714
Karma: 1014039
Join Date: May 2007
Device: Sony PRS-500, Sony PRS-505, Kindle 3, Sony PRS350, iPad 64GB
ok, might be stupid, but I'm not familiar with python or phython programs although I do have a linux server with python. So... how do you use this tool?
athlonkmf is offline   Reply With Quote
Advert
Old 06-04-2007, 07:03 PM   #33
EatingPie
Blueberry!
EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.EatingPie puts his or her pants on both legs at a time.
 
EatingPie's Avatar
 
Posts: 888
Karma: 133343
Join Date: Mar 2007
Device: Sony PRS-500 (RIP); PRS-600 (Good Riddance); PRS-505; PRS-650; PRS-350
Python is an interpreted language, similar to Perl in that respect. Or you can think of it as a super duper shell script.

If you have a program called "hellworld.py" you can run it like so:
python helloworld.py
And that's that.

In terms of pylrs, it's a library for converting e-books. It's not a final product, so pylrs itself will not convert books for you. You'd need to write a program that utilizes the pylrs library.

The pylrs library itself comes with some usage examples, so if you want to write a whole program, that's where to start. From a programmer's perspective, it's pretty straight-forward. But if you're not a programmer, this isn't what you're looking for.

And I get the impression that you are, indeed, looking for a finished product for conversion. I am aware of two which utilize pylrs for conversion, and they are fully finished products.

pielrf - A text to LRF (Sony EBook Format) converter. It mimics the look of books you download from the Sony Connect Store, and it's really easy to add chapters, headers, and Tables of Contents. Give you one guess why I know about this one!

https://www.mobileread.com/forums/showthread.php?t=10752

libprs500 - Don't let the name deceive you, it's not ONLY a library -- it has competed programs to do conversion for you as well, plus a number of other features, like transferring LRFs to the Reader via USB. Here's the link to the html2lrf (part of libprs500) discussion:

https://www.mobileread.com/forums/showthread.php?t=10582

If you want a finished product, those are the way to go.

-Pie

Last edited by EatingPie; 06-04-2007 at 07:06 PM.
EatingPie is offline   Reply With Quote
Old 08-04-2007, 12:34 PM   #34
swr2408018
Enthusiast
swr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enough
 
Posts: 35
Karma: 501
Join Date: Jul 2007
Device: PRS-500
pylrs bug with TextBlock(textstyle,blockstyle,blockattr=value)?

When I specify a blockstyle attribute in a TextBlock(), it doesn't appear to have any effect. (I can work around this by creating a new blockstyle with the change.)

It doesn't look like the code does anything with those "overriding" values. E.g.:

self.textSettings = {}
self.blockSettings = {}
for name, value in settings.items():
if name in TextStyle.validSettings:
self.textSettings[name] = value
elif name in BlockStyle.validSettings:
self.blockSettings[name] = value
else:
raise LrsError, "%s not a valid setting for TextBlock" % name

captures the override values in either self.textSettings or self.blockSettings as appropriate, and then

self.textStyle = textStyle
self.blockStyle = blockStyle

# create a textStyle with our current text settings (for Span to find)
self.currentTextStyle = textStyle.copy()
self.currentTextStyle.attrs.update(self.textSettin gs)

copies overriding textStyle values into the currentTextStyle, but there is nothing similar for the overriding blockStyle values.

Am I missing something here?

Thanks!

Steve
swr2408018 is offline   Reply With Quote
Old 08-04-2007, 12:42 PM   #35
swr2408018
Enthusiast
swr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enough
 
Posts: 35
Karma: 501
Join Date: Jul 2007
Device: PRS-500
SmallCap text helper class for pylrs

If you want to reproduce "SmallCaps" support, e.g., SMALLCAPS, here's a class you can add to a project.

I threw this together with pretty limited understanding of python, but it's working well for me in an ebook of a Schiller play where all the names of the parts are in smallcaps. Let me know if I've done anything crazy here?

Thanks!

Steve

class SmallCap(Span):
tagname = "SmallCap"
def __init__(self, text=None):
Span.__init__(self,"")
SmallCap.append(self,text)
def append(self,content):
for i in range(len(content)+1):
if content[i-1:i].islower():
Span.append(self,Span(content[i-1:i].upper(),fontsize=70))
else:
Span.append(self,Span(content[i-1:i],fontsize=100))
swr2408018 is offline   Reply With Quote
Advert
Old 08-04-2007, 01:32 PM   #36
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,866
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There's a much updated version of pylrs in the libprs500 svn that includes a lot of capabilities that the original doesn't have. You should use that.

EDIT: With regard to small caps I think that belongs in application code not pylrs, since it doesn't use any features of LRS at all. It is a neat idea though and I've added small caps to my custom Span class in html2lrf :-) THough with a more efficient implementation (w.r.t. the number of Span classes needed)

Last edited by kovidgoyal; 08-04-2007 at 06:01 PM.
kovidgoyal is offline   Reply With Quote
Old 08-04-2007, 07:43 PM   #37
swr2408018
Enthusiast
swr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enough
 
Posts: 35
Karma: 501
Join Date: Jul 2007
Device: PRS-500
Re Blockstyle in TextBlock

Digging a little more on my own, I verified that the LRS output does contain the overriding TextBlock attrs, so this is very unlikely to be a pylrs issue. I'll post again if I figure out anything more.

Steve
swr2408018 is offline   Reply With Quote
Old 08-04-2007, 07:49 PM   #38
swr2408018
Enthusiast
swr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enoughswr2408018 will become famous soon enough
 
Posts: 35
Karma: 501
Join Date: Jul 2007
Device: PRS-500
Re updated pylrs in prs500 and SmallCap

Thanks, I'd already picked up your changes for making Plot() work properly with imbedded images; I'll look at the rest of your updates.

Agreed that the SmallCap implementation is a hog. I was under the impression that pylrs was filtering out unnecessary tags, but I just realized (while looking through the LRS output to debug the TextBlock/BlockStyle issue on the other thread) that that optimization is still in the "experimental" stage and off by default. I'll have to tighten up my version, given that the ebook I'm working on has hundreds of SmallCap strings.

(And also agreed this is project or sample code, not pylrs code.)

Steve
swr2408018 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pissed off with LRF formatting: LRF/LRS clean tool? grimborg LRF 8 02-15-2010 01:14 PM
How do I Create a Python Plugin? Sydney's Mom Plugins 25 01-27-2010 06:26 AM
Converting LRS to LRF mcortez Sony Reader 1 11-28-2007 11:26 AM
LRS to LRF on Mac OSX - any suggestions? Lime2K Sony Reader 3 07-29-2007 10:15 PM
PRS-500 Span tags in LRS and LRF files -- do I understand them? Falstaff Sony Reader Dev Corner 2 01-31-2007 10:34 AM


All times are GMT -4. The time now is 01:46 PM.


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