Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 01-04-2012, 07:20 AM   #331
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Quote:
Originally Posted by davidfor View Post
I can see the problem, but I think the lists need to be refreshed when these actions are taken (add, remove and move) from the menu.
In terms of the moving between lists, the issue is "what" gets refreshed. Because depending on what the user is mentally thinking, it could be different. For instance, if they are thinking "I really want to have these books off of list A onto list B", then they may want to see list B after the action to see what list B now looks like. OTOH they may have had list A visible, and now want the refresh of list A done to prove the books are no longer on that list and prevent errors like you mention. And then there is the other twist where they may now be viewing a list at all, but they happen to know a book is on list A based on tags or whatever so they select/move it - in which case viewing a list is going to switch context completely which is likely undesired.

I was being lazy the other night when I just ripped out the list viewing as the "easy" answer. I think the best compromise I can do is that if the user is currently viewing the source list, then that source list gets refreshed. Otherwise no list gets viewed.

Quote:
OK, after reading all this code and discussing it a little here, I feel myself dropping into code review mode. Here are the suggestions I would be making if this was shown to me at work:
I appreciate the input. As I have said far more than once here I know sod-all about Python (never used it before Calibre), and since my plugins are only a part-time exercise out of personal interest that have intermittent spurts of activity sometimes many months apart they tend to grow fairly organically. I hate Eclipse/Pydev with a passion for the utter lack of decent refactoring and testing tools I take for granted in the .NET world I do my day job in. So my care factor in making code changes for anything other than major functional reasons usually gets tempered by how many precious spare time hours I have to spend doing endless code&fix cycles and manually re-testing everything.
Quote:
- Separate the database and GUI updates. This will help with exposing methods as part of the API as it means that no unexpected side-effects will happen. And, looking at it, the remove and add methods, probably shouldn't be interacting with the GUI in any way.
I agree that separating would be nice, and there is definitely some copy/paste code that could be factored out. However it all comes at a "price" of lots more parameters you have to pass around the place and return from functions, since the gui updates need to have information about the books that were updated etc. There is also the complication of where gui warnings etc can occur part way through a function. Refactoring that is a royal *pita*. you end up with numerous "bitty" methods and huge parameter lists, creating future maintenance issues. It's a case of whether the hours of pain justify the effort .

As for the add/remove methods, well they do need to interact with the gui because the user could have tags/custom column rules applied to their list add/remove operations. In the case of an external plugin calling reading_list, they will have to take responsibility for doing those updates on screen. Otherwise what happens is the user sees no "effect" of doing the add/remove operation until they refresh their search or move up/down the row.
Quote:
- For errors in the database/API methods, raise exceptions for the errors. These can be caught and handled by the calling code.
If I was writing a .NET application I would 100% agree with you. However from the countless hours of looking through the Calibre code, an exception raising based approach is just not that common. Now whether that is just Kovid's preference, or a "Python thing" I don't know. I'm sure as heck not going to try to start a revolution by trying to write my code differently to how the rest of Calibre works - writing these plugins is hard enough as it is
kiwidude is offline   Reply With Quote
Old 01-12-2012, 02:32 PM   #332
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,335
Karma: 3966377
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
@kiwidude, I'm working on using Reading List from FanFictionDownLoader now.

It's been working great with the test version you posted here. Do you plan to release it as the official version anytime soon?

Thanks,
Jim
JimmXinu is offline   Reply With Quote
Advert
Old 01-12-2012, 03:28 PM   #333
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
v1.4.1 Released

Changes in this release:
  • Refactor some methods to expose the ability to add/remove from lists from other plugins
kiwidude is offline   Reply With Quote
Old 01-12-2012, 05:13 PM   #334
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,335
Karma: 3966377
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Thanks!
JimmXinu is offline   Reply With Quote
Old 01-13-2012, 09:28 AM   #335
weirichk
Member
weirichk began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Sep 2009
Device: PRS 300
@kiwidude - I tried displaying this list but it doesn't hold the reading order. If you get bored and feel like working on it I would be happy to be a tester. As for the output I don't really care - as far as I am concerned Calibre can take care of reading formats. For now I can manually create a reading list file and import that into Calibre as a book.

Sincerely,
Kurt

Quote:
Originally Posted by kiwidude View Post
@weirichk - no it isn't something you are failing to find. It's an idea that has been tossed around a couple of times in this thread (mainly by me) but no real clamouring of demand to justify the effort.

You could perhaps view the list in Calibre and then produce a catalog using the existing catalog feature, though I haven't tried it. My guess would be that it might lose the reading list sort order.

I agree that ultimately it would be nice for the plugin to have an option for a list that when synced it sends a special book to your device which contains the equivalent of a catalog but in reading list order. Maybe I'll get to it one day... I don't know enough about the catalog code in Calibre at the moment though to know what if any I could reuse. And last time this idea got thrown around someone started talking about how they wanted the ability to customise the output etc - it all starts becoming a bit of a beast.
weirichk is offline   Reply With Quote
Advert
Old 01-13-2012, 10:46 AM   #336
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Yeah I suspected the catalog feature would apply its own sorting, oh well, worth a punt.

Like I said, it is on the todo list to look at one day, as I dont use the catalog feature myself I know very little about it. Not that I expect there to be a direct code reuse, but its the same sort of principle - given a bunch of books from the calibre database, produce an html file output.

Where it all starts getting messy is with timings and output formats etc. For instance...
  • At what point does the plugin produce this special reading list book?
  • Is it manually triggered, or should it only happen when the list is synced?
  • There are all sorts of potential implications concerning job chaining etc - generating the list, converting it to desired format, putting it on the device.
  • Does this special reading list book have to be a book in your library to be sent (I would presume so) and if so how is it named/managed, what if multiple lists, what if user manually deletes etc.
  • Perhaps the user should be forced to specify the output format as part of configuring a list, like I assume they may do with a catalog.
  • What happens if you have set your list to clear when synced - is that an incompatible combination for the option of generating a special ordered book
  • What information does this book need to contain - sufficient just to put text of title/author/series?
That's just off the top of my head, undoubtedly there are many more things that will come out of the woodwork. If anyone has thoughts they are welcome, otherwise it is going to stay on the todo list for a while longer.

One of those features I wouldn't use myself hence lacking motivation really. I found I tend to be flexible when it comes to deciding what to read next - I stick a subset of just several hundred books on my Kindle at a time, topping it up every now and then with new ones that sound interesting as I remove the read ones. But deciding what I will actually read next for me is on a whim - if the first book of a series grabs me then I'll probably read more from it sequentially ("Hunger Games" has me turning pages frantically at the moment). OTOH prior to that I read "Master & Commander" by Patrick O'Brian which I found a far less riveting read, so the allegedly better follow-up books are way down my mental priority list now. I try not to OD on any one genre by randomly rotating through based on what I feel like, and since I average reading around 20 books a month its not essential I force an order upon myself.

But that's just my personal style, and I completely respect the desire of others to have a visual reminder to themselves of particular books they are looking forward to reading, it is all part of the fun...
kiwidude is offline   Reply With Quote
Old 01-13-2012, 11:51 PM   #337
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,335
Karma: 3966377
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
@kiwidude - I'm looking at how to configure my plugin to use Reading Lists and could use some advice, or a pointer where to ask.

In my plugin action, I can get a ref to ReadingListAction from self.gui.iactions['Reading List']. But what's the best way to get a ref to ReadingListAction from inside my config widget?

I can assign it to a variable imported from the config file myself in the action's genesis() method, but is there a better, sanctioned approach to get it?

Thanks,
Jim
JimmXinu is offline   Reply With Quote
Old 01-14-2012, 06:03 AM   #338
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
I would never say "officially sanctioned" but the way I have always done this through my plugins is to pass self.actual_plugin_ into my ConfigWidget constructor, from the config_widget() function in __init__.py. That gives you access to your Action class from the ConfigWidget class, so of course you can then access the .gui variable on it. You can see the code in ReadingList and most of my plugins for that passing.

That is what I use, but if you don't need the action class for other reasons then there is also another way Kovid made available some months ago, by doing this:
Code:
    from calibre.gui2.ui import get_gui
    gui = get_gui()
kiwidude is offline   Reply With Quote
Old 01-14-2012, 04:13 PM   #339
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,335
Karma: 3966377
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Thanks, those are both a lot cleaner than what I'd come up with.
JimmXinu is offline   Reply With Quote
Old 01-20-2012, 08:17 AM   #340
weirichk
Member
weirichk began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Sep 2009
Device: PRS 300
@kiwidude - I understand you point and your reading style. From my point of view where it could be of great benefit is when I have a series of books that are read in order (or I want to read in order). Usually I find I don't remember which book comes after which, so I end up opening up books looking for the publication date or list in the front of the ebook. Otherwise I am like you; when I finish a book I pick the next one based on a variety of factors.

Sincerely,
-Kurt

Quote:
Originally Posted by kiwidude View Post
Yeah I suspected the catalog feature would apply its own sorting, oh well, worth a punt.

Like I said, it is on the todo list to look at one day, as I dont use the catalog feature myself I know very little about it. Not that I expect there to be a direct code reuse, but its the same sort of principle - given a bunch of books from the calibre database, produce an html file output.

Where it all starts getting messy is with timings and output formats etc. For instance...
  • At what point does the plugin produce this special reading list book?
  • Is it manually triggered, or should it only happen when the list is synced?
  • There are all sorts of potential implications concerning job chaining etc - generating the list, converting it to desired format, putting it on the device.
  • Does this special reading list book have to be a book in your library to be sent (I would presume so) and if so how is it named/managed, what if multiple lists, what if user manually deletes etc.
  • Perhaps the user should be forced to specify the output format as part of configuring a list, like I assume they may do with a catalog.
  • What happens if you have set your list to clear when synced - is that an incompatible combination for the option of generating a special ordered book
  • What information does this book need to contain - sufficient just to put text of title/author/series?
That's just off the top of my head, undoubtedly there are many more things that will come out of the woodwork. If anyone has thoughts they are welcome, otherwise it is going to stay on the todo list for a while longer.

One of those features I wouldn't use myself hence lacking motivation really. I found I tend to be flexible when it comes to deciding what to read next - I stick a subset of just several hundred books on my Kindle at a time, topping it up every now and then with new ones that sound interesting as I remove the read ones. But deciding what I will actually read next for me is on a whim - if the first book of a series grabs me then I'll probably read more from it sequentially ("Hunger Games" has me turning pages frantically at the moment). OTOH prior to that I read "Master & Commander" by Patrick O'Brian which I found a far less riveting read, so the allegedly better follow-up books are way down my mental priority list now. I try not to OD on any one genre by randomly rotating through based on what I feel like, and since I average reading around 20 books a month its not essential I force an order upon myself.

But that's just my personal style, and I completely respect the desire of others to have a visual reminder to themselves of particular books they are looking forward to reading, it is all part of the fun...
weirichk is offline   Reply With Quote
Old 01-20-2012, 08:25 AM   #341
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@weirichk - can you not use the "series" capabilities of calibre to give you the books presented in reading order? I know it only works on books that are defined in a series, but I have heard of people creating a fake series just so they could read standalone novels in published order. I don't know anything about Sony devices, but I would "assume" it is possible to have books listed in series order. On a Kindle at least this is done using metadata plugboards...
kiwidude is offline   Reply With Quote
Old 01-20-2012, 08:57 AM   #342
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,552
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
On the Sony it is even easier if you set the Sony Device driver to create Collections from Series (which is actually a default setting anyway). No need for the complexity of metadata plugboards.
itimpi is offline   Reply With Quote
Old 01-21-2012, 05:15 AM   #343
mikaelalind
Fanatic
mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.
 
mikaelalind's Avatar
 
Posts: 590
Karma: 788068
Join Date: Sep 2009
Location: Sweden
Device: Sony PRS 505, Cybook Odessey
Last week, I had to reformat the main memory on my Sony, and now the Reading List plugin doesn't sync with it. I tried to delete, and re-add device. I have checked the settings to see if something changed. Nothing helps. It still doesn't sync.
mikaelalind is offline   Reply With Quote
Old 01-21-2012, 05:38 AM   #344
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@mikaelalind - reformatting the device will erase the identifier file that calibre puts onto it when first plugged in. This plugin matches against that same identifier to identify a device, and each list is associated because of it.

So you will need to remove the "old" device as the plugin knows it, and add the device again (which it sounds like you have done). However did you also for each list make sure it has your "new" device associated with it? My guess is that the lists are pointed to your old device id, not the new one.

If you still can't get it to work, post or PM me your Reading List.json file from your calibre plugins folder. If you still can't get it to work, try creating a new list and seeing if that does. Absolute worst case, just delete/rename the Reading List.json file and recreate your lists again, but you should not need to do that.
kiwidude is offline   Reply With Quote
Old 01-21-2012, 01:00 PM   #345
mikaelalind
Fanatic
mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.mikaelalind ought to be getting tired of karma fortunes by now.
 
mikaelalind's Avatar
 
Posts: 590
Karma: 788068
Join Date: Sep 2009
Location: Sweden
Device: Sony PRS 505, Cybook Odessey
I deleted the old list , Kiwidude, and now the sync works again
mikaelalind is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Extract ISBN kiwidude Plugins 532 04-07-2024 11:01 AM
[GUI Plugin] Open With kiwidude Plugins 403 04-01-2024 08:39 AM
[GUI Plugin] Manage Sony x50 Reader Book List kpw Plugins 170 10-02-2014 08:23 PM
[GUI Plugin] Temp Marker kiwidude Plugins 41 10-14-2013 12:25 AM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 02:22 PM.


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