Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Archives AlphaNumeric Sorting

Help
Doki
2009-04-24
2013-05-23
  • Doki
    Doki
    2009-04-24

    Hi :)
    First of all I'd like to thank you for Comix, witch is the best comics viewer I've tested so far.
    But I still have a little problem ^^
    It seems there is no alphanumeric sort done for archives. Just a little example here :

    While reading Manga_1.cbr and auto opening next  archive, it comes with Manga_10.cbr instead of Manga_2.cbr

    I noticed that images are correctly sorted so I dived (not too deeply yet ^^) into the source code and found at the end of filehandler.py the following:

         def alphanumeric_sort(filenames):

    So what is preventing you from using the same sorting function on archives names ?

    Even if I'm a noob in python I will try by myself, but I just liked to have your opinion on this before getting in trouble for nothing ^^

    thanks ^^

     
    • Doki
      Doki
      2009-04-26

      Well just as I thought, using alphanumeric_sort(files) instead of files.sort(...) in _open_previous_archive(self): and _open_next_archive(self): (filehandler.py) just did the trick.
      I did not try it for library display, wich still appears uncorrectly sorted, but will try soon ^^

       
    • Pontus Ekberg
      Pontus Ekberg
      2009-05-01

      You are right in that alphanumeric_sort() is only used for files inside archives, while separate files in the filesystem are sorted according to the LC_COLLATE environmental variable.

      Unfortunately there is no solution to this problem that is best in all cases. In a perfect world, the system settings (with LC_COLLATE) should reflect the way the user wants the files sorted, and it should also be how file managers sort the files. So, for separate files, sorting according to the actual settings is the best we can do (though it some times isn't actually what the user wants or expects, the reasoning is that it most often is). For files within archives it is not certain that the person creating the archive use the same sorting scheme as the one reading them, why the "best" option is to sort according to the most common (alphanumeric) sorting scheme, which gets it right most of the time.

      The proper thing to do is actually to name files as *01.ext, *02.ext, 03.ext, ..., *10.ext, *11.ext, ... That way basically all common sorting orders get them in the same order.

       
    • Doki
      Doki
      2009-05-02

      Well, thank you for the LC_COLLATE, but just as I told before, I already modified comix to use the alphanumeric for archives.
      I understand why you choose the way you explained, but why not letting the choice to users in options?
      Would be easier for most of us to tick an option in comix, than dealing with environmental variable ^^
      And I think it's still a better way to use alphanumeric sorting than (re)naming all archives accordingly.
      What if you start naming a manga/comic like : whatever-0#.cbr ? It will be ok until it reach the 100th chapter! Then you'll have to rename the whole serie ^^ Well you can also start naming it prepending with 00 , most series won't ever reach  the 1000th chapter but then any series ending before 100 chapters will have useless prepending zeros (Yes there is a lot worst things in the world, and yes I'm a bit of a maniac ^^)
      And to finish pleading my cause I'll had that the only person I know using comix preferred my modified version, so I guess there are somewhere other users who would be happy seeing such an option in comix :)

      Anyway Comix still the best comic reader I tested, and I still prefer modify it a bit by myself than using any others ^^