Skip to content
This repository
Browse code

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...
commit abc6f15f950baeed0faab2b45e2c4918d3705238 1 parent c81e01f
Patrick Atoon authored
20  src/main/java/net/pms/formats/FormatFactory.java
@@ -35,7 +35,7 @@
35 35
 	private static final Logger LOGGER = LoggerFactory.getLogger(FormatFactory.class);
36 36
 
37 37
 	/**
38  
-	 * List of known formats.
  38
+	 * Initial list of known formats.
39 39
 	 */
40 40
 	private static final Format[] FORMATS = new Format[] { new DVRMS(),
41 41
 			new FLAC(), new GIF(), new ISO(), new JPG(), new M4A(), new MKV(),
@@ -43,6 +43,11 @@
43 43
 			new WAV(), new WEB() };
44 44
 
45 45
 	/**
  46
+	 * The list of registered formats.
  47
+	 */
  48
+	private static ArrayList<Format> formats = new ArrayList<Format>(Arrays.asList(FORMATS));
  49
+	
  50
+	/**
46 51
 	 * This class is not meant to be instantiated.
47 52
 	 */
48 53
 	private FormatFactory() {
@@ -59,7 +64,7 @@ private FormatFactory() {
59 64
 	 * @see Format#match(String)
60 65
 	 */
61 66
 	public static Format getAssociatedExtension(final String filename) {
62  
-		for (Format ext : FORMATS) {
  67
+		for (Format ext : formats) {
63 68
 			if (ext.match(filename)) {
64 69
 				LOGGER.trace("Matched format " + ext + " to \"" + filename + "\"");
65 70
 
@@ -78,9 +83,16 @@ public static Format getAssociatedExtension(final String filename) {
78 83
 	 * @return The list of known formats.
79 84
 	 */
80 85
 	public static ArrayList<Format> getExtensions() {
81  
-		ArrayList<Format> formats = new ArrayList<Format>(Arrays.asList(FORMATS));
82  
-
83 86
 		return formats;
84 87
 	}
  88
+
  89
+	/**
  90
+	 * Sets the list of known formats.
  91
+	 *
  92
+	 * @param formatList The list of known formats.
  93
+	 */
  94
+	public static void setExtensions(ArrayList<Format> formatList) {
  95
+		formats = formatList;
  96
+	}
85 97
 }
86 98
 

0 notes on commit abc6f15

Please sign in to comment.
Something went wrong with that request. Please try again.