View Single Post
Old 01-28-2017, 06:52 AM   #1021
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 18,238
Karma: 27110506
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
New beta - Add support for downloading page count from other sites

Attached is a beta to add support for downloading the page count from sites other than Goodreads. This was prompted by BeckyEbook's work to add Lubimyczytac.pl. While doing this, I have needed to add extra options for the page count download and I have reorganised the configuration dialog to two tabs. The download options and the general options are on the second tab.

I have also included Nicolas F's French translation.

I have attached a screenshot of the new configuration options. These are:
  • A list of available sites to download the page count from. The list has:
    • A checkbox to make the site "active".
    • The order of the list is the order sites will be search.
    • The arrows next to the list are used to reorder the sites.
  • Under the list are some options for the menu and the search:
    • "Show download from all sources menu item" - This adds a menu option to try to download the page count from all the sources.
    • "Only show active download source in the menu" - If this is checked, only the download sources marked as "Active" will be displayed in the menu.
    • "Try to download page count from each source" - If this is not checked, when the "all sources" option is used, the sources marked as "Active" will not be used.

I'd like to think the options above make it obvious how this works. But, I'm sure it doesn't And I am very happy to hear suggestions on how to better phrase the options and the tooltips.

What these options give are the following modes for getting a page count:
  • Estimate from the book. This is the same as current option.
  • Download the page count from a specific web site. At the moment, this is Goodreads and lubimyczytac.pl.
  • Download the page count from any of the sites.
  • Download the page count from any of the "active" sites.

For both of the last two options, the sites will be checked in the order the are listed at the top of the configuration. The site will only be checked if the book has an identifier for the site, and once a page count has been retrieved, no more sites will be checked.

So, if you have the sites in the order lubimyczytac.pl, Goodreads:
  • If a book has an identifier for both sites, when doing an all sources fetch, lubimyczytac.pl will be checked first. If the page count is found, Goodreads is not used. If the page count is not found on lubimyczytac.pl, the Goodreads is used.
  • If a book only has the identifier one of the sites, when doing an all sources fetch, only that site will be used for that book.

This should give plenty of flexibility in how to choose where to fetch the page counts from.

As you can see, this beta only has two sites. I have tried to do this in a way that adding more sites is easy. The information I need to do this is:
  • Site URL with an indication of where the identifier goes. For Goodreads this is: "http://www.goodreads.com/book/show/%s". The "%s" is where the identifier goes.
  • The path through the page source for page count is. For Goodreads this is: "//div[@id="details"]/div[@class="row"]/span[@itemprop="numberOfPages"]/text()". It's not that scary. The main thing I need to know is where on the page the page count is and the surrounding tags.
  • A name.
  • The identifier name.

As always, if anyone has a problem with the beta, please report them here in as much detail as possible. And any suggestions for better labels for the options will be gratefully received. I'm particularly unhappy with "Active" in the site list, but I can't come up with anything better. "Enabled" isn't right either.
Attached Thumbnails
Click image for larger version

Name:	Beta-ExtraDownloads.jpg
Views:	151
Size:	47.5 KB
ID:	154562  
Attached Files
File Type: zip Count Pages-beta.zip (283.1 KB, 86 views)
davidfor is offline   Reply With Quote