From bb8df8dfa0f84f6ccc8d3d3352f8a611e156e65a Mon Sep 17 00:00:00 2001 From: Erwin de Haan Date: Tue, 8 Jan 2019 01:57:01 +0100 Subject: [PATCH 1/3] 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. --- .gitignore | 1 + BDInfo/BDInfo.csproj | 2 +- DvdLib/DvdLib.csproj | 2 +- Emby.Dlna/Emby.Dlna.csproj | 2 +- Emby.Drawing.Skia/Emby.Drawing.Skia.csproj | 2 +- Emby.Drawing/Emby.Drawing.csproj | 2 +- Emby.IsoMounting/IsoMounter/IsoMounter.csproj | 2 +- Emby.Naming/Emby.Naming.csproj | 2 +- Emby.Notifications/Emby.Notifications.csproj | 2 +- Emby.Photos/Emby.Photos.csproj | 2 +- .../ApplicationHost.cs | 31 +++- .../Emby.Server.Implementations.csproj | 3 +- Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj | 6 +- Jellyfin.Server/Jellyfin.Server.csproj | 3 +- .../AssemblyExtendedVersion.cs | 48 +++++++ Jellyfin.Versioning/ExtendedVersion.cs | 133 ++++++++++++++++++ .../Jellyfin.Versioning.csproj | 20 +++ .../Properties/AssemblyInfo.cs | 21 +++ Jellyfin.Versioning/SharedVersion.cs | 8 ++ Jellyfin.Versioning/update-version | 44 ++++++ Jellyfin.Versioning/update-version.bat | 23 +++ Jellyfin.Versioning/update-version.ps1 | 31 ++++ MediaBrowser.Api/MediaBrowser.Api.csproj | 2 +- .../MediaBrowser.Common.csproj | 2 +- .../MediaBrowser.Controller.csproj | 2 +- .../MediaBrowser.LocalMetadata.csproj | 2 +- .../MediaBrowser.MediaEncoding.csproj | 2 +- MediaBrowser.Model/MediaBrowser.Model.csproj | 6 +- MediaBrowser.Model/System/PublicSystemInfo.cs | 16 ++- MediaBrowser.Model/System/SystemInfo.cs | 9 ++ .../MediaBrowser.Providers.csproj | 2 +- .../MediaBrowser.XbmcMetadata.csproj | 2 +- MediaBrowser.sln | 6 + Mono.Nat/Mono.Nat.csproj | 2 +- SocketHttpListener/SocketHttpListener.csproj | 2 +- 35 files changed, 421 insertions(+), 24 deletions(-) create mode 100644 Jellyfin.Versioning/AssemblyExtendedVersion.cs create mode 100644 Jellyfin.Versioning/ExtendedVersion.cs create mode 100644 Jellyfin.Versioning/Jellyfin.Versioning.csproj create mode 100644 Jellyfin.Versioning/Properties/AssemblyInfo.cs create mode 100644 Jellyfin.Versioning/SharedVersion.cs create mode 100755 Jellyfin.Versioning/update-version create mode 100644 Jellyfin.Versioning/update-version.bat create mode 100644 Jellyfin.Versioning/update-version.ps1 diff --git a/.gitignore b/.gitignore index ec683f38f63..aef66627275 100644 --- a/.gitignore +++ b/.gitignore @@ -263,3 +263,4 @@ deployment/**/pkg-dist/ deployment/**/pkg-dist-tmp/ deployment/collect-dist/ +jellyfin_version.ini diff --git a/BDInfo/BDInfo.csproj b/BDInfo/BDInfo.csproj index 774e5709d68..d1d2cefea30 100644 --- a/BDInfo/BDInfo.csproj +++ b/BDInfo/BDInfo.csproj @@ -1,7 +1,7 @@ - + diff --git a/DvdLib/DvdLib.csproj b/DvdLib/DvdLib.csproj index 774e5709d68..d1d2cefea30 100644 --- a/DvdLib/DvdLib.csproj +++ b/DvdLib/DvdLib.csproj @@ -1,7 +1,7 @@ - + diff --git a/Emby.Dlna/Emby.Dlna.csproj b/Emby.Dlna/Emby.Dlna.csproj index f155bce6d32..280dc4bfab9 100644 --- a/Emby.Dlna/Emby.Dlna.csproj +++ b/Emby.Dlna/Emby.Dlna.csproj @@ -1,7 +1,7 @@ - + diff --git a/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj b/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj index 1eb53774113..6491f44b876 100644 --- a/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj +++ b/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj @@ -17,7 +17,7 @@ - + diff --git a/Emby.Drawing/Emby.Drawing.csproj b/Emby.Drawing/Emby.Drawing.csproj index ba29c656bf1..67364380ace 100644 --- a/Emby.Drawing/Emby.Drawing.csproj +++ b/Emby.Drawing/Emby.Drawing.csproj @@ -6,7 +6,7 @@ - + diff --git a/Emby.IsoMounting/IsoMounter/IsoMounter.csproj b/Emby.IsoMounting/IsoMounter/IsoMounter.csproj index 2a81f5aa0f5..518b2372fcd 100644 --- a/Emby.IsoMounting/IsoMounter/IsoMounter.csproj +++ b/Emby.IsoMounting/IsoMounter/IsoMounter.csproj @@ -1,7 +1,7 @@ - + diff --git a/Emby.Naming/Emby.Naming.csproj b/Emby.Naming/Emby.Naming.csproj index 88e3af522d1..419cf101db1 100644 --- a/Emby.Naming/Emby.Naming.csproj +++ b/Emby.Naming/Emby.Naming.csproj @@ -6,7 +6,7 @@ - + diff --git a/Emby.Notifications/Emby.Notifications.csproj b/Emby.Notifications/Emby.Notifications.csproj index 14caa4a5501..8fa21635e31 100644 --- a/Emby.Notifications/Emby.Notifications.csproj +++ b/Emby.Notifications/Emby.Notifications.csproj @@ -6,7 +6,7 @@ - + diff --git a/Emby.Photos/Emby.Photos.csproj b/Emby.Photos/Emby.Photos.csproj index e6b445202fc..9ad2afb6977 100644 --- a/Emby.Photos/Emby.Photos.csproj +++ b/Emby.Photos/Emby.Photos.csproj @@ -7,7 +7,7 @@ - + diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 91eaf9bbf2e..f186ccdaa12 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/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 /// /// The application version. - public Version ApplicationVersion => _version ?? (_version = typeof(ApplicationHost).Assembly.GetName().Version); + public Version ApplicationVersion => _version ?? (_version = ApplicationExtendedVersion.ApiVersion); + + private Version _serverVersion; + /// + /// Gets the current application server version + /// + /// The application server version. + public Version ApplicationServerVersion => _serverVersion ?? (_serverVersion = typeof(ApplicationHost).Assembly.GetName().Version); + + private ExtendedVersion _extendedVersion; + /// + /// Gets the current application server version + /// + /// The application server version. + public ExtendedVersion ApplicationExtendedVersion => _extendedVersion ?? + (_extendedVersion = typeof(ApplicationHost).Assembly.GetCustomAttributes(typeof(AssemblyExtendedVersion), false) + .Cast().FirstOrDefault().ExtendedVersion); + + private string _productName; + /// + /// Gets the current application name + /// + /// The application name. + 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, diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 5a0e1da4d76..843718756df 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -3,6 +3,7 @@ + @@ -30,7 +31,7 @@ - + diff --git a/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj b/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj index baa522ee3e5..dfda0f17061 100644 --- a/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj +++ b/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj @@ -6,7 +6,11 @@ - + + + + + diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj index f17e06e69e7..c89f5131d7d 100644 --- a/Jellyfin.Server/Jellyfin.Server.csproj +++ b/Jellyfin.Server/Jellyfin.Server.csproj @@ -13,7 +13,7 @@ - + @@ -46,6 +46,7 @@ + diff --git a/Jellyfin.Versioning/AssemblyExtendedVersion.cs b/Jellyfin.Versioning/AssemblyExtendedVersion.cs new file mode 100644 index 00000000000..b2453fc8db3 --- /dev/null +++ b/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 . + +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); + } + } + } +} diff --git a/Jellyfin.Versioning/ExtendedVersion.cs b/Jellyfin.Versioning/ExtendedVersion.cs new file mode 100644 index 00000000000..de54d3829ff --- /dev/null +++ b/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 . + + +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}"; + } + } +} diff --git a/Jellyfin.Versioning/Jellyfin.Versioning.csproj b/Jellyfin.Versioning/Jellyfin.Versioning.csproj new file mode 100644 index 00000000000..8dc45dde1c0 --- /dev/null +++ b/Jellyfin.Versioning/Jellyfin.Versioning.csproj @@ -0,0 +1,20 @@ + + + + netstandard2.0 + false + + + + + + + + + + + + + + + diff --git a/Jellyfin.Versioning/Properties/AssemblyInfo.cs b/Jellyfin.Versioning/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..5ccba7ad51d --- /dev/null +++ b/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)] diff --git a/Jellyfin.Versioning/SharedVersion.cs b/Jellyfin.Versioning/SharedVersion.cs new file mode 100644 index 00000000000..574a852e43b --- /dev/null +++ b/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)] diff --git a/Jellyfin.Versioning/update-version b/Jellyfin.Versioning/update-version new file mode 100755 index 00000000000..e8d4fab6ddb --- /dev/null +++ b/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 . + +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 <. +:licenseblock + +powershell.exe -executionpolicy Bypass -file update-version.ps1 \ No newline at end of file diff --git a/Jellyfin.Versioning/update-version.ps1 b/Jellyfin.Versioning/update-version.ps1 new file mode 100644 index 00000000000..2f9f0cf7b26 --- /dev/null +++ b/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 . + +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. +} \ No newline at end of file diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index ba29c656bf1..67364380ace 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -6,7 +6,7 @@ - + diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index 2220d466105..314c04010b8 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -12,7 +12,7 @@ - + diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 01893f1b557..9a0d2879e75 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -13,7 +13,7 @@ - + diff --git a/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj b/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj index 867b82edede..96875143998 100644 --- a/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj +++ b/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj @@ -6,7 +6,7 @@ - + diff --git a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj index c5ed65734a1..8e40f1def91 100644 --- a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj +++ b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj @@ -6,7 +6,7 @@ - + diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index f17fd7159dd..e4fd970e0d2 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -17,7 +17,11 @@ - + + + + + diff --git a/MediaBrowser.Model/System/PublicSystemInfo.cs b/MediaBrowser.Model/System/PublicSystemInfo.cs index bc8983fd102..eded5248e29 100644 --- a/MediaBrowser.Model/System/PublicSystemInfo.cs +++ b/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; } /// - /// Gets or sets the version. + /// Gets or sets the API version. /// /// The version. public string Version { get; set; } + /// + /// Gets or sets the server version. + /// + /// The server version. + public string ServerVersion { get; set; } + + /// + /// Gets or sets the build version. + /// + /// The build version. + public ExtendedVersion ExtendedVersion { get; set; } + /// /// Gets or sets the operating sytem. /// diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index b0432ae74a1..26f7353307d 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -16,6 +16,15 @@ namespace MediaBrowser.Model.System /// The display name of the operating system. public string OperatingSystemDisplayName { get; set; } + /// + /// The product name. This is the AssemblyProduct name. + /// + public string ProductName { get; set; } + + /// + /// Get or sets the package name. + /// + /// The value of the '-package' command line argument. public string PackageName { get; set; } /// diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csproj index e6ef889c3ed..6026e4c5050 100644 --- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj +++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj @@ -7,7 +7,7 @@ - + diff --git a/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj b/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj index ba29c656bf1..67364380ace 100644 --- a/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj +++ b/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj @@ -6,7 +6,7 @@ - + diff --git a/MediaBrowser.sln b/MediaBrowser.sln index c9676553ed0..5065c96c8ca 100644 --- a/MediaBrowser.sln +++ b/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 diff --git a/Mono.Nat/Mono.Nat.csproj b/Mono.Nat/Mono.Nat.csproj index edfd5c9bb0f..30ffa7b4bdc 100644 --- a/Mono.Nat/Mono.Nat.csproj +++ b/Mono.Nat/Mono.Nat.csproj @@ -6,7 +6,7 @@ - + diff --git a/SocketHttpListener/SocketHttpListener.csproj b/SocketHttpListener/SocketHttpListener.csproj index e700540a913..f7f184892cc 100644 --- a/SocketHttpListener/SocketHttpListener.csproj +++ b/SocketHttpListener/SocketHttpListener.csproj @@ -6,7 +6,7 @@ - + From 924ec0c191b66520f7ec7d3f6dc556e06305846b Mon Sep 17 00:00:00 2001 From: Erwin de Haan Date: Sun, 20 Jan 2019 01:12:44 +0100 Subject: [PATCH 2/3] Revert Jellyfin.Versioning, Update all versions and user agents. --- BDInfo/BDInfo.csproj | 2 +- DvdLib/DvdLib.csproj | 2 +- Emby.Dlna/Emby.Dlna.csproj | 2 +- Emby.Dlna/PlayTo/PlayToManager.cs | 2 +- Emby.Drawing.Skia/Emby.Drawing.Skia.csproj | 2 +- Emby.Drawing/Emby.Drawing.csproj | 2 +- Emby.IsoMounting/IsoMounter/IsoMounter.csproj | 2 +- Emby.Naming/Emby.Naming.csproj | 2 +- Emby.Notifications/Emby.Notifications.csproj | 2 +- Emby.Photos/Emby.Photos.csproj | 2 +- .../ApplicationHost.cs | 35 ++--- .../Emby.Server.Implementations.csproj | 3 +- .../LiveTv/Listings/SchedulesDirect.cs | 2 +- .../LiveTv/TunerHosts/M3uParser.cs | 2 +- Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj | 6 +- Jellyfin.Server/Jellyfin.Server.csproj | 3 +- .../AssemblyExtendedVersion.cs | 48 ------- Jellyfin.Versioning/ExtendedVersion.cs | 133 ------------------ .../Jellyfin.Versioning.csproj | 20 --- .../Properties/AssemblyInfo.cs | 21 --- Jellyfin.Versioning/SharedVersion.cs | 8 -- Jellyfin.Versioning/update-version | 44 ------ Jellyfin.Versioning/update-version.bat | 23 --- Jellyfin.Versioning/update-version.ps1 | 31 ---- MediaBrowser.Api/MediaBrowser.Api.csproj | 2 +- MediaBrowser.Api/Session/SessionsService.cs | 3 +- MediaBrowser.Common/IApplicationHost.cs | 12 ++ .../MediaBrowser.Common.csproj | 2 +- .../MediaBrowser.Controller.csproj | 2 +- .../MediaBrowser.LocalMetadata.csproj | 2 +- .../MediaBrowser.MediaEncoding.csproj | 2 +- MediaBrowser.Model/MediaBrowser.Model.csproj | 6 +- MediaBrowser.Model/System/PublicSystemInfo.cs | 18 +-- .../MediaBrowser.Providers.csproj | 2 +- .../Movies/MovieDbProvider.cs | 2 +- .../Music/MusicBrainzAlbumProvider.cs | 2 +- .../Api/DashboardService.cs | 8 +- .../MediaBrowser.XbmcMetadata.csproj | 2 +- MediaBrowser.sln | 11 +- Mono.Nat/Mono.Nat.csproj | 2 +- .../Properties/AssemblyInfo.cs | 4 +- RSSDP/Properties/AssemblyInfo.cs | 4 +- SocketHttpListener/SocketHttpListener.csproj | 2 +- 43 files changed, 61 insertions(+), 426 deletions(-) delete mode 100644 Jellyfin.Versioning/AssemblyExtendedVersion.cs delete mode 100644 Jellyfin.Versioning/ExtendedVersion.cs delete mode 100644 Jellyfin.Versioning/Jellyfin.Versioning.csproj delete mode 100644 Jellyfin.Versioning/Properties/AssemblyInfo.cs delete mode 100644 Jellyfin.Versioning/SharedVersion.cs delete mode 100755 Jellyfin.Versioning/update-version delete mode 100644 Jellyfin.Versioning/update-version.bat delete mode 100644 Jellyfin.Versioning/update-version.ps1 diff --git a/BDInfo/BDInfo.csproj b/BDInfo/BDInfo.csproj index d1d2cefea30..b2c752d0c80 100644 --- a/BDInfo/BDInfo.csproj +++ b/BDInfo/BDInfo.csproj @@ -1,7 +1,7 @@ - + diff --git a/DvdLib/DvdLib.csproj b/DvdLib/DvdLib.csproj index d1d2cefea30..b2c752d0c80 100644 --- a/DvdLib/DvdLib.csproj +++ b/DvdLib/DvdLib.csproj @@ -1,7 +1,7 @@ - + diff --git a/Emby.Dlna/Emby.Dlna.csproj b/Emby.Dlna/Emby.Dlna.csproj index 280dc4bfab9..71ded23373f 100644 --- a/Emby.Dlna/Emby.Dlna.csproj +++ b/Emby.Dlna/Emby.Dlna.csproj @@ -1,7 +1,7 @@ - + diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs index 2836ee95d9e..cdc8f771739 100644 --- a/Emby.Dlna/PlayTo/PlayToManager.cs +++ b/Emby.Dlna/PlayTo/PlayToManager.cs @@ -164,7 +164,7 @@ namespace Emby.Dlna.PlayTo string deviceName = null; - var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationVersion.ToString(), uuid, deviceName, uri.OriginalString, null); + var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationSemanticVersion, uuid, deviceName, uri.OriginalString, null); var controller = sessionInfo.SessionControllers.OfType().FirstOrDefault(); diff --git a/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj b/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj index 6491f44b876..1eb53774113 100644 --- a/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj +++ b/Emby.Drawing.Skia/Emby.Drawing.Skia.csproj @@ -17,7 +17,7 @@ - + diff --git a/Emby.Drawing/Emby.Drawing.csproj b/Emby.Drawing/Emby.Drawing.csproj index 67364380ace..ba29c656bf1 100644 --- a/Emby.Drawing/Emby.Drawing.csproj +++ b/Emby.Drawing/Emby.Drawing.csproj @@ -6,7 +6,7 @@ - + diff --git a/Emby.IsoMounting/IsoMounter/IsoMounter.csproj b/Emby.IsoMounting/IsoMounter/IsoMounter.csproj index 518b2372fcd..dafa51cd51a 100644 --- a/Emby.IsoMounting/IsoMounter/IsoMounter.csproj +++ b/Emby.IsoMounting/IsoMounter/IsoMounter.csproj @@ -1,7 +1,7 @@ - + diff --git a/Emby.Naming/Emby.Naming.csproj b/Emby.Naming/Emby.Naming.csproj index 419cf101db1..e344e7811ec 100644 --- a/Emby.Naming/Emby.Naming.csproj +++ b/Emby.Naming/Emby.Naming.csproj @@ -6,7 +6,7 @@ - + diff --git a/Emby.Notifications/Emby.Notifications.csproj b/Emby.Notifications/Emby.Notifications.csproj index 8fa21635e31..5c68e48c8f0 100644 --- a/Emby.Notifications/Emby.Notifications.csproj +++ b/Emby.Notifications/Emby.Notifications.csproj @@ -6,7 +6,7 @@ - + diff --git a/Emby.Photos/Emby.Photos.csproj b/Emby.Photos/Emby.Photos.csproj index 9ad2afb6977..e6b445202fc 100644 --- a/Emby.Photos/Emby.Photos.csproj +++ b/Emby.Photos/Emby.Photos.csproj @@ -7,7 +7,7 @@ - + diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index f186ccdaa12..91ba3903d53 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -47,7 +47,6 @@ 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; @@ -430,28 +429,20 @@ namespace Emby.Server.Implementations _validAddressResults.Clear(); } - private Version _version; - /// - /// Gets the current application version - /// - /// The application version. - public Version ApplicationVersion => _version ?? (_version = ApplicationExtendedVersion.ApiVersion); - - private Version _serverVersion; + private Version _applicationVersion; /// /// Gets the current application server version /// /// The application server version. - public Version ApplicationServerVersion => _serverVersion ?? (_serverVersion = typeof(ApplicationHost).Assembly.GetName().Version); + public Version ApplicationVersion => _applicationVersion ?? (_applicationVersion = typeof(ApplicationHost).Assembly.GetName().Version); + + public string ApplicationSemanticVersion => ApplicationVersion.ToString(3); - private ExtendedVersion _extendedVersion; /// /// Gets the current application server version /// /// The application server version. - public ExtendedVersion ApplicationExtendedVersion => _extendedVersion ?? - (_extendedVersion = typeof(ApplicationHost).Assembly.GetCustomAttributes(typeof(AssemblyExtendedVersion), false) - .Cast().FirstOrDefault().ExtendedVersion); + public string ApplicationUserAgent => Name + "/" + ApplicationSemanticVersion; private string _productName; /// @@ -478,7 +469,7 @@ namespace Emby.Server.Implementations /// Gets the name. /// /// The name. - public string Name => "Emby Server"; + public string Name => "Jellyfin"; private static Tuple GetAssembly(Type type) { @@ -1028,9 +1019,7 @@ namespace Emby.Server.Implementations protected string GetDefaultUserAgent() { - var name = FormatAttribute(Name); - - return name + "/" + ApplicationVersion; + return ApplicationUserAgent; } private static string FormatAttribute(string str) @@ -1044,7 +1033,7 @@ namespace Emby.Server.Implementations if (string.IsNullOrWhiteSpace(result)) { - result = "Emby"; + result = "Jellyfin"; } return result; @@ -1849,9 +1838,7 @@ namespace Emby.Server.Implementations { HasPendingRestart = HasPendingRestart, IsShuttingDown = IsShuttingDown, - Version = ApplicationVersion.ToString(), - ServerVersion = ApplicationServerVersion.ToString(), - ExtendedVersion = ApplicationExtendedVersion, + Version = ApplicationSemanticVersion, ProductName = ApplicationProductName, WebSocketPortNumber = HttpPort, CompletedInstallations = InstallationManager.CompletedInstallations.ToArray(), @@ -1898,9 +1885,7 @@ namespace Emby.Server.Implementations var wanAddress = await GetWanApiUrl(cancellationToken).ConfigureAwait(false); return new PublicSystemInfo { - Version = ApplicationVersion.ToString(), - ServerVersion = ApplicationServerVersion.ToString(), - ExtendedVersion = ApplicationExtendedVersion, + Version = ApplicationSemanticVersion, Id = SystemId, OperatingSystem = EnvironmentInfo.OperatingSystem.ToString(), WanAddress = wanAddress, diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 843718756df..5a0e1da4d76 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -3,7 +3,6 @@ - @@ -31,7 +30,7 @@ - + diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index d3066e91612..0bbffb824b7 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -38,7 +38,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings _appHost = appHost; } - private string UserAgent => "Emby/" + _appHost.ApplicationVersion; + private string UserAgent => _appHost.ApplicationUserAgent; private static List GetScheduleRequestDates(DateTime startDateUtc, DateTime endDateUtc) { diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs index c77559c75d1..7d6c0f67bdf 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs @@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts Url = url, CancellationToken = cancellationToken, // Some data providers will require a user agent - UserAgent = _appHost.FriendlyName + "/" + _appHost.ApplicationVersion + UserAgent = _appHost.ApplicationSemanticVersion }); } return Task.FromResult(_fileSystem.OpenRead(url)); diff --git a/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj b/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj index dfda0f17061..0225be2c2fa 100644 --- a/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj +++ b/Emby.XmlTv/Emby.XmlTv/Emby.XmlTv.csproj @@ -6,11 +6,7 @@ - - - - - + diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj index c89f5131d7d..f17e06e69e7 100644 --- a/Jellyfin.Server/Jellyfin.Server.csproj +++ b/Jellyfin.Server/Jellyfin.Server.csproj @@ -13,7 +13,7 @@ - + @@ -46,7 +46,6 @@ - diff --git a/Jellyfin.Versioning/AssemblyExtendedVersion.cs b/Jellyfin.Versioning/AssemblyExtendedVersion.cs deleted file mode 100644 index b2453fc8db3..00000000000 --- a/Jellyfin.Versioning/AssemblyExtendedVersion.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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 . - -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); - } - } - } -} diff --git a/Jellyfin.Versioning/ExtendedVersion.cs b/Jellyfin.Versioning/ExtendedVersion.cs deleted file mode 100644 index de54d3829ff..00000000000 --- a/Jellyfin.Versioning/ExtendedVersion.cs +++ /dev/null @@ -1,133 +0,0 @@ -// 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 . - - -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}"; - } - } -} diff --git a/Jellyfin.Versioning/Jellyfin.Versioning.csproj b/Jellyfin.Versioning/Jellyfin.Versioning.csproj deleted file mode 100644 index 8dc45dde1c0..00000000000 --- a/Jellyfin.Versioning/Jellyfin.Versioning.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - netstandard2.0 - false - - - - - - - - - - - - - - - diff --git a/Jellyfin.Versioning/Properties/AssemblyInfo.cs b/Jellyfin.Versioning/Properties/AssemblyInfo.cs deleted file mode 100644 index 5ccba7ad51d..00000000000 --- a/Jellyfin.Versioning/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,21 +0,0 @@ -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)] diff --git a/Jellyfin.Versioning/SharedVersion.cs b/Jellyfin.Versioning/SharedVersion.cs deleted file mode 100644 index 574a852e43b..00000000000 --- a/Jellyfin.Versioning/SharedVersion.cs +++ /dev/null @@ -1,8 +0,0 @@ -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)] diff --git a/Jellyfin.Versioning/update-version b/Jellyfin.Versioning/update-version deleted file mode 100755 index e8d4fab6ddb..00000000000 --- a/Jellyfin.Versioning/update-version +++ /dev/null @@ -1,44 +0,0 @@ -#!/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 . - -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 <. -:licenseblock - -powershell.exe -executionpolicy Bypass -file update-version.ps1 \ No newline at end of file diff --git a/Jellyfin.Versioning/update-version.ps1 b/Jellyfin.Versioning/update-version.ps1 deleted file mode 100644 index 2f9f0cf7b26..00000000000 --- a/Jellyfin.Versioning/update-version.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# 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 . - -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. -} \ No newline at end of file diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index 67364380ace..ba29c656bf1 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -6,7 +6,7 @@ - + diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs index 234ada6c0d3..cba278c1ef0 100644 --- a/MediaBrowser.Api/Session/SessionsService.cs +++ b/MediaBrowser.Api/Session/SessionsService.cs @@ -309,8 +309,7 @@ namespace MediaBrowser.Api.Session DateCreated = DateTime.UtcNow, DeviceId = _appHost.SystemId, DeviceName = _appHost.FriendlyName, - AppVersion = _appHost.ApplicationVersion.ToString() - + AppVersion = _appHost.ApplicationSemanticVersion }); } diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs index bc6c3a984ad..94dd251cf2b 100644 --- a/MediaBrowser.Common/IApplicationHost.cs +++ b/MediaBrowser.Common/IApplicationHost.cs @@ -71,6 +71,18 @@ namespace MediaBrowser.Common /// The application version. Version ApplicationVersion { get; } + /// + /// Gets the application semantic version. + /// + /// The application semantic version. + string ApplicationSemanticVersion { get; } + + /// + /// Gets the application user agent. + /// + /// The application user agent. + string ApplicationUserAgent { get; } + /// /// Gets or sets a value indicating whether this instance can self update. /// diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index 314c04010b8..2220d466105 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -12,7 +12,7 @@ - + diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 9a0d2879e75..01893f1b557 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -13,7 +13,7 @@ - + diff --git a/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj b/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj index 96875143998..867b82edede 100644 --- a/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj +++ b/MediaBrowser.LocalMetadata/MediaBrowser.LocalMetadata.csproj @@ -6,7 +6,7 @@ - + diff --git a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj index 8e40f1def91..c5ed65734a1 100644 --- a/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj +++ b/MediaBrowser.MediaEncoding/MediaBrowser.MediaEncoding.csproj @@ -6,7 +6,7 @@ - + diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index e4fd970e0d2..f17fd7159dd 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -17,11 +17,7 @@ - - - - - + diff --git a/MediaBrowser.Model/System/PublicSystemInfo.cs b/MediaBrowser.Model/System/PublicSystemInfo.cs index eded5248e29..accdc9e6019 100644 --- a/MediaBrowser.Model/System/PublicSystemInfo.cs +++ b/MediaBrowser.Model/System/PublicSystemInfo.cs @@ -1,5 +1,3 @@ -using Jellyfin.Versioning; - namespace MediaBrowser.Model.System { public class PublicSystemInfo @@ -22,23 +20,11 @@ namespace MediaBrowser.Model.System /// The name of the server. public string ServerName { get; set; } - /// - /// Gets or sets the API version. - /// - /// The version. - public string Version { get; set; } - /// /// Gets or sets the server version. /// - /// The server version. - public string ServerVersion { get; set; } - - /// - /// Gets or sets the build version. - /// - /// The build version. - public ExtendedVersion ExtendedVersion { get; set; } + /// The version. + public string Version { get; set; } /// /// Gets or sets the operating sytem. diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csproj index 6026e4c5050..e6ef889c3ed 100644 --- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj +++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj @@ -7,7 +7,7 @@ - + diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index aaed69459e7..f03a8c2c289 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -424,7 +424,7 @@ namespace MediaBrowser.Providers.Movies _lastRequestTicks = DateTime.UtcNow.Ticks; options.BufferContent = true; - options.UserAgent = "Emby/" + _appHost.ApplicationVersion; + options.UserAgent = _appHost.ApplicationUserAgent; return await _httpClient.SendAsync(options, "GET").ConfigureAwait(false); } diff --git a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs index 3ad96844979..ecae0c39da8 100644 --- a/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/MusicBrainzAlbumProvider.cs @@ -742,7 +742,7 @@ namespace MediaBrowser.Providers.Music { Url = url, CancellationToken = cancellationToken, - UserAgent = _appHost.Name + "/" + _appHost.ApplicationVersion, + UserAgent = _appHost.ApplicationUserAgent, BufferContent = throttleMs > 0 }; diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 53a4146490d..c31f3a97e11 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -205,7 +205,7 @@ namespace MediaBrowser.WebDashboard.Api return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => Task.FromResult(stream)); } - return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator(DashboardUIPath).ModifyHtml("dummy.html", stream, null, _appHost.ApplicationVersion.ToString(), null)); + return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator(DashboardUIPath).ModifyHtml("dummy.html", stream, null, _appHost.ApplicationSemanticVersion, null)); } throw new ResourceNotFoundException(); @@ -342,7 +342,7 @@ namespace MediaBrowser.WebDashboard.Api cacheDuration = TimeSpan.FromDays(365); } - var cacheKey = (_appHost.ApplicationVersion + (localizationCulture ?? string.Empty) + path).GetMD5(); + var cacheKey = (_appHost.ApplicationSemanticVersion + (localizationCulture ?? string.Empty) + path).GetMD5(); // html gets modified on the fly if (contentType.StartsWith("text/html", StringComparison.OrdinalIgnoreCase)) @@ -364,7 +364,7 @@ namespace MediaBrowser.WebDashboard.Api private Task GetResourceStream(string basePath, string virtualPath, string localizationCulture) { return GetPackageCreator(basePath) - .GetResource(virtualPath, null, localizationCulture, _appHost.ApplicationVersion.ToString()); + .GetResource(virtualPath, null, localizationCulture, _appHost.ApplicationSemanticVersion); } private PackageCreator GetPackageCreator(string basePath) @@ -400,7 +400,7 @@ namespace MediaBrowser.WebDashboard.Api CopyDirectory(inputPath, targetPath); } - var appVersion = _appHost.ApplicationVersion.ToString(); + var appVersion = _appHost.ApplicationSemanticVersion; await DumpHtml(packageCreator, inputPath, targetPath, mode, appVersion); diff --git a/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj b/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj index 67364380ace..ba29c656bf1 100644 --- a/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj +++ b/MediaBrowser.XbmcMetadata/MediaBrowser.XbmcMetadata.csproj @@ -6,7 +6,7 @@ - + diff --git a/MediaBrowser.sln b/MediaBrowser.sln index 5065c96c8ca..f1976c3c7e5 100644 --- a/MediaBrowser.sln +++ b/MediaBrowser.sln @@ -1,4 +1,3 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26730.3 @@ -58,10 +57,9 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{41093F42-C7CC-4D07-956B-6182CBEDE2EC}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig + SharedVersion.cs = SharedVersion.cs 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 @@ -172,10 +170,6 @@ 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 @@ -184,12 +178,9 @@ Global SolutionGuid = {3448830C-EBDC-426C-85CD-7BBB9651A7FE} EndGlobalSection GlobalSection(AutomaticVersions) = postSolution - PrimaryVersionType = AssemblyFileVersionAttribute UpdateAssemblyVersion = True UpdateAssemblyFileVersion = True UpdateAssemblyInfoVersion = True - ShouldCreateLogs = True - AdvancedSettingsExpanded = True AssemblyVersionSettings = None.None.None.None AssemblyFileVersionSettings = None.None.None.None AssemblyInfoVersionSettings = None.None.None.None diff --git a/Mono.Nat/Mono.Nat.csproj b/Mono.Nat/Mono.Nat.csproj index 30ffa7b4bdc..edfd5c9bb0f 100644 --- a/Mono.Nat/Mono.Nat.csproj +++ b/Mono.Nat/Mono.Nat.csproj @@ -6,7 +6,7 @@ - + diff --git a/OpenSubtitlesHandler/Properties/AssemblyInfo.cs b/OpenSubtitlesHandler/Properties/AssemblyInfo.cs index ad4fbbb0219..b5ae23021c4 100644 --- a/OpenSubtitlesHandler/Properties/AssemblyInfo.cs +++ b/OpenSubtitlesHandler/Properties/AssemblyInfo.cs @@ -20,5 +20,5 @@ using System.Runtime.InteropServices; // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.3.0")] +[assembly: AssemblyFileVersion("2019.1.20.3")] diff --git a/RSSDP/Properties/AssemblyInfo.cs b/RSSDP/Properties/AssemblyInfo.cs index 7098279b461..d2bb7c6f311 100644 --- a/RSSDP/Properties/AssemblyInfo.cs +++ b/RSSDP/Properties/AssemblyInfo.cs @@ -20,5 +20,5 @@ using System.Runtime.InteropServices; // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.3.0")] +[assembly: AssemblyFileVersion("2019.1.20.3")] diff --git a/SocketHttpListener/SocketHttpListener.csproj b/SocketHttpListener/SocketHttpListener.csproj index f7f184892cc..e700540a913 100644 --- a/SocketHttpListener/SocketHttpListener.csproj +++ b/SocketHttpListener/SocketHttpListener.csproj @@ -6,7 +6,7 @@ - + From e066a02403b5e850233e18321835a216514ae856 Mon Sep 17 00:00:00 2001 From: Erwin de Haan Date: Sun, 20 Jan 2019 01:20:58 +0100 Subject: [PATCH 3/3] Removed useless method, Name => Jellyfin Server --- .../ApplicationHost.cs | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 91ba3903d53..f0e2eec2021 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -442,7 +442,7 @@ namespace Emby.Server.Implementations /// Gets the current application server version /// /// The application server version. - public string ApplicationUserAgent => Name + "/" + ApplicationSemanticVersion; + public string ApplicationUserAgent => Name.Replace(' ','-') + "/" + ApplicationSemanticVersion; private string _productName; /// @@ -469,7 +469,7 @@ namespace Emby.Server.Implementations /// Gets the name. /// /// The name. - public string Name => "Jellyfin"; + public string Name => "Jellyfin Server"; private static Tuple GetAssembly(Type type) { @@ -1022,23 +1022,6 @@ namespace Emby.Server.Implementations return ApplicationUserAgent; } - private static string FormatAttribute(string str) - { - var arr = str.ToCharArray(); - - arr = Array.FindAll(arr, (c => (char.IsLetterOrDigit(c) - || char.IsWhiteSpace(c)))); - - var result = new string(arr); - - if (string.IsNullOrWhiteSpace(result)) - { - result = "Jellyfin"; - } - - return result; - } - protected virtual bool SupportsDualModeSockets => true; private X509Certificate GetCertificate(CertificateInfo info)