mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-10-31 02:27:18 -04:00 
			
		
		
		
	Re-Sharper inspection issues
This commit is contained in:
		
							parent
							
								
									59619b6ea7
								
							
						
					
					
						commit
						60b49e67ea
					
				| @ -1,6 +1,5 @@ | ||||
| #pragma warning disable CS1591 | ||||
| 
 | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using Emby.Naming.Common; | ||||
|  | ||||
| @ -47,7 +47,7 @@ namespace Emby.Naming.AudioBook | ||||
|                 container, | ||||
|                 chapterNumber: parsingResult.ChapterNumber, | ||||
|                 partNumber: parsingResult.PartNumber, | ||||
|                 isDirectory: isDirectory ); | ||||
|                 isDirectory: isDirectory); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -6,6 +6,8 @@ using System.Text.RegularExpressions; | ||||
| using Emby.Naming.Video; | ||||
| using MediaBrowser.Model.Entities; | ||||
| 
 | ||||
| // ReSharper disable StringLiteralTypo | ||||
| 
 | ||||
| namespace Emby.Naming.Common | ||||
| { | ||||
|     public class NamingOptions | ||||
| @ -531,19 +533,19 @@ namespace Emby.Naming.Common | ||||
|             { | ||||
|                 // Kodi rules: | ||||
|                 new Format3DRule( | ||||
|                     preceedingToken: "3d", | ||||
|                     precedingToken: "3d", | ||||
|                     token: "hsbs"), | ||||
| 
 | ||||
|                 new Format3DRule( | ||||
|                     preceedingToken: "3d", | ||||
|                     precedingToken: "3d", | ||||
|                     token: "sbs"), | ||||
| 
 | ||||
|                 new Format3DRule( | ||||
|                     preceedingToken: "3d", | ||||
|                     precedingToken: "3d", | ||||
|                     token: "htab"), | ||||
| 
 | ||||
|                 new Format3DRule( | ||||
|                     preceedingToken: "3d", | ||||
|                     precedingToken: "3d", | ||||
|                     token: "tab"), | ||||
| 
 | ||||
|                  // Media Browser rules: | ||||
| @ -608,7 +610,7 @@ namespace Emby.Naming.Common | ||||
|                 ".mxf" | ||||
|             }); | ||||
| 
 | ||||
|             MultipleEpisodeExpressions = new string[] | ||||
|             MultipleEpisodeExpressions = new[] | ||||
|             { | ||||
|                 @".*(\\|\/)[sS]?(?<seasonnumber>[0-9]{1,4})[xX](?<epnumber>[0-9]{1,3})((-| - )[0-9]{1,4}[eExX](?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$", | ||||
|                 @".*(\\|\/)[sS]?(?<seasonnumber>[0-9]{1,4})[xX](?<epnumber>[0-9]{1,3})((-| - )[0-9]{1,4}[xX][eE](?<endingepnumber>[0-9]{1,3}))+[^\\\/]*$", | ||||
|  | ||||
| @ -39,7 +39,7 @@ | ||||
|   </PropertyGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> | ||||
|     <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" /> | ||||
|   </ItemGroup> | ||||
| 
 | ||||
|   <!-- Code Analyzers--> | ||||
|  | ||||
| @ -55,7 +55,7 @@ namespace Emby.Naming.TV | ||||
| 
 | ||||
|         public int? EpisodeNumber { get; set; } | ||||
| 
 | ||||
|         public int? EndingEpsiodeNumber { get; set; } | ||||
|         public int? EndingEpisodeNumber { get; set; } | ||||
| 
 | ||||
|         public int? Year { get; set; } | ||||
| 
 | ||||
|  | ||||
| @ -146,7 +146,7 @@ namespace Emby.Naming.TV | ||||
|                         { | ||||
|                             if (int.TryParse(endingNumberGroup.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out num)) | ||||
|                             { | ||||
|                                 result.EndingEpsiodeNumber = num; | ||||
|                                 result.EndingEpisodeNumber = num; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
| @ -217,13 +217,13 @@ namespace Emby.Naming.TV | ||||
|                     info.SeriesName = result.SeriesName; | ||||
|                 } | ||||
| 
 | ||||
|                 if (!info.EndingEpsiodeNumber.HasValue && info.EpisodeNumber.HasValue) | ||||
|                 if (!info.EndingEpisodeNumber.HasValue && info.EpisodeNumber.HasValue) | ||||
|                 { | ||||
|                     info.EndingEpsiodeNumber = result.EndingEpsiodeNumber; | ||||
|                     info.EndingEpisodeNumber = result.EndingEpisodeNumber; | ||||
|                 } | ||||
| 
 | ||||
|                 if (!string.IsNullOrEmpty(info.SeriesName) | ||||
|                     && (!info.EpisodeNumber.HasValue || info.EndingEpsiodeNumber.HasValue)) | ||||
|                     && (!info.EpisodeNumber.HasValue || info.EndingEpisodeNumber.HasValue)) | ||||
|                 { | ||||
|                     break; | ||||
|                 } | ||||
|  | ||||
| @ -8,7 +8,7 @@ namespace Emby.Naming.TV | ||||
| 
 | ||||
|         public int? EpisodeNumber { get; set; } | ||||
| 
 | ||||
|         public int? EndingEpsiodeNumber { get; set; } | ||||
|         public int? EndingEpisodeNumber { get; set; } | ||||
| 
 | ||||
|         public string? SeriesName { get; set; } | ||||
| 
 | ||||
|  | ||||
| @ -58,7 +58,7 @@ namespace Emby.Naming.TV | ||||
|             { | ||||
|                 Container = container, | ||||
|                 IsStub = isStub, | ||||
|                 EndingEpsiodeNumber = parsingResult.EndingEpsiodeNumber, | ||||
|                 EndingEpisodeNumber = parsingResult.EndingEpisodeNumber, | ||||
|                 EpisodeNumber = parsingResult.EpisodeNumber, | ||||
|                 SeasonNumber = parsingResult.SeasonNumber, | ||||
|                 SeriesName = parsingResult.SeriesName, | ||||
|  | ||||
| @ -101,9 +101,9 @@ namespace Emby.Naming.TV | ||||
|             } | ||||
| 
 | ||||
|             var parts = filename.Split(new[] { '.', '_', ' ', '-' }, StringSplitOptions.RemoveEmptyEntries); | ||||
|             for (int i = 0; i < parts.Length; i++) | ||||
|             foreach (var part in parts) | ||||
|             { | ||||
|                 if (TryGetSeasonNumberFromPart(parts[i], out int seasonNumber)) | ||||
|                 if (TryGetSeasonNumberFromPart(part, out int seasonNumber)) | ||||
|                 { | ||||
|                     return (seasonNumber, true); | ||||
|                 } | ||||
| @ -139,7 +139,7 @@ namespace Emby.Naming.TV | ||||
|             var numericStart = -1; | ||||
|             var length = 0; | ||||
| 
 | ||||
|             var hasOpenParenth = false; | ||||
|             var hasOpenParenthesis = false; | ||||
|             var isSeasonFolder = true; | ||||
| 
 | ||||
|             // Find out where the numbers start, and then keep going until they end | ||||
| @ -147,7 +147,7 @@ namespace Emby.Naming.TV | ||||
|             { | ||||
|                 if (char.IsNumber(path[i])) | ||||
|                 { | ||||
|                     if (!hasOpenParenth) | ||||
|                     if (!hasOpenParenthesis) | ||||
|                     { | ||||
|                         if (numericStart == -1) | ||||
|                         { | ||||
| @ -167,11 +167,11 @@ namespace Emby.Naming.TV | ||||
|                 var currentChar = path[i]; | ||||
|                 if (currentChar == '(') | ||||
|                 { | ||||
|                     hasOpenParenth = true; | ||||
|                     hasOpenParenthesis = true; | ||||
|                 } | ||||
|                 else if (currentChar == ')') | ||||
|                 { | ||||
|                     hasOpenParenth = false; | ||||
|                     hasOpenParenthesis = false; | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|  | ||||
| @ -22,6 +22,6 @@ namespace Emby.Naming.Video | ||||
|         /// <summary> | ||||
|         /// Match <see cref="ExtraRule.Token"/> against the name of the directory containing the file. | ||||
|         /// </summary> | ||||
|         DirectoryName = 3, | ||||
|         DirectoryName = 3 | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -20,7 +20,7 @@ namespace Emby.Naming.Video | ||||
|             return GetFlags(path, _options.VideoFlagDelimiters); | ||||
|         } | ||||
| 
 | ||||
|         public string[] GetFlags(string path, char[] delimeters) | ||||
|         public string[] GetFlags(string path, char[] delimiters) | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(path)) | ||||
|             { | ||||
| @ -31,7 +31,7 @@ namespace Emby.Naming.Video | ||||
| 
 | ||||
|             var file = Path.GetFileName(path); | ||||
| 
 | ||||
|             return file.Split(delimeters, StringSplitOptions.RemoveEmptyEntries); | ||||
|             return file.Split(delimiters, StringSplitOptions.RemoveEmptyEntries); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -18,11 +18,11 @@ namespace Emby.Naming.Video | ||||
|         public Format3DResult Parse(string path) | ||||
|         { | ||||
|             int oldLen = _options.VideoFlagDelimiters.Length; | ||||
|             var delimeters = new char[oldLen + 1]; | ||||
|             _options.VideoFlagDelimiters.CopyTo(delimeters, 0); | ||||
|             delimeters[oldLen] = ' '; | ||||
|             var delimiters = new char[oldLen + 1]; | ||||
|             _options.VideoFlagDelimiters.CopyTo(delimiters, 0); | ||||
|             delimiters[oldLen] = ' '; | ||||
| 
 | ||||
|             return Parse(new FlagParser(_options).GetFlags(path, delimeters)); | ||||
|             return Parse(new FlagParser(_options).GetFlags(path, delimiters)); | ||||
|         } | ||||
| 
 | ||||
|         internal Format3DResult Parse(string[] videoFlags) | ||||
| @ -44,7 +44,7 @@ namespace Emby.Naming.Video | ||||
|         { | ||||
|             var result = new Format3DResult(); | ||||
| 
 | ||||
|             if (string.IsNullOrEmpty(rule.PreceedingToken)) | ||||
|             if (string.IsNullOrEmpty(rule.PrecedingToken)) | ||||
|             { | ||||
|                 result.Format3D = new[] { rule.Token }.FirstOrDefault(i => videoFlags.Contains(i, StringComparer.OrdinalIgnoreCase)); | ||||
|                 result.Is3D = !string.IsNullOrEmpty(result.Format3D); | ||||
| @ -63,7 +63,7 @@ namespace Emby.Naming.Video | ||||
|                 { | ||||
|                     if (foundPrefix) | ||||
|                     { | ||||
|                         result.Tokens.Add(rule.PreceedingToken); | ||||
|                         result.Tokens.Add(rule.PrecedingToken); | ||||
| 
 | ||||
|                         if (string.Equals(rule.Token, flag, StringComparison.OrdinalIgnoreCase)) | ||||
|                         { | ||||
| @ -74,7 +74,7 @@ namespace Emby.Naming.Video | ||||
|                         break; | ||||
|                     } | ||||
| 
 | ||||
|                     foundPrefix = string.Equals(flag, rule.PreceedingToken, StringComparison.OrdinalIgnoreCase); | ||||
|                     foundPrefix = string.Equals(flag, rule.PrecedingToken, StringComparison.OrdinalIgnoreCase); | ||||
|                 } | ||||
| 
 | ||||
|                 result.Is3D = foundPrefix && !string.IsNullOrEmpty(format); | ||||
|  | ||||
| @ -4,10 +4,10 @@ namespace Emby.Naming.Video | ||||
| { | ||||
|     public class Format3DRule | ||||
|     { | ||||
|         public Format3DRule(string token, string? preceedingToken = null) | ||||
|         public Format3DRule(string token, string? precedingToken = null) | ||||
|         { | ||||
|             Token = token; | ||||
|             PreceedingToken = preceedingToken; | ||||
|             PrecedingToken = precedingToken; | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
| @ -17,9 +17,9 @@ namespace Emby.Naming.Video | ||||
|         public string Token { get; set; } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// Gets or sets the preceeding token. | ||||
|         /// Gets or sets the preceding token. | ||||
|         /// </summary> | ||||
|         /// <value>The preceeding token.</value> | ||||
|         public string? PreceedingToken { get; set; } | ||||
|         /// <value>The preceding token.</value> | ||||
|         public string? PrecedingToken { get; set; } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1,19 +0,0 @@ | ||||
| #pragma warning disable CS1591 | ||||
| 
 | ||||
| namespace Emby.Naming.Video | ||||
| { | ||||
|     public struct StubResult | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// Gets or sets a value indicating whether this instance is stub. | ||||
|         /// </summary> | ||||
|         /// <value><c>true</c> if this instance is stub; otherwise, <c>false</c>.</value> | ||||
|         public bool IsStub { get; set; } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// Gets or sets the type of the stub. | ||||
|         /// </summary> | ||||
|         /// <value>The type of the stub.</value> | ||||
|         public string StubType { get; set; } | ||||
|     } | ||||
| } | ||||
| @ -136,7 +136,7 @@ namespace Emby.Naming.Video | ||||
|             } | ||||
| 
 | ||||
|             // If there's only one video, accept all trailers | ||||
|             // Be lenient because people use all kinds of mish mash conventions with trailers | ||||
|             // Be lenient because people use all kinds of mishmash conventions with trailers | ||||
|             if (list.Count == 1) | ||||
|             { | ||||
|                 var trailers = remainingFiles | ||||
|  | ||||
| @ -2562,12 +2562,12 @@ namespace Emby.Server.Implementations.Library | ||||
| 
 | ||||
|                 if (!episode.IndexNumberEnd.HasValue || forceRefresh) | ||||
|                 { | ||||
|                     if (episode.IndexNumberEnd != episodeInfo.EndingEpsiodeNumber) | ||||
|                     if (episode.IndexNumberEnd != episodeInfo.EndingEpisodeNumber) | ||||
|                     { | ||||
|                         changed = true; | ||||
|                     } | ||||
| 
 | ||||
|                     episode.IndexNumberEnd = episodeInfo.EndingEpsiodeNumber; | ||||
|                     episode.IndexNumberEnd = episodeInfo.EndingEpisodeNumber; | ||||
|                 } | ||||
| 
 | ||||
|                 if (!episode.ParentIndexNumber.HasValue || forceRefresh) | ||||
|  | ||||
| @ -74,7 +74,7 @@ namespace Jellyfin.Naming.Tests.TV | ||||
|             var result = new EpisodePathParser(options) | ||||
|                 .Parse(filename, false); | ||||
| 
 | ||||
|             Assert.Equal(result.EndingEpsiodeNumber, endingEpisodeNumber); | ||||
|             Assert.Equal(result.EndingEpisodeNumber, endingEpisodeNumber); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user