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

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

Notices

Closed Thread
 
Thread Tools Search this Thread
Old 07-21-2013, 07:40 PM   #1546
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,305
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
It looks like fanfiktion.de has changed the URLs they use for their own stories a little bit, adding the story name after the chapter number.

Try the attached version, it should works better for you.

UPDATE Jul 23, 2013 - Remove obsolete beta versions

Last edited by JimmXinu; 07-23-2013 at 04:27 PM. Reason: Remove obsolete beta versions
JimmXinu is offline  
Old 07-22-2013, 12:30 AM   #1547
Jade Aislin
Groupie
Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.
 
Posts: 164
Karma: 3100
Join Date: Sep 2011
Device: Kobo Auro H2O, PRS-T1
I have most of the coding done for my end tags, but I had a few questions.

1. In order to get the end tags to the end of a ship when there is more than one end tag, I had to duplicate a couple lines of code.

Code:
 ships=> (\(Family\)|\(Friendship\))(.*?)$=>\2 \1
 ships=> (\(Family\)|\(Friendship\))(.*?)$=>\2 \1 

 ships_LIST=>(\(Family\)|\(Friendship\))( )?(.*?),=>\3 \1,
 ships_LIST=>(\(Family\)|\(Friendship\))( )?(.*?),=>\3 \1,
Is there a way to tell it to redo a line of code until it no longer finds what the code is looking for?

2. When I put in code for putting the end tag at the end for the final ship in the list, I had to delete a space from the code to make it work.
Code:
 ships_LIST=>,(.*?)( \(Family\)| \(Friendship\))/(.*?)$=>,\1/\3\2
 ships_LIST=>,(.*?)(\(Family\)|\(Friendship\))/(.*?)$=>,\1/\3 \2
Originally I tried to put in ( )? to show that the space might not be there.
Code:
ships_LIST=>,(.*?)(( )?\(Family\)|( )?\(Friendship\))/(.*?)$=>,\1/\3 \2
However, I received an unmatched group error when I added the '( )?'.

Is there a way I can streamline these two lines of code?

3. Finally, I used this code to separate end tags into different ships:
Code:
 ships_LIST=>(.*?) \((.*?)\) \((.*?)\),=>\1 (\2), \1 (\3),
 ships_LIST=>,(.*?) \((.*?)\) \((.*?)\)$=>,\1 (\2), \1 (\3)
The first line worked fine and 'A/B (Friend) (Family)' became: 'A/B (Friend), A/B (Family)'.
The second line, however, deleted the second end tag. 'C/D (Friend) (Family)' became: 'C/D (Friend)'.

I'm not sure why it deleted the second end tag. I also tested '\1 (\3), \1 (\2)' and still had the second tag deleted. I'm not really sure how to fix the last line to get the last ship in the list fixed.

Any help would be appreciated.
Jade Aislin is offline  
Advert
Old 07-22-2013, 12:54 AM   #1548
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,305
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Quote:
Originally Posted by Jade Aislin View Post
I have most of the coding done for my end tags, but I had a few questions.

1. In order to get the end tags to the end of a ship when there is more than one end tag, I had to duplicate a couple lines of code.
...
Is there a way to tell it to redo a line of code until it no longer finds what the code is looking for?
No, there isn't. And I'm not inclined to add such a feature. I expect most users would end up creating infinite loops more often than not.

Since you're matching the rest of the entry too, I suspect multiple lines may be as good as it gets.

Quote:
Originally Posted by Jade Aislin View Post
2. When I put in code for putting the end tag at the end for the final ship in the list, I had to delete a space from the code to make it work.
...
Originally I tried to put in ( )? to show that the space might not be there.
...
However, I received an unmatched group error when I added the '( )?'.

Is there a way I can streamline these two lines of code?
Python regex has what is IMHO, a flaw. Unmatched group replacements (\1,\2,etc) instead of being ignore throw exceptions. There's a work around for it--'(| )' I think in this case--and it's been discussed in this thread in past. Google will also find various workarounds and comments.

As for streamlining, instead of two lines, one ending in ", " and one with "$", try "(, |$)".

Quote:
Originally Posted by Jade Aislin View Post
3. Finally, I used this code to separate end tags into different ships:
...
I'm not sure why it deleted the second end tag. I also tested '\1 (\3), \1 (\2)' and still had the second tag deleted. I'm not really sure how to fix the last line to get the last ship in the list fixed.
I suspect that combining them into one line with "(, |$)" will help.
JimmXinu is offline  
Old 07-22-2013, 04:15 AM   #1549
Firedancer885
Occassional Beta Tester
Firedancer885 can teach chickens to fly.Firedancer885 can teach chickens to fly.Firedancer885 can teach chickens to fly.Firedancer885 can teach chickens to fly.Firedancer885 can teach chickens to fly.Firedancer885 can teach chickens to fly.Firedancer885 can teach chickens to fly.Firedancer885 can teach chickens to fly.Firedancer885 can teach chickens to fly.Firedancer885 can teach chickens to fly.Firedancer885 can teach chickens to fly.
 
Posts: 283
Karma: 3516
Join Date: Nov 2010
Location: Hungary
Device: Samsung Galaxy Tab 4 (wifi only)
Quote:
Originally Posted by JimmXinu View Post
It looks like fanfiktion.de has changed the URLs they use for their own stories a little bit, adding the story name after the chapter number.

Try the attached version, it should works better for you.
Yesss
Firedancer885 is offline  
Old 07-22-2013, 07:36 PM   #1550
Jade Aislin
Groupie
Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.
 
Posts: 164
Karma: 3100
Join Date: Sep 2011
Device: Kobo Auro H2O, PRS-T1
Quote:
Originally Posted by JimmXinu View Post
There's a work around for it--'(| )' I think in this case--and it's been discussed in this thread in past. Google will also find various workarounds and comments.
I still seemed to get the unmatched group, but as I was able to get it to work without that, I'll look into this problem later.

Quote:
Originally Posted by JimmXinu View Post
As for streamlining, instead of two lines, one ending in ", " and one with "$", try "(, |$)".

I suspect that combining them into one line with "(, |$)" will help.
That did help. However, I decided not list all the end tags and use (.*?) in my code. Then I added the next end tag and got a strange response in the final ship of the list.

The first line of code works for all other ships. It looks for a word in parenthesis and then places it at the end of the ship.

Code:
 ships_LIST=>\((.*?)\)( )?(.*?),=>\3 (\1),
 ships_LIST=>\((.*?)\)( )?(.*?)$=>\3 (\1)
However the second line, used for the last ship in the list, is moving the parenthesis tag, but it is not getting rid of the original parenthesis. My output goes from 'O (One-Sided) (Family)/P' to 'O (One-Sided) (Family)/P (One-Sided)'.

Is there a reason that the last line of code is moving the tag I want, but is not deleting it from the original position?
Jade Aislin is offline  
Advert
Old 07-22-2013, 09:31 PM   #1551
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,305
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Quote:
Originally Posted by Jade Aislin View Post
Code:
 ships_LIST=>\((.*?)\)( )?(.*?),=>\3 (\1),
 ships_LIST=>\((.*?)\)( )?(.*?)$=>\3 (\1)
However the second line, used for the last ship in the list, is moving the parenthesis tag, but it is not getting rid of the original parenthesis. My output goes from 'O (One-Sided) (Family)/P' to 'O (One-Sided) (Family)/P (One-Sided)'.

Is there a reason that the last line of code is moving the tag I want, but is not deleting it from the original position?
\((.*?)\) matches (non-greedy) (something)

(.*?) matches (non-greedy) anything--including additional (something) strings.

I'd experiment with using something like ([^\(]*?)--match (non-greedy) anything except open paren.

Frankly, there's a lot of trial and error in using complex regular expressions, even for experienced users.
JimmXinu is offline  
Old 07-23-2013, 04:01 PM   #1552
JOJO1
Member
JOJO1 began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Jul 2013
Device: kindle fire and other android
Quote:
Originally Posted by JimmXinu View Post
It looks like fanfiktion.de has changed the URLs they use for their own stories a little bit, adding the story name after the chapter number.

Try the attached version, it should works better for you.


Hi Jimm,

thank you for help.





Perfect!!

Last edited by JOJO1; 07-23-2013 at 04:09 PM.
JOJO1 is offline  
Old 07-23-2013, 04:24 PM   #1553
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,305
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Version 1.7.32 - 23 Jul 2013
  • Fixes for fanfiktion.de & thehexfiles.net, add entries to teststory valid list.
JimmXinu is offline  
Old 07-24-2013, 11:07 AM   #1554
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,305
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Latest version has a bug with saving plugin settings on calibre prior to 0.9.39. This version corrects it.

UPDATE Jul 28, 2013 - Remove obsolete beta versions

Last edited by JimmXinu; 07-28-2013 at 06:02 PM. Reason: Remove obsolete beta versions
JimmXinu is offline  
Old 07-24-2013, 04:09 PM   #1555
JOJO1
Member
JOJO1 began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Jul 2013
Device: kindle fire and other android
FanFiktion.de - wrong Metadatas

Quote:
Originally Posted by JimmXinu View Post
Latest version has a bug with saving plugin settings on calibre prior to 0.9.39. This version corrects it.
Hallo Jimm,

now there is another problem with "fanfiktion.de". The downloader add the right Story, bud the Metadatas are every time from the first Story of the author.

I think i need your help again.
JOJO1 is offline  
Old 07-24-2013, 05:46 PM   #1556
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,305
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Quote:
Originally Posted by JOJO1 View Post
now there is another problem with "fanfiktion.de". The downloader add the right Story, bud the Metadatas are every time from the first Story of the author.
Actually, it's metadata other than title/author (I almost stopped looking when I saw the title/author was correct on each), and it's taking the summary, rating, etc from the last story of the author, not the first.

This is another problem caused by fanfiktion.de changing their URLs to include story name. The attached version should fix it.

UPDATE Jul 28, 2013 - Remove obsolete beta versions

Last edited by JimmXinu; 07-28-2013 at 06:02 PM. Reason: Remove obsolete beta versions
JimmXinu is offline  
Old 07-24-2013, 06:40 PM   #1557
JOJO1
Member
JOJO1 began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Jul 2013
Device: kindle fire and other android
Quote:
Originally Posted by JimmXinu View Post
Actually, it's metadata other than title/author (I almost stopped looking when I saw the title/author was correct on each), and it's taking the summary, rating, etc from the last story of the author, not the first.

This is another problem caused by fanfiktion.de changing their URLs to include story name. The attached version should fix it.


It works perfekt.

Greetings from Germany

Thank You
JOJO1 is offline  
Old 07-25-2013, 06:16 PM   #1558
SallyK
Enthusiast
SallyK began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Aug 2010
Device: Kobo GloHD
I'm having problems with a couple of stories from Stories of Arda (http://www.storiesofarda.com), both by the same author.

http://www.storiesofarda.com/chapter...w.asp?SID=4018 comes up with the error message - 'NoneType' object has no attribute 'find'
whereas http://www.storiesofarda.com/chapter...w.asp?SID=5046 seems to add okay, and you get the book structure with the chapter headings, but no actual text of the story.

I tried http://www.storiesofarda.com/chapter...w.asp?SID=6731 by another author, and it worked fine.

Is it a problem with the website, or is there anything I can do to fix it? Thank you for any help you can give.
SallyK is offline  
Old 07-25-2013, 09:47 PM   #1559
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,305
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Quote:
Originally Posted by SallyK View Post
I'm having problems with a couple of stories from Stories of Arda (http://www.storiesofarda.com), both by the same author.

http://www.storiesofarda.com/chapter...w.asp?SID=4018 comes up with the error message - 'NoneType' object has no attribute 'find'
Interesting. Chapter 8--and only chapter 8--of that story throws out an "are you an adult?" question. We didn't know that site ever required that. I can make the adapter work with that when is_adult is set, but because it's on chapters, it can't stop and prompt the user.

However, for that particular story, that only gets us as far as the next issue:

Quote:
Originally Posted by SallyK View Post
whereas http://www.storiesofarda.com/chapter...w.asp?SID=5046 seems to add okay, and you get the book structure with the chapter headings, but no actual text of the story.
Both this and the story above have extra <body> tags inside the story HTML that's confusing the parser. That's a problem with the HTML as uploaded by the author. But it's one I've seen before on other sites, and I've applied the same fix.

However, I need you to test several stories by other authors on storiesofarda.com to make sure it didn't break any of them. (I don't read storiesofarda.com.)

Attached is a test version with fixes.

UPDATE Jul 28, 2013 - Remove obsolete beta versions

Last edited by JimmXinu; 07-28-2013 at 09:42 PM.
JimmXinu is offline  
Old 07-26-2013, 03:27 PM   #1560
SallyK
Enthusiast
SallyK began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Aug 2010
Device: Kobo GloHD
Thank you very much for getting on it so promptly. I've tried your version with the stories I already listed, and several others from the archive by different authors, and they all seem to be fine. (I haven't read every word, but I've scrolled through them and not seen any errors.)
SallyK is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Count Pages kiwidude Plugins 1750 04-07-2024 01:20 AM
[GUI Plugin] Open With kiwidude Plugins 403 04-01-2024 08:39 AM
[GUI Plugin] Resize Cover kiwidude Plugins 95 03-16-2024 11:55 PM
[GUI Plugin] Find Duplicates kiwidude Plugins 1096 03-16-2024 11:28 PM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 05:12 AM.


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