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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 03-04-2009, 08:42 AM   #1
danwdoo
Groupie
danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.
 
danwdoo's Avatar
 
Posts: 168
Karma: 2584958
Join Date: Jan 2009
Location: Texas
Device: Kindle PW2
Question about Column Sorting

Hello,
I've just started using Calibre and am simply amazed at how good it is. I have a hopefully simple question about column sorting. I have the following column Layout:

Author Series Title

Currently, I can sort by one column only. So while I can make the author's appear in alpha order, then the series column seems fairly random. Is there a way to sort by Multiple columns so I can have authors as first priority, then it sorts series within the authors and then by volume number?

Thanks!
Danny
danwdoo is offline   Reply With Quote
Old 03-04-2009, 09:58 AM   #2
GeoffC
Chocolate Grasshopper ...
GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.GeoffC ought to be getting tired of karma fortunes by now.
 
GeoffC's Avatar
 
Posts: 27,600
Karma: 20821184
Join Date: Mar 2008
Location: Scotland
Device: Muse HD , Cybook Gen3 , Pocketbook 302 (Black) , Nexus 10: wife has PW
Welcome Danny, there will be an expert along shortly ....
GeoffC is offline   Reply With Quote
Advert
Old 03-04-2009, 11:13 AM   #3
WayneD
Enthusiast
WayneD began at the beginning.
 
Posts: 32
Karma: 10
Join Date: Sep 2007
Device: Android phone + PRS-505
I looked at the sorting code in database2.py, and it is always forcing the same secondary sort key if the entries in the requested sort column are the same. This apears to be the "path" data, which essentially gives you a sub-sort of the book title if the author is the same, or author if the title is the same, etc.

What I'd prefer to see is the sort function being allowed to return 0 when items are the same. Because python has a stable sort (one that keeps the current order when the sort term is found to be equal), this would let you choose your sub-sort by whatever column you had clicked previously. If you are comfortable editing source, this is as easy as editing the src/calibre/library/database2.py file, looking for the "def sort" function, commenting out the last 2 lines, and adding "return ans" to the end. The last 3 lines would then look like this:

Code:
        #if ans != 0: return ans
        #return cmp(self._data[x][11].lower(), self._data[y][11].lower())
        return ans
With that done, I can get click series and then author to see a primary sort by author with a sub-sort by series, and then click title and then author to see author with a sub-sort by title, etc.
WayneD is offline   Reply With Quote
Old 03-04-2009, 12:47 PM   #4
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,826
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
will be in next release
kovidgoyal is offline   Reply With Quote
Old 03-04-2009, 02:23 PM   #5
bwaldron
Wizard
bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.bwaldron ought to be getting tired of karma fortunes by now.
 
bwaldron's Avatar
 
Posts: 1,229
Karma: 543210
Join Date: Feb 2008
Location: Gatlinburg, Tennessee
Device: Kindles: Paperwhite Signature Ed., Oasis 2, Voyage
Quote:
Originally Posted by kovidgoyal View Post
will be in next release
Nice!
bwaldron is offline   Reply With Quote
Advert
Old 03-04-2009, 03:24 PM   #6
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
Posts: 5,111
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
Quote:
Originally Posted by kovidgoyal View Post
will be in next release
Awesome. Thanks.
ilovejedd is offline   Reply With Quote
Old 03-05-2009, 04:48 AM   #7
danwdoo
Groupie
danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.danwdoo ought to be getting tired of karma fortunes by now.
 
danwdoo's Avatar
 
Posts: 168
Karma: 2584958
Join Date: Jan 2009
Location: Texas
Device: Kindle PW2
Excellent!
danwdoo is offline   Reply With Quote
Old 03-05-2009, 10:33 AM   #8
WayneD
Enthusiast
WayneD began at the beginning.
 
Posts: 32
Karma: 10
Join Date: Sep 2007
Device: Android phone + PRS-505
Thumbs up one more tweak for the startup

One thing I thought of was that at startup time, we need to do two sorts in order to ensure that the user gets a nice sort order for something like author. The best solution is probably be to remember two most recent sorts the user did and rerun them both when refreshing the book list. Another is to do an initial sort by path and then apply the remembered sort (since that at least gets a remembered author sort to sub-sort by title instead of coming up in whatever order the DB returned the entries).

Code:
--- src/calibre/library/database2.py    2009-03-04 17:46:47 +0000
+++ src/calibre/library/database2.py    2009-03-05 15:21:33 +0000
@@ -256,6 +256,7 @@
         for r in temp:
             self._data[r[0]] = r
         self._map = [i[0] for i in self._data if i is not None]
+        self.sort('path', ascending)
         if field is not None:
             self.sort(field, ascending)
         self._map_filtered = list(self._map)
WayneD is offline   Reply With Quote
Old 03-05-2009, 11:59 AM   #9
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,826
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Doing a double sort on startup would be a major performance hit for people with large libraries. Instead I'll simply have restore the previous behavior for the first sort.
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 column PDF book to 1 column possible? SeaBookGuy Calibre 19 07-01-2013 02:30 AM
Q: multi-column PDF to single column mobi format converstion auburn1975 Calibre 7 01-28-2012 06:11 PM
Question re: sorting by author osirisomeomi Calibre 8 04-14-2010 03:43 PM
Question about sorting on the 360 askyn PocketBook 6 04-05-2010 07:57 PM
pdf to lrf with 2 column and 1 column pages in same file danielwille Sony Reader 3 11-12-2008 10:57 AM


All times are GMT -4. The time now is 04:13 PM.


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