Merge branch 'subtree'
[fanfix.git] / src / be / nikiroo / fanfix / VersionCheck.java
index f64159abb97c3fe3236bc272710402a1e32631f7..8b2a343f3cef331a2dbc059306586d6c2eaa83b7 100644 (file)
@@ -20,7 +20,7 @@ import be.nikiroo.utils.Version;
  * @author niki
  */
 public class VersionCheck {
-       private static final String base = "https://github.com/nikiroo/fanfix/raw/master/changelog${LANG}.md";
+       private static final String base = "https://github.com/${PROJECT}/raw/master/changelog${LANG}.md";
 
        private Version current;
        private List<Version> newer;
@@ -100,16 +100,23 @@ public class VersionCheck {
         * Check if there are available {@link Version}s of this program more recent
         * than the current one.
         * 
+        * @param githubProject
+        *            the GitHub project to check on, for instance "nikiroo/fanfix"
+        * 
         * @return a {@link VersionCheck}
         */
-       public static VersionCheck check() {
+       public static VersionCheck check(String githubProject) {
                Version current = Version.getCurrentVersion();
                List<Version> newer = new ArrayList<Version>();
                Map<Version, List<String>> changes = new HashMap<Version, List<String>>();
 
                if (Instance.getInstance().isVersionCheckNeeded()) {
                        try {
-                               // Prepare the URLs according to the user's language
+                               // Use the right project:
+                               String base = VersionCheck.base.replace("${PROJECT}",
+                                               githubProject);
+                               
+                               // Prepare the URLs according to the user's language:
                                Locale lang = Instance.getInstance().getTrans().getLocale();
                                String fr = lang.getLanguage();
                                String BE = lang.getCountry().replace(".UTF8", "");
@@ -120,7 +127,8 @@ public class VersionCheck {
                                InputStream in = null;
                                for (String url : new String[] { urlFrBE, urlFr, urlDefault }) {
                                        try {
-                                               in = Instance.getInstance().getCache().open(new URL(url), null, false);
+                                               in = Instance.getInstance().getCache().openNoCache(
+                                                               new URL(url), null, null, null, null);
                                                break;
                                        } catch (IOException e) {
                                        }