Browse Source

Merge pull request #4170 from BaronGreenback/VersioningImprovement

Plugin versioning - amended for plugins without meta.json
dkanada 4 years ago
parent
commit
236dfe3ed8
1 changed files with 13 additions and 2 deletions
  1. 13 2
      Emby.Server.Implementations/ApplicationHost.cs

+ 13 - 2
Emby.Server.Implementations/ApplicationHost.cs

@@ -1086,9 +1086,20 @@ namespace Emby.Server.Implementations
                     }
                     else
                     {
+                        // No metafile, so lets see if the folder is versioned.
                         metafile = dir.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries)[^1];
-                        // Add it under the path name and version 0.0.0.1.
-                        versions.Add((new Version(0, 0, 0, 1), metafile, dir));
+                        
+                        int versionIndex = dir.LastIndexOf('_');
+                        if (versionIndex != -1 && Version.TryParse(dir.Substring(versionIndex + 1), out Version ver))
+                        {
+                            // Versioned folder.
+                            versions.Add((ver, metafile, dir));
+                        }
+                        else
+                        {
+                            // Un-versioned folder - Add it under the path name and version 0.0.0.1.                        
+                            versions.Add((new Version(0, 0, 0, 1), metafile, dir));
+                        }   
                     }
                 }
                 catch