parent
6879d27d83
commit
1a3e7dc56c
@ -1,27 +0,0 @@ |
||||
package com.github.catvod.bean.ali; |
||||
|
||||
import com.github.catvod.utils.Utils; |
||||
|
||||
import java.util.Collections; |
||||
import java.util.Comparator; |
||||
import java.util.List; |
||||
|
||||
public class Sorter implements Comparator<Item> { |
||||
|
||||
public static void sort(List<Item> items) { |
||||
Collections.sort(items, new Sorter()); |
||||
} |
||||
|
||||
@Override |
||||
public int compare(Item o1, Item o2) { |
||||
try { |
||||
return Integer.compare(getDigit(o1.getDisplayName()), getDigit(o2.getDisplayName())); |
||||
} catch (NumberFormatException e) { |
||||
return o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName()); |
||||
} |
||||
} |
||||
|
||||
private int getDigit(String text) throws NumberFormatException { |
||||
return Integer.parseInt(Utils.removeExt(text).replace("1080P", "").replace("4K", "").replaceAll("\\D+", "")); |
||||
} |
||||
} |
||||
@ -1 +1 @@ |
||||
836941085af643869ef5e0d9dce6d301 |
||||
bbd25da05e43977b11c52ccf06c0c1ed |
||||
|
||||
Loading…
Reference in new issue