Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#1303 closed enhancement (fixed)

configuration - sort order

Reported by: backup Owned by: zzz
Priority: trivial Milestone: 0.9.23
Component: apps/i2psnark Version: 0.9.13
Keywords: configuration Cc:
Parent Tickets: Sensitive: no

Description

Current sort order of torrents displayed is "intelligent", "The AA Movie" is sorted on top in the torrent list.

My desktop file manager display in "normal order", so it would be nice having a setting in i2psnark,

  • sort order: "intelligent" or "normal"

Subtickets

Change History (5)

comment:1 Changed 5 years ago by zzz

Essentially a dup of #637

comment:2 Changed 5 years ago by backup

Thanks for the comment. #637 is about how intelligent the sort algo has to be (to satisfy all user and languages).

My proposed enhancement is a setting "turn-off" the intelligent sort algo completely and fallback to "normal" sorting (one by one character), like it was in older snark version.

This would satisfy users with non-english torrents, or users like me who are confused because desktop filemanager sorts the other way.

BR backup

comment:3 Changed 5 years ago by backup

proposal:

I2PSnarkServlet.java
	// new Option: 
	out.write(_("Sort order"));	// "advanced" | "normal" 
	_manager.getSortOrder()


	private static class TorrentNameComparator implements Comparator<Snark>, Serializable {
 	    ...
            String ls = l.getBaseName();
            String rs = r.getBaseName();

	    if (getSortOrder=="advanced") {
	      // EN
              if (llc.startsWith("the ") || llc.startsWith("the.") ||  llc.startsWith("the_")) ls = ls.substring(4);
              if (rlc.startsWith("the ") || rlc.startsWith("the.") ||  rlc.startsWith("the_")) rs = rs.substring(4);
              if (llc.startsWith("a ") || llc.startsWith("a.") ||  llc.startsWith("a_")) ls = ls.substring(2);
              if (rlc.startsWith("a ") || rlc.startsWith("a.") ||  rlc.startsWith("a_")) rs = rs.substring(2);
	      // DE
              if (llc.startsWith("der ") || llc.startsWith("der.") ||  llc.startsWith("der_") ||
		  llc.startsWith("die ") || llc.startsWith("die.") ||  llc.startsWith("die_") ||
		  llc.startsWith("das ") || llc.startsWith("das.") ||  llc.startsWith("das_") ||
   		  llc.startsWith("ein ") || llc.startsWith("ein.") ||  llc.startsWith("ein_")) ls = ls.substring(4);
              if (rlc.startsWith("der ") || rlc.startsWith("der.") ||  rlc.startsWith("der_") ||
		  rlc.startsWith("die ") || rlc.startsWith("die.") ||  rlc.startsWith("die_") ||
		  rlc.startsWith("das ") || rlc.startsWith("das.") ||  rlc.startsWith("das_") ||
		  rlc.startsWith("ein ") || rlc.startsWith("ein.") ||  rlc.startsWith("ein_")) rs = rs.substring(4);
	    }
            return Collator.getInstance().compare(ls, rs);

BR backup

comment:4 Changed 4 years ago by zzz

Milestone: 0.9.23
Resolution: fixed
Status: newclosed
  • Added 'smart sort' option, on by default
  • Smart sort is based on keywords for configured language only; added keywords for 7 common languages including Deutsch
  • Moved implementation to Pattern/Matcher? for efficiency

In a1a907334db43730fd0fa57c62704fe86d978275 0.9.22-18

comment:5 Changed 4 years ago by backup

Perfect, thanks very much!
backup

Note: See TracTickets for help on using tickets.