Permalink
Browse files

Fix for regression breaking plugins that change extensions.

Regression was introduced in 309414d,
see the discussion on the forum:
http://www.ps3mediaserver.org/forum/viewtopic.php?f=14&t=9798&p=65387#p65371
  • Loading branch information...
1 parent c81e01f commit abc6f15f950baeed0faab2b45e2c4918d3705238 @Raptor399 Raptor399 committed Feb 18, 2012
Showing with 16 additions and 4 deletions.
  1. +16 −4 src/main/java/net/pms/formats/FormatFactory.java
View
20 src/main/java/net/pms/formats/FormatFactory.java
@@ -35,14 +35,19 @@
private static final Logger LOGGER = LoggerFactory.getLogger(FormatFactory.class);
/**
- * List of known formats.
+ * Initial list of known formats.
*/
private static final Format[] FORMATS = new Format[] { new DVRMS(),
new FLAC(), new GIF(), new ISO(), new JPG(), new M4A(), new MKV(),
new MP3(), new MPG(), new OGG(), new PNG(), new RAW(), new TIF(),
new WAV(), new WEB() };
/**
+ * The list of registered formats.
+ */
+ private static ArrayList<Format> formats = new ArrayList<Format>(Arrays.asList(FORMATS));
+
+ /**
* This class is not meant to be instantiated.
*/
private FormatFactory() {
@@ -59,7 +64,7 @@ private FormatFactory() {
* @see Format#match(String)
*/
public static Format getAssociatedExtension(final String filename) {
- for (Format ext : FORMATS) {
+ for (Format ext : formats) {
if (ext.match(filename)) {
LOGGER.trace("Matched format " + ext + " to \"" + filename + "\"");
@@ -78,9 +83,16 @@ public static Format getAssociatedExtension(final String filename) {
* @return The list of known formats.
*/
public static ArrayList<Format> getExtensions() {
- ArrayList<Format> formats = new ArrayList<Format>(Arrays.asList(FORMATS));
-
return formats;
}
+
+ /**
+ * Sets the list of known formats.
+ *
+ * @param formatList The list of known formats.
+ */
+ public static void setExtensions(ArrayList<Format> formatList) {
+ formats = formatList;
+ }
}

0 comments on commit abc6f15

Please sign in to comment.