Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 07-17-2011, 08:37 PM   #16
oneillpt
Connoisseur
oneillpt began at the beginning.
 
Posts: 63
Karma: 46
Join Date: Feb 2011
Device: Kindle 3 (cracked screen!); PW1; Oasis
Quote:
Originally Posted by nickredding View Post
Thanks for that suggestion--I have updated the news.bat file.

I'm not sure what you mean by "user friendly alias" for e-mail addresses. Assuming you are using a server (such as gmail) the parameters in news-set-vars.bat should be set exactly as they are in the Calibre GUI. If you can clarify this for me I'll update the Instructions file.
My "user friendly alias" is "Peter.ONeill@myserver", whereas the less friendly account name is "oneillpt", and only mail sent as "oneillpt@myserver" will be accepted by my server when received through a different ISP. I had set this correctly in Calibre, but without thinking used "Peter.ONeill@myserver" in your batch file rather than "oneillpt". Calibre however has the additional setting "Send email from:", where I had supplied "Peter.ONeill@myserver", so "oneillpt" served to authenticate with my mail server, but the mail arrived at Amazon as from "Peter.ONeill@myserver" when sent by Calibre, the address known to Amazon, rather than as from "oneillpt@myserver", which was not known at Amazon until I added that address too. The mistake was all my own, but an easy one to make when the address was registered at Amazon a while ago.
oneillpt is offline   Reply With Quote
Old 07-18-2011, 12:23 AM   #17
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 327
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
Quote:
Originally Posted by oneillpt View Post
My "user friendly alias" is "Peter.ONeill@myserver", whereas the less friendly account name is "oneillpt", and only mail sent as "oneillpt@myserver" will be accepted by my server when received through a different ISP. I had set this correctly in Calibre, but without thinking used "Peter.ONeill@myserver" in your batch file rather than "oneillpt". Calibre however has the additional setting "Send email from:", where I had supplied "Peter.ONeill@myserver", so "oneillpt" served to authenticate with my mail server, but the mail arrived at Amazon as from "Peter.ONeill@myserver" when sent by Calibre, the address known to Amazon, rather than as from "oneillpt@myserver", which was not known at Amazon until I added that address too. The mistake was all my own, but an easy one to make when the address was registered at Amazon a while ago.
OK thanks, I understand. The news.bat file uses the server account name for both the account ID and the "from" address. I'll update the instructions file to explain that.
nickredding is offline   Reply With Quote
Advert
Old 07-18-2011, 03:40 AM   #18
veezh
plus ça change
veezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beautyveezh does all things with Zen-like beauty
 
veezh's Avatar
 
Posts: 101
Karma: 32134
Join Date: Dec 2009
Location: France
Device: Kindle PW2, Voyage
Thanks, nick -- the fix is working here on XP. It's great finally having a back button that works in periodicals again.
veezh is offline   Reply With Quote
Old 07-18-2011, 04:21 PM   #19
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 327
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
This is probably my last update on this. I have learned that Kindlegen 1.1 handles the masthead images properly as well as descriptions in the "Articles List" view. Why these features vanished with Kindlegen 1.2 I don't know but if you use Kindlegen 1.1 instead you can have them back and I recommend that.

Amazon doesn't distribute Kindlegen 1.1 any more but you can get it here http://www.megaupload.com/?d=IJTAIWYR (I trust this doesn't violate MobileRead's prohibition on uploading apps since it's a link to an external site). The URL is also in the Instructions file. You can also use Kindlegen 1.2 but you won't get masthead images or descriptions in the "Articles List" view.

As before, if you are updating from an earlier Calibre-Kindle, be sure to replace ALL the files in the folder. My thanks to veezh, tylau0, oneillpt and dwanthny for taking the time to help sort out the issues with the earlier versions--I think we have something stable now.
Attached Files
File Type: zip Calibre News Fix v1.5.zip (10.2 KB, 187 views)

Last edited by nickredding; 07-18-2011 at 06:02 PM.
nickredding is offline   Reply With Quote
Old 07-19-2011, 09:19 AM   #20
tylau0
Connoisseur
tylau0 began at the beginning.
 
Posts: 82
Karma: 10
Join Date: Oct 2010
Device: Kindle
You're right. Here I include the windows script of my implementation for completeness. I also change my python code a bit according to what I learn from nickredding's implementation - especially the use of a ending "*" to work around the "bug" that Kindle masthead title skips the last word - that's a very useful observation and a clever fix!

Quote:
Originally Posted by oneillpt View Post
Just a note to say that when your shell script is translated to a .bat file your Linux version runs under Windows 7 too.
Attached Files
File Type: zip calibre-kindlegen-v1_2.zip (28.9 KB, 188 views)

Last edited by tylau0; 07-21-2011 at 01:43 PM.
tylau0 is offline   Reply With Quote
Advert
Old 07-19-2011, 10:06 PM   #21
oneillpt
Connoisseur
oneillpt began at the beginning.
 
Posts: 63
Karma: 46
Join Date: Feb 2011
Device: Kindle 3 (cracked screen!); PW1; Oasis
Quote:
Originally Posted by nickredding View Post
This is probably my last update on this. I have learned that Kindlegen 1.1 handles the masthead images properly as well as descriptions in the "Articles List" view. Why these features vanished with Kindlegen 1.2 I don't know but if you use Kindlegen 1.1 instead you can have them back and I recommend that.

...

As before, if you are updating from an earlier Calibre-Kindle, be sure to replace ALL the files in the folder. My thanks to veezh, tylau0, oneillpt and dwanthny for taking the time to help sort out the issues with the earlier versions--I think we have something stable now.
I have found a few issues still remaining, with solutions for some of these. I'll examine the changes in v1.5 to news-prefix.py (and possibly using kindlegen 1.1) later today to see if they resolve some issues I have found with particular custom recipes, and report on the results, but for now some small issues and solutions:

news.bat: recipes named with embedded blanks cause failure. For example,

news "The Irish Times" -verbose (using "The Irish Times.recipe")

I thought I had solved this, but I've overridden my news.bat, and need to redo the modifications, and have not succeeded yet. Copying the recipe with a new name without embedded blanks solves the problem of course.

update-recipe.py: Two problems may arise. Custom recipes created in Calibre (possibly only for certain versions) may use

class ...(AutomaticNewsRecipe): rather than class ...(BasicNewsRecipe):

(although Calibre 0.8.10 hides this when displaying the recipe, substituting BasicNewsRecipe, the custom recipe in C:\Users\Joe\AppData\Roaming\calibre\custom_recipe s retains AutomaticNewsRecipe unless the recipe is edited and resaved). If custom recipes are copied from ...\custom_recipes, update_recipe.py needs to check for either (BasicNewsRecipe): or (AutomaticNewsRecipe):

Further, custom recipes created in Calibre may start with class, and may not preceed this with any other lines such as "__license__ = 'GPL v3'" or "from calibre.web.feeds.news import BasicNewsRecipe", and in such cases, where the 'c' of class is the first character encountered, update-recipe.py fails.

Both these problems are corrected by the followings lines at the end of editRecipe in update-recipe.py:

Code:
pph_result = re.search(r'\s*def\s+postprocess_html[^(]*\([^)]*\)\s*:',infile_str,re.S|re.I)
        if pph_result:
                infile_str = re.sub(r'def\s+postprocess_html','def orig_postprocess_html',infile_str,re.S|re.I)
                pph_result = re.search(r'\s*def orig_postprocess_html[^(]*\([^)]*\)\s*:',infile_str,re.S|re.I)
                #news_result = re.search(r'\s*class[^(]+\(basicnewsrecipe\)\s*:',infile_str,re.S|re.I)
                news_result = re.search(r'\s*class[^(]+\(((automat)|(bas))icnewsrecipe\)\s*:',infile_str,re.S|re.I)
                if (news_result==None):
                        print "Cannot find news recipe class"
                        return
                if (news_result.start() > 0):
                        outfile_str = infile_str[:news_result.start()+1]+recipe_header_str+\
                              infile_str[news_result.start():news_result.end()+1]+news_prefix_str+\
                              infile_str[news_result.end():pph_result.start()+1]+postprocess_html_frag_str+\
                              infile_str[pph_result.end():]
                else:
                        outfile_str = recipe_header_str+\
                              infile_str[news_result.start():news_result.end()+1]+news_prefix_str+\
                              infile_str[news_result.end():pph_result.start()+1]+postprocess_html_frag_str+\
                              infile_str[pph_result.end():]
        else:
                #news_result = re.search(r'\s*class[^(]+\(basicnewsrecipe\)\s*:',infile_str,re.S|re.I)
                news_result = re.search(r'\s*class[^(]+\(((automat)|(bas))icnewsrecipe\)\s*:',infile_str,re.S|re.I)
                if (news_result==None):
                        print "Cannot find news recipe class"
                        return
                if (news_result.start() > 0):
                        outfile_str = infile_str[:news_result.start()+1]+recipe_header_str+\
                              infile_str[news_result.start():news_result.end()+1]+news_prefix_str+\
                              postprocess_html_str+infile_str[news_result.end():]
                else:
                        outfile_str = recipe_header_str+\
                              infile_str[news_result.start():news_result.end()+1]+news_prefix_str+\
                              postprocess_html_str+infile_str[news_result.end():]
        outfile.write(outfile_str)
        outfile.flush()
        outfile.close()
oneillpt is offline   Reply With Quote
Old 07-20-2011, 07:41 AM   #22
tylau0
Connoisseur
tylau0 began at the beginning.
 
Posts: 82
Karma: 10
Join Date: Oct 2010
Device: Kindle
I've packed my implementation as a Calibre plugin. Have a look here. Enjoy!
tylau0 is offline   Reply With Quote
Old 07-20-2011, 10:45 AM   #23
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 327
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
Quote:
Originally Posted by oneillpt View Post
news.bat: recipes named with embedded blanks cause failure. For example,

news "The Irish Times" -verbose (using "The Irish Times.recipe")

I thought I had solved this, but I've overridden my news.bat, and need to redo the modifications, and have not succeeded yet. Copying the recipe with a new name without embedded blanks solves the problem of course.
I'm not sure how well embedded blanks in file names are going to work. The built in recipes don't use them (if you open up builtin_recipes.zip you'll see this) and if you are using your own custom recipes it's a lot less typing to type something like "news itimes". However, let us know if you find a solution!

Quote:
Custom recipes created in Calibre (possibly only for certain versions) may use class ...(AutomaticNewsRecipe): rather than class ... (BasicNewsRecipe):
Good fix, thanks. I've incorporated this in the attached file.
Attached Files
File Type: zip Calibre News Fix v1.6.zip (10.3 KB, 184 views)
nickredding is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Kindle, periodical] Remember last article selected tylau0 Recipes 29 07-22-2011 02:23 PM
Free (Kindle) Remember Why You Play arcadata Deals and Resources (No Self-Promotion or Affiliate Links) 0 10-04-2010 08:17 PM
Gizmodo article: How To Fix Today's Ebook readers ekaser News 76 04-30-2010 05:10 AM
Kindle Document as Periodical Gideon Amazon Kindle 2 04-23-2008 06:50 PM
Remember Kindle ? yvanleterrible Amazon Kindle 14 09-12-2007 09:05 AM


All times are GMT -4. The time now is 12:51 PM.


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