Skip to content

Commit ce299e0

Browse files
author
firewyre
committed
Creating a 1.5.3 maintenance branch
1 parent cb6d867 commit ce299e0

File tree

75 files changed

+14242
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+14242
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* listFix() - Fix Broken Playlists!
3+
* Copyright (C) 2001-2009 Jeremy Caron
4+
*
5+
* This file is part of listFix().
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* as published by the Free Software Foundation; either version 2
10+
* of the License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, please see http://www.gnu.org/licenses/
19+
*/
20+
21+
package listfix.comparators;
22+
23+
import listfix.model.PlaylistEntry;
24+
25+
public class AscendingFilenameComparator implements java.util.Comparator<PlaylistEntry>
26+
{
27+
@Override
28+
public int compare(PlaylistEntry aa, PlaylistEntry bb)
29+
{
30+
if (aa.getFileName().compareToIgnoreCase(bb.getFileName()) < 0)
31+
{
32+
return -1;
33+
}
34+
else if (aa.getFileName().equals(bb.getFileName()))
35+
{
36+
return 0;
37+
}
38+
return 1;
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* listFix() - Fix Broken Playlists!
3+
* Copyright (C) 2001-2009 Jeremy Caron
4+
*
5+
* This file is part of listFix().
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* as published by the Free Software Foundation; either version 2
10+
* of the License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, please see http://www.gnu.org/licenses/
19+
*/
20+
21+
package listfix.comparators;
22+
23+
import listfix.model.*;
24+
25+
public class AscendingPathComparator implements java.util.Comparator<PlaylistEntry>
26+
{
27+
@Override
28+
public int compare(PlaylistEntry aa, PlaylistEntry bb)
29+
{
30+
if (aa.getPath().compareToIgnoreCase(bb.getPath()) < 0)
31+
{
32+
return -1;
33+
}
34+
else if (aa.getPath().equals(bb.getPath()))
35+
{
36+
return 0;
37+
}
38+
return 1;
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* listFix() - Fix Broken Playlists!
3+
* Copyright (C) 2001-2009 Jeremy Caron
4+
*
5+
* This file is part of listFix().
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* as published by the Free Software Foundation; either version 2
10+
* of the License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, please see http://www.gnu.org/licenses/
19+
*/
20+
21+
package listfix.comparators;
22+
23+
import listfix.model.*;
24+
25+
public class AscendingStatusComparator implements java.util.Comparator<PlaylistEntry>
26+
{
27+
@Override
28+
public int compare(PlaylistEntry aa, PlaylistEntry bb)
29+
{
30+
if (aa.getMessage().compareToIgnoreCase(bb.getMessage()) < 0)
31+
{
32+
return -1;
33+
}
34+
else if (aa.getMessage().equals(bb.getMessage()))
35+
{
36+
return 0;
37+
}
38+
return 1;
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* listFix() - Fix Broken Playlists!
3+
* Copyright (C) 2001-2009 Jeremy Caron
4+
*
5+
* This file is part of listFix().
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* as published by the Free Software Foundation; either version 2
10+
* of the License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, please see http://www.gnu.org/licenses/
19+
*/
20+
21+
package listfix.comparators;
22+
23+
import listfix.model.*;
24+
25+
public class DescendingFilenameComparator implements java.util.Comparator<PlaylistEntry>
26+
{
27+
@Override
28+
public int compare(PlaylistEntry aa, PlaylistEntry bb)
29+
{
30+
if (aa.getFileName().compareToIgnoreCase(bb.getFileName()) < 0)
31+
{
32+
return 1;
33+
}
34+
else if (aa.getFileName().equals(bb.getFileName()))
35+
{
36+
return 0;
37+
}
38+
return -1;
39+
}
40+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* listFix() - Fix Broken Playlists!
3+
* Copyright (C) 2001-2009 Jeremy Caron
4+
*
5+
* This file is part of listFix().
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* as published by the Free Software Foundation; either version 2
10+
* of the License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, please see http://www.gnu.org/licenses/
19+
*/
20+
21+
package listfix.comparators;
22+
23+
import listfix.model.*;
24+
25+
public class DescendingPathComparator implements java.util.Comparator<PlaylistEntry>
26+
{
27+
@Override
28+
public int compare(PlaylistEntry aa, PlaylistEntry bb)
29+
{
30+
if (aa.getPath().compareToIgnoreCase(bb.getPath()) < 0)
31+
{
32+
return 1;
33+
}
34+
else if (aa.getPath().equals(bb.getPath()))
35+
{
36+
return 0;
37+
}
38+
return -1;
39+
}
40+
}
41+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* listFix() - Fix Broken Playlists!
3+
* Copyright (C) 2001-2009 Jeremy Caron
4+
*
5+
* This file is part of listFix().
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* as published by the Free Software Foundation; either version 2
10+
* of the License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, please see http://www.gnu.org/licenses/
19+
*/
20+
21+
package listfix.comparators;
22+
23+
import listfix.model.*;
24+
25+
public class DescendingStatusComparator implements java.util.Comparator<PlaylistEntry>
26+
{
27+
@Override
28+
public int compare(PlaylistEntry aa, PlaylistEntry bb)
29+
{
30+
if (aa.getMessage().compareToIgnoreCase(bb.getMessage()) < 0)
31+
{
32+
return 1;
33+
}
34+
else if (aa.getMessage().equals(bb.getMessage()))
35+
{
36+
return 0;
37+
}
38+
return -1;
39+
}
40+
}
41+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* listFix() - Fix Broken Playlists!
3+
* Copyright (C) 2001-2009 Jeremy Caron
4+
*
5+
* This file is part of listFix().
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* as published by the Free Software Foundation; either version 2
10+
* of the License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, please see http://www.gnu.org/licenses/
19+
*/
20+
21+
package listfix.comparators;
22+
23+
import java.io.File;
24+
25+
/*
26+
============================================================================
27+
= Author: Jeremy Caron
28+
= File: FileComparator.java
29+
= Purpose: A poorly named class that sorts directories ahead of files,
30+
= and then sorts files alphabetically (ignoring case).
31+
============================================================================
32+
*/
33+
public class FileComparator implements java.util.Comparator<File>
34+
{
35+
@Override
36+
public int compare(File a, File b)
37+
{
38+
if (!a.isDirectory() && b.isDirectory())
39+
{
40+
return 1;
41+
}
42+
else if (a.isDirectory() && !b.isDirectory())
43+
{
44+
return -1;
45+
}
46+
else
47+
{
48+
// both Files are files or both are directories
49+
return a.getName().compareToIgnoreCase(b.getName());
50+
}
51+
}
52+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* listFix() - Fix Broken Playlists!
3+
* Copyright (C) 2001-2009 Jeremy Caron
4+
*
5+
* This file is part of listFix().
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* as published by the Free Software Foundation; either version 2
10+
* of the License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, please see http://www.gnu.org/licenses/
19+
*/
20+
21+
package listfix.comparators;
22+
23+
import listfix.model.MatchedPlaylistEntry;
24+
25+
public class MatchedPlaylistEntryColumnSorterComparator implements java.util.Comparator
26+
{
27+
protected boolean isSortAsc;
28+
protected int sortCol;
29+
30+
public MatchedPlaylistEntryColumnSorterComparator(boolean sortAsc, int sortByColumn)
31+
{
32+
sortCol = sortByColumn;
33+
isSortAsc = sortAsc;
34+
}
35+
36+
@Override
37+
public int compare(Object o1, Object o2)
38+
{
39+
if (!(o1 instanceof MatchedPlaylistEntry) || !(o2 instanceof MatchedPlaylistEntry))
40+
{
41+
return 0;
42+
}
43+
44+
if (sortCol == 0)
45+
{
46+
if (isSortAsc)
47+
{
48+
return ((MatchedPlaylistEntry) o1).getPlaylistFile().getFileName().compareTo(((MatchedPlaylistEntry) o2).getPlaylistFile().getFileName());
49+
}
50+
else
51+
{
52+
return ((MatchedPlaylistEntry) o2).getPlaylistFile().getFileName().compareTo(((MatchedPlaylistEntry) o1).getPlaylistFile().getFileName());
53+
}
54+
}
55+
else
56+
{
57+
int o1Count = ((MatchedPlaylistEntry) o1).getScore();
58+
int o2Count = ((MatchedPlaylistEntry) o2).getScore();
59+
if (o1Count == o2Count)
60+
{
61+
return 0;
62+
}
63+
else if (o1Count > o2Count)
64+
{
65+
return (isSortAsc ? 1 : -1);
66+
}
67+
else
68+
{
69+
return (isSortAsc ? -1 : 1);
70+
}
71+
}
72+
}
73+
}

0 commit comments

Comments
 (0)