Bladeren bron

Updates reported version in `System/Info*` set of endpoints.

Added ProductName and ServerVersion to API.

Added build version and build step. Addressed issues wtih indentation.

Made the BuildVersion an actual object. This lets up link to the github page of that commit.

Fixed class method type and styled link.

Fixed languages and split out the information in the UI.

Moved update-version script and gave it executable permissions. Windows correctly finds the .bat file. And linux takes the one without extension.

Removed tempfiles from replace sessions from csproj.

Updated version generation scripts. Will also work with pre existing version files. (Source tarballs etc.)

Added simple replace for ssh github links.

Add execute rights to update-version.

Wrapped long line in ApplicationHost.cs

Fixed some small issues.

Fixed some small issues, and flipped some if's around.

Converted parameter names to camelBack casing.

Sealed the attribute class.

Removed MPLv2 license.

Fixed file headers.

Added newline.

Moved links in *.csproj files as well.

Fix issues caused by rebase auto merging.

Removed default constructor and added init values to properties, also hid the Remote value form API.
Erwin de Haan 6 jaren geleden
bovenliggende
commit
bb8df8dfa0
35 gewijzigde bestanden met toevoegingen van 421 en 24 verwijderingen
  1. 1 0
      .gitignore
  2. 1 1
      BDInfo/BDInfo.csproj
  3. 1 1
      DvdLib/DvdLib.csproj
  4. 1 1
      Emby.Dlna/Emby.Dlna.csproj
  5. 1 1
      Emby.Drawing.Skia/Emby.Drawing.Skia.csproj
  6. 1 1
      Emby.Drawing/Emby.Drawing.csproj
  7. 1 1
      Emby.IsoMounting/IsoMounter/IsoMounter.csproj
  8. 1 1
      Emby.Naming/Emby.Naming.csproj
  9. 1 1
      Emby.Notifications/Emby.Notifications.csproj
  10. 1 1
      Emby.Photos/Emby.Photos.csproj
  11. 30 1
      Emby.Server.Implementations/ApplicationHost.cs
  12. 2 1
      Emby.Server.Implementations/Emby.Server.Implementations.csproj
  13. 5 1
      Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj
  14. 2 1
      Jellyfin.Server/Jellyfin.Server.csproj
  15. 48 0
      Jellyfin.Versioning/AssemblyExtendedVersion.cs
  16. 133 0
      Jellyfin.Versioning/ExtendedVersion.cs
  17. 20 0
      Jellyfin.Versioning/Jellyfin.Versioning.csproj
  18. 21 0
      Jellyfin.Versioning/Properties/AssemblyInfo.cs
  19. 8 0
      Jellyfin.Versioning/SharedVersion.cs
  20. 44 0
      Jellyfin.Versioning/update-version
  21. 23 0
      Jellyfin.Versioning/update-version.bat
  22. 31 0
      Jellyfin.Versioning/update-version.ps1
  23. 1 1
      MediaBrowser.Api/MediaBrowser.Api.csproj
  24. 1 1
      MediaBrowser.Common/MediaBrowser.Common.csproj
  25. 1 1
      MediaBrowser.Controller/MediaBrowser.Controller.csproj
  26. 1 1
      MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj
  27. 1 1
      MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj
  28. 5 1
      MediaBrowser.Model/MediaBrowser.Model.csproj
  29. 15 1
      MediaBrowser.Model/System/PublicSystemInfo.cs
  30. 9 0
      MediaBrowser.Model/System/SystemInfo.cs
  31. 1 1
      MediaBrowser.Providers/MediaBrowser.Providers.csproj
  32. 1 1
      MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj
  33. 6 0
      MediaBrowser.sln
  34. 1 1
      Mono.Nat/Mono.Nat.csproj
  35. 1 1
      SocketHttpListener/SocketHttpListener.csproj

+ 1 - 0
.gitignore

@@ -263,3 +263,4 @@ deployment/**/pkg-dist/
 deployment/**/pkg-dist-tmp/
 deployment/collect-dist/
 
+jellyfin_version.ini

+ 1 - 1
BDInfo/BDInfo.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <ItemGroup>

+ 1 - 1
DvdLib/DvdLib.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <ItemGroup>

+ 1 - 1
Emby.Dlna/Emby.Dlna.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <ItemGroup>

+ 1 - 1
Emby.Drawing.Skia/Emby.Drawing.Skia.csproj

@@ -17,7 +17,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
 </Project>

+ 1 - 1
Emby.Drawing/Emby.Drawing.csproj

@@ -6,7 +6,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <PropertyGroup>

+ 1 - 1
Emby.IsoMounting/IsoMounter/IsoMounter.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <ItemGroup>
-    <Compile Include="..\..\SharedVersion.cs" Link="SharedVersion.cs" />
+    <Compile Include="..\..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <ItemGroup>

+ 1 - 1
Emby.Naming/Emby.Naming.csproj

@@ -6,7 +6,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <ItemGroup>

+ 1 - 1
Emby.Notifications/Emby.Notifications.csproj

@@ -6,7 +6,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" Link="SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <ItemGroup>

+ 1 - 1
Emby.Photos/Emby.Photos.csproj

@@ -7,7 +7,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <PropertyGroup>

+ 30 - 1
Emby.Server.Implementations/ApplicationHost.cs

@@ -47,6 +47,7 @@ using Emby.Server.Implementations.Threading;
 using Emby.Server.Implementations.TV;
 using Emby.Server.Implementations.Updates;
 using Emby.Server.Implementations.Xml;
+using Jellyfin.Versioning;
 using MediaBrowser.Api;
 using MediaBrowser.Common;
 using MediaBrowser.Common.Configuration;
@@ -434,7 +435,30 @@ namespace Emby.Server.Implementations
         /// Gets the current application version
         /// </summary>
         /// <value>The application version.</value>
-        public Version ApplicationVersion => _version ?? (_version = typeof(ApplicationHost).Assembly.GetName().Version);
+        public Version ApplicationVersion => _version ?? (_version = ApplicationExtendedVersion.ApiVersion);
+
+        private Version _serverVersion;
+        /// <summary>
+        /// Gets the current application server version
+        /// </summary>
+        /// <value>The application server version.</value>
+        public Version ApplicationServerVersion => _serverVersion ?? (_serverVersion = typeof(ApplicationHost).Assembly.GetName().Version);
+
+        private ExtendedVersion _extendedVersion;
+        /// <summary>
+        /// Gets the current application server version
+        /// </summary>
+        /// <value>The application server version.</value>
+        public ExtendedVersion ApplicationExtendedVersion => _extendedVersion ??
+            (_extendedVersion = typeof(ApplicationHost).Assembly.GetCustomAttributes(typeof(AssemblyExtendedVersion), false)
+            .Cast<AssemblyExtendedVersion>().FirstOrDefault().ExtendedVersion);
+
+        private string _productName;
+        /// <summary>
+        /// Gets the current application name
+        /// </summary>
+        /// <value>The application name.</value>
+        public string ApplicationProductName => _productName ?? (_productName = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).ProductName);
 
         private DeviceId _deviceId;
         public string SystemId
@@ -1826,6 +1850,9 @@ namespace Emby.Server.Implementations
                 HasPendingRestart = HasPendingRestart,
                 IsShuttingDown = IsShuttingDown,
                 Version = ApplicationVersion.ToString(),
+                ServerVersion = ApplicationServerVersion.ToString(),
+                ExtendedVersion = ApplicationExtendedVersion,
+                ProductName = ApplicationProductName,
                 WebSocketPortNumber = HttpPort,
                 CompletedInstallations = InstallationManager.CompletedInstallations.ToArray(),
                 Id = SystemId,
@@ -1872,6 +1899,8 @@ namespace Emby.Server.Implementations
             return new PublicSystemInfo
             {
                 Version = ApplicationVersion.ToString(),
+                ServerVersion = ApplicationServerVersion.ToString(),
+                ExtendedVersion = ApplicationExtendedVersion,
                 Id = SystemId,
                 OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(),
                 WanAddress = wanAddress,

+ 2 - 1
Emby.Server.Implementations/Emby.Server.Implementations.csproj

@@ -3,6 +3,7 @@
   <ItemGroup>
     <ProjectReference Include="..\Emby.Naming\Emby.Naming.csproj" />
     <ProjectReference Include="..\Emby.Notifications\Emby.Notifications.csproj" />
+    <ProjectReference Include="..\Jellyfin.Versioning\Jellyfin.Versioning.csproj" />
     <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
     <ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
     <ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
@@ -30,7 +31,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <PropertyGroup>

+ 5 - 1
Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj

@@ -6,7 +6,11 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <Compile Include="..\..\SharedVersion.cs" Link="SharedVersion.cs" />
+    <Compile Include="..\..\Jellyfin.Versioning\SharedVersion.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\..\Jellyfin.Versioning\Jellyfin.Versioning.csproj" />
   </ItemGroup>
 
 </Project>

+ 2 - 1
Jellyfin.Server/Jellyfin.Server.csproj

@@ -13,7 +13,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <ItemGroup>
@@ -46,6 +46,7 @@
     <ProjectReference Include="..\Emby.Drawing.Skia\Emby.Drawing.Skia.csproj" />
     <ProjectReference Include="..\Emby.IsoMounting\IsoMounter\IsoMounter.csproj" />
     <ProjectReference Include="..\Emby.Server.Implementations\Emby.Server.Implementations.csproj" />
+    <ProjectReference Include="..\Jellyfin.Versioning\Jellyfin.Versioning.csproj" />
   </ItemGroup>
 
 </Project>

+ 48 - 0
Jellyfin.Versioning/AssemblyExtendedVersion.cs

@@ -0,0 +1,48 @@
+// Jellyfin.Versioning/AssemblyExtendedVersion.cs
+// Part of the Jellyfin project (https://jellyfin.media)
+//
+//    All copyright belongs to the Jellyfin contributors; a full list can
+//    be found in the file CONTRIBUTORS.md
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+
+namespace Jellyfin.Versioning
+{
+    [AttributeUsage(AttributeTargets.Assembly)]
+    public sealed class AssemblyExtendedVersion : Attribute
+    {
+        public ExtendedVersion ExtendedVersion { get; }
+
+        public AssemblyExtendedVersion(ExtendedVersion ExtendedVersion)
+        {
+            this.ExtendedVersion = ExtendedVersion;
+        }
+        
+        public AssemblyExtendedVersion(string apiVersion, bool readResource = true)
+        {
+            var assembly = Assembly.GetExecutingAssembly();
+            var resourceName = "Jellyfin.Versioning.jellyfin_version.ini";
+
+            using (var stream = assembly.GetManifestResourceStream(resourceName))
+            {
+                ExtendedVersion = new ExtendedVersion(new Version(apiVersion), stream);
+            }
+        }
+    }
+}

+ 133 - 0
Jellyfin.Versioning/ExtendedVersion.cs

@@ -0,0 +1,133 @@
+// Jellyfin.Versioning/ExtendedVersion.cs
+// Part of the Jellyfin project (https://jellyfin.media)
+//
+//    All copyright belongs to the Jellyfin contributors; a full list can
+//    be found in the file CONTRIBUTORS.md
+//
+//    This program is free software: you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation, either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License
+//    along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace Jellyfin.Versioning
+{
+    public class ExtendedVersion
+    {
+        [IgnoreDataMember]
+        public Version ApiVersion { get; }
+
+        public string CommitHash { get; } = String.Empty;
+
+        public long Revision { get; } = 0;
+
+        public string Branch { get; } = String.Empty;
+
+        public string TagDescription { get; } = String.Empty;
+
+        [IgnoreDataMember]
+        public Uri Remote { get; } = null;
+
+        public ExtendedVersion(Version apiVersion, Stream extendedVersionFileStream)
+        {
+            ApiVersion = apiVersion;
+            int line = 1;
+            using (var reader = new StreamReader(extendedVersionFileStream))
+            {
+                while (!reader.EndOfStream)
+                {
+                    string item = reader.ReadLine();
+
+                    if (string.IsNullOrWhiteSpace(item.Trim()))
+                    {
+                        //empty line, skip
+                        continue;
+                    }
+                    var kvpair = item.Split('=');
+                    if (kvpair.Length != 2)
+                    {
+                        throw new ArgumentException(nameof(extendedVersionFileStream),
+                            $"ExtendedVersionFile contains bad key-value pair '{item}' at line {line}.");
+                    }
+                    var key = kvpair[0].Trim().ToLower();
+                    var value = kvpair[1].Trim();
+                    switch (key)
+                    {
+                        case "commit":
+                            if (value.Length < 7 || value.Length > 40)
+                            {
+                                throw new ArgumentException(nameof(extendedVersionFileStream),
+                                    $"ExtendedVersionFile has a bad commit hash '{value}' on line {line}, it should be a string between 7 and 40 characters.");
+                            }
+                            CommitHash = value;
+                            break;
+                        case "branch":
+                            if (string.IsNullOrWhiteSpace(value))
+                            {
+                                throw new ArgumentException(nameof(extendedVersionFileStream),
+                                    $"ExtendedVersionFile has a bad branch '{value}' on line {line}, it can not be empty.");
+                            }
+                            Branch = value;
+                            break;
+                        case "revision":
+                            if (!long.TryParse(value, out long rev))
+                            {
+                                throw new ArgumentException(nameof(extendedVersionFileStream),
+                                    $"ExtendedVersionFile has a bad revision '{value}' on line {line}, it should be an integer.");
+                            }
+                            Revision = rev;
+                            break;
+                        case "tagdesc":
+                            if (string.IsNullOrWhiteSpace(value))
+                            {
+                                throw new ArgumentException(nameof(extendedVersionFileStream),
+                                    $"ExtendedVersionFile has a bad tag description '{value}' on line {line}, it can not be empty.");
+                            }
+                            TagDescription = value;
+                            break;
+                        case "remote":
+                            var remoteRepo = value.Replace(".git", string.Empty).Replace("git@github.com:", "https://github.com/");
+                            if (Uri.IsWellFormedUriString(remoteRepo, UriKind.Absolute))
+                            {
+                                Remote = new Uri(remoteRepo);
+                            }
+                            else if (Uri.IsWellFormedUriString(value, UriKind.Absolute))
+                            {
+                                //fallback if the replace about broke the Uri
+                                Remote = new Uri(value);
+                            }
+                            else
+                            {
+                                throw new ArgumentException(nameof(extendedVersionFileStream),
+                                    $"ExtendedVersionFile has a bad remote URI '{value}' on line {line}, it should be a valid remote URI (ssh or https).");
+                            }
+                            break;
+                        default:
+                            throw new ArgumentException(nameof(extendedVersionFileStream),
+                            $"ExtendedVersionFile contains an unrecognized key-value pair '{item}' at line {line}.");
+                    }
+                    line++;
+                }
+            }
+        }
+
+        public override string ToString()
+        {
+            return $"{ApiVersion};{CommitHash};{Revision};{Branch};{TagDescription};{Remote}";
+        }
+    }
+}

+ 20 - 0
Jellyfin.Versioning/Jellyfin.Versioning.csproj

@@ -0,0 +1,20 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>netstandard2.0</TargetFramework>
+    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <None Remove="jellyfin_version.ini" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <EmbeddedResource Include="jellyfin_version.ini" />
+  </ItemGroup>
+
+  <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
+    <Exec Command="$(ProjectDir)update-version" />
+  </Target>
+
+</Project>

+ 21 - 0
Jellyfin.Versioning/Properties/AssemblyInfo.cs

@@ -0,0 +1,21 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Jellyfin.Versioning")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Jellyfin Project")]
+[assembly: AssemblyProduct("Jellyfin: The Free Software Media System")]
+[assembly: AssemblyCopyright("Copyright ©  2019 Jellyfin Contributors. Code released under the GNU General Public License Version 2")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: NeutralResourcesLanguage("en")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]

+ 8 - 0
Jellyfin.Versioning/SharedVersion.cs

@@ -0,0 +1,8 @@
+using System.Reflection;
+using Jellyfin.Versioning;
+
+//To keep compatibility with Emby do not remove the revision (fourth number)
+[assembly: AssemblyVersion("10.0.1.0")]
+[assembly: AssemblyFileVersion("10.0.1.0")]
+[assembly: AssemblyInformationalVersion("10.0.1.0")]
+[assembly: AssemblyExtendedVersion("3.5.2.0", true)]

+ 44 - 0
Jellyfin.Versioning/update-version

@@ -0,0 +1,44 @@
+#!/usr/bin/env sh
+# Jellyfin.Versioning/update-version
+# Part of the Jellyfin project (https://jellyfin.media)
+#
+#    All copyright belongs to the Jellyfin contributors; a full list can
+#    be found in the file CONTRIBUTORS.md
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+if [ -d "$(dirname "$0")/../.git" ]; then
+    commit=`git rev-parse HEAD`
+    count=`git rev-list HEAD --count`
+    branch=`git rev-parse --abbrev-ref HEAD`
+    desc=`git describe --tags --always --long`
+    remote=`git config --get remote.origin.url`
+    tee jellyfin_version.ini <<EOF
+commit=$commit
+revision=$count
+branch=$branch
+tagdesc=$desc
+remote=$remote
+EOF
+    cat <<EOF
+Updated build version in jellyfin_version.ini
+commit=$commit
+revision=$count
+branch=$branch
+tagdesc=$desc
+remote=$remote
+EOF
+else
+    echo Did not update build version because there was no .git directory.
+fi

+ 23 - 0
Jellyfin.Versioning/update-version.bat

@@ -0,0 +1,23 @@
+@ECHO OFF
+goto licenseblock
+update-version.bat
+Part of the Jellyfin project (https://jellyfin.media)
+
+   All copyright belongs to the Jellyfin contributors; a full list can
+   be found in the file CONTRIBUTORS.md
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program. If not, see <https://www.gnu.org/licenses/>.
+:licenseblock
+
+powershell.exe -executionpolicy Bypass -file update-version.ps1

+ 31 - 0
Jellyfin.Versioning/update-version.ps1

@@ -0,0 +1,31 @@
+# Jellyfin.Versioning/update-version.ps1
+# Part of the Jellyfin project (https://jellyfin.media)
+#
+#    All copyright belongs to the Jellyfin contributors; a full list can
+#    be found in the file CONTRIBUTORS.md
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+if(Test-Path -Path '..\.git' ){
+   $commit = (git rev-parse HEAD)
+   $count = (git rev-list HEAD --count)
+   $branch = (git rev-parse --abbrev-ref HEAD)
+   $desc = (git describe --tags --always --long)
+   $remote = (git config --get remote.origin.url) 
+   Set-Content -Path "jellyfin_version.ini" -Value "commit=$commit`r`nrevision=$count`r`nbranch=$branch`r`ntagdesc=$desc`r`nremote=$remote"
+   Write-Host Updated build version in jellyfin_version.ini
+   Write-Host "commit=$commit`r`nrevision=$count`r`nbranch=$branch`r`ntagdesc=$desc`r`nremote=$remote`r`n"
+} else { 
+   Write-Host Did not update build version because there was no .git directory.
+}

+ 1 - 1
MediaBrowser.Api/MediaBrowser.Api.csproj

@@ -6,7 +6,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <PropertyGroup>

+ 1 - 1
MediaBrowser.Common/MediaBrowser.Common.csproj

@@ -12,7 +12,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <PropertyGroup>

+ 1 - 1
MediaBrowser.Controller/MediaBrowser.Controller.csproj

@@ -13,7 +13,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <PropertyGroup>

+ 1 - 1
MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj

@@ -6,7 +6,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <PropertyGroup>

+ 1 - 1
MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj

@@ -6,7 +6,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <ItemGroup>

+ 5 - 1
MediaBrowser.Model/MediaBrowser.Model.csproj

@@ -17,7 +17,11 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\Jellyfin.Versioning\Jellyfin.Versioning.csproj" />
   </ItemGroup>
 
 </Project>

+ 15 - 1
MediaBrowser.Model/System/PublicSystemInfo.cs

@@ -1,3 +1,5 @@
+using Jellyfin.Versioning;
+
 namespace MediaBrowser.Model.System
 {
     public class PublicSystemInfo
@@ -21,11 +23,23 @@ namespace MediaBrowser.Model.System
         public string ServerName { get; set; }
 
         /// <summary>
-        /// Gets or sets the version.
+        /// Gets or sets the API version.
         /// </summary>
         /// <value>The version.</value>
         public string Version { get; set; }
 
+        /// <summary>
+        /// Gets or sets the server version.
+        /// </summary>
+        /// <value>The server version.</value>
+        public string ServerVersion { get; set; }
+
+        /// <summary>
+        /// Gets or sets the build version.
+        /// </summary>
+        /// <value>The build version.</value>
+        public ExtendedVersion ExtendedVersion { get; set; }
+
         /// <summary>
         /// Gets or sets the operating sytem.
         /// </summary>

+ 9 - 0
MediaBrowser.Model/System/SystemInfo.cs

@@ -16,6 +16,15 @@ namespace MediaBrowser.Model.System
         /// <value>The display name of the operating system.</value>
         public string OperatingSystemDisplayName { get; set; }
 
+        /// <summary>
+        /// The product name. This is the AssemblyProduct name.
+        /// </summary>
+        public string ProductName { get; set; }
+
+        /// <summary>
+        /// Get or sets the package name.
+        /// </summary>
+        /// <value>The value of the '-package' command line argument.</value>
         public string PackageName { get; set; }
 
         /// <summary>

+ 1 - 1
MediaBrowser.Providers/MediaBrowser.Providers.csproj

@@ -7,7 +7,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <ItemGroup>

+ 1 - 1
MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj

@@ -6,7 +6,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <PropertyGroup>

+ 6 - 0
MediaBrowser.sln

@@ -60,6 +60,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
 		.editorconfig = .editorconfig
 	EndProjectSection
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Versioning", "Jellyfin.Versioning\Jellyfin.Versioning.csproj", "{F825B88C-4C87-4439-AE20-ACA12B6A9C83}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -170,6 +172,10 @@ Global
 		{07E39F42-A2C6-4B32-AF8C-725F957A73FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{07E39F42-A2C6-4B32-AF8C-725F957A73FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{07E39F42-A2C6-4B32-AF8C-725F957A73FF}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F825B88C-4C87-4439-AE20-ACA12B6A9C83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F825B88C-4C87-4439-AE20-ACA12B6A9C83}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F825B88C-4C87-4439-AE20-ACA12B6A9C83}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F825B88C-4C87-4439-AE20-ACA12B6A9C83}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 1 - 1
Mono.Nat/Mono.Nat.csproj

@@ -6,7 +6,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <PropertyGroup>

+ 1 - 1
SocketHttpListener/SocketHttpListener.csproj

@@ -6,7 +6,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Compile Include="..\SharedVersion.cs" />
+    <Compile Include="..\Jellyfin.Versioning\SharedVersion.cs" />
   </ItemGroup>
 
   <PropertyGroup>