mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-04 06:48:35 +01:00
live tv stream adjustments, add additional dlna params
This commit is contained in:
@@ -1184,7 +1184,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return GetImageInfo(type, imageIndex) != null;
|
||||
}
|
||||
|
||||
public void SetImagePath(ImageType type, int index, FileInfo file)
|
||||
public void SetImagePath(ImageType type, int index, FileSystemInfo file)
|
||||
{
|
||||
if (type == ImageType.Chapter)
|
||||
{
|
||||
@@ -1339,7 +1339,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <param name="images">The images.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
/// <exception cref="System.ArgumentException">Cannot call AddImages with chapter images</exception>
|
||||
public bool AddImages(ImageType imageType, IEnumerable<FileInfo> images)
|
||||
public bool AddImages(ImageType imageType, IEnumerable<FileSystemInfo> images)
|
||||
{
|
||||
if (imageType == ImageType.Chapter)
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="index">The index.</param>
|
||||
/// <param name="file">The file.</param>
|
||||
void SetImagePath(ImageType type, int index, FileInfo file);
|
||||
void SetImagePath(ImageType type, int index, FileSystemInfo file);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified type has image.
|
||||
@@ -129,7 +129,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <param name="imageType">Type of the image.</param>
|
||||
/// <param name="images">The images.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
bool AddImages(ImageType imageType, IEnumerable<FileInfo> images);
|
||||
bool AddImages(ImageType imageType, IEnumerable<FileSystemInfo> images);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [is save local metadata enabled].
|
||||
@@ -180,7 +180,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="imageType">Type of the image.</param>
|
||||
/// <param name="file">The file.</param>
|
||||
public static void SetImagePath(this IHasImages item, ImageType imageType, FileInfo file)
|
||||
public static void SetImagePath(this IHasImages item, ImageType imageType, FileSystemInfo file)
|
||||
{
|
||||
item.SetImagePath(imageType, 0, file);
|
||||
}
|
||||
|
||||
@@ -27,94 +27,94 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <summary>
|
||||
/// A season folder must contain one of these somewhere in the name
|
||||
/// </summary>
|
||||
private static readonly string[] SeasonFolderNames = new[]
|
||||
{
|
||||
"season",
|
||||
"sæson",
|
||||
"temporada",
|
||||
"saison",
|
||||
"staffel",
|
||||
"series",
|
||||
"сезон"
|
||||
};
|
||||
private static readonly string[] SeasonFolderNames =
|
||||
{
|
||||
"season",
|
||||
"sæson",
|
||||
"temporada",
|
||||
"saison",
|
||||
"staffel",
|
||||
"series",
|
||||
"сезон"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Used to detect paths that represent episodes, need to make sure they don't also
|
||||
/// match movie titles like "2001 A Space..."
|
||||
/// Currently we limit the numbers here to 2 digits to try and avoid this
|
||||
/// </summary>
|
||||
private static readonly Regex[] EpisodeExpressions = new[]
|
||||
{
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3})[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS](?<seasonnumber>\d{1,4})[x,X]?[eE](?<epnumber>\d{1,3})[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})[xX\.]?[eE](?<epnumber>\d{1,3})[^\\\/]*$",
|
||||
RegexOptions.Compiled)
|
||||
};
|
||||
private static readonly Regex[] MultipleEpisodeExpressions = new[]
|
||||
{
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3})((-| - )\d{1,4}[eExX](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3})((-| - )\d{1,4}[xX][eE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3})((-| - )?[xXeE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3})(-[xE]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))((-| - )\d{1,4}[xXeE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))((-| - )\d{1,4}[xX][eE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))((-| - )?[xXeE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))(-[xX]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})[xX\.]?[eE](?<epnumber>\d{1,3})((-| - )?[xXeE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})[xX\.]?[eE](?<epnumber>\d{1,3})(-[xX]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled)
|
||||
};
|
||||
private static readonly Regex[] EpisodeExpressions =
|
||||
{
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3})[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS](?<seasonnumber>\d{1,4})[x,X]?[eE](?<epnumber>\d{1,3})[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})[xX\.]?[eE](?<epnumber>\d{1,3})[^\\\/]*$",
|
||||
RegexOptions.Compiled)
|
||||
};
|
||||
private static readonly Regex[] MultipleEpisodeExpressions =
|
||||
{
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3})((-| - )\d{1,4}[eExX](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3})((-| - )\d{1,4}[xX][eE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3})((-| - )?[xXeE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)[sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3})(-[xE]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))((-| - )\d{1,4}[xXeE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))((-| - )\d{1,4}[xX][eE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))((-| - )?[xXeE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>((?![sS]?\d{1,4}[xX]\d{1,3})[^\\\/])*)?([sS]?(?<seasonnumber>\d{1,4})[xX](?<epnumber>\d{1,3}))(-[xX]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})[xX\.]?[eE](?<epnumber>\d{1,3})((-| - )?[xXeE](?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seriesname>[^\\\/]*)[sS](?<seasonnumber>\d{1,4})[xX\.]?[eE](?<epnumber>\d{1,3})(-[xX]?[eE]?(?<endingepnumber>\d{1,3}))+[^\\\/]*$",
|
||||
RegexOptions.Compiled)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// To avoid the following matching movies they are only valid when contained in a folder which has been matched as a being season
|
||||
/// </summary>
|
||||
private static readonly Regex[] EpisodeExpressionsInASeasonFolder = new[]
|
||||
{
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<epnumber>\d{1,2})\s?-\s?[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
// 01 - blah.avi, 01-blah.avi
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<epnumber>\d{1,2})[^\d\\]*[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
// 01.avi, 01.blah.avi "01 - 22 blah.avi"
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seasonnumber>\d)(?<epnumber>\d{1,2})[^\d\\]+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
// 01.avi, 01.blah.avi
|
||||
new Regex(
|
||||
@".*(\\|\/)\D*\d+(?<epnumber>\d{2})",
|
||||
RegexOptions.Compiled)
|
||||
// hell0 - 101 - hello.avi
|
||||
private static readonly Regex[] EpisodeExpressionsInASeasonFolder =
|
||||
{
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<epnumber>\d{1,2})\s?-\s?[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
// 01 - blah.avi, 01-blah.avi
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<epnumber>\d{1,2})[^\d\\]*[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
// 01.avi, 01.blah.avi "01 - 22 blah.avi"
|
||||
new Regex(
|
||||
@".*(\\|\/)(?<seasonnumber>\d)(?<epnumber>\d{1,2})[^\d\\]+[^\\\/]*$",
|
||||
RegexOptions.Compiled),
|
||||
// 01.avi, 01.blah.avi
|
||||
new Regex(
|
||||
@".*(\\|\/)\D*\d+(?<epnumber>\d{2})",
|
||||
RegexOptions.Compiled)
|
||||
// hell0 - 101 - hello.avi
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the season number from path.
|
||||
@@ -151,8 +151,8 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <returns>System.Nullable{System.Int32}.</returns>
|
||||
private static int? GetSeasonNumberFromPathSubstring(string path)
|
||||
{
|
||||
int numericStart = -1;
|
||||
int length = 0;
|
||||
var numericStart = -1;
|
||||
var length = 0;
|
||||
|
||||
// Find out where the numbers start, and then keep going until they end
|
||||
for (var i = 0; i < path.Length; i++)
|
||||
|
||||
@@ -95,6 +95,18 @@ namespace MediaBrowser.Controller.Net
|
||||
/// <returns>System.Object.</returns>
|
||||
object GetStaticFileResult(IRequest requestContext, string path, FileShare fileShare = FileShare.Read, IDictionary<string, string> responseHeaders = null, bool isHeadRequest = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the static file result.
|
||||
/// </summary>
|
||||
/// <param name="requestContext">The request context.</param>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="contentType">Type of the content.</param>
|
||||
/// <param name="fileShare">The file share.</param>
|
||||
/// <param name="responseHeaders">The response headers.</param>
|
||||
/// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
object GetStaticFileResult(IRequest requestContext, string path, string contentType, FileShare fileShare = FileShare.Read, IDictionary<string, string> responseHeaders = null, bool isHeadRequest = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optimized serialized result using cache.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -10,10 +10,8 @@ namespace MediaBrowser.Controller.Providers
|
||||
public interface IDirectoryService
|
||||
{
|
||||
List<FileSystemInfo> GetFileSystemEntries(string path);
|
||||
IEnumerable<FileInfo> GetFiles(string path);
|
||||
IEnumerable<DirectoryInfo> GetDirectories(string path);
|
||||
FileInfo GetFile(string path);
|
||||
DirectoryInfo GetDirectory(string path);
|
||||
IEnumerable<FileSystemInfo> GetFiles(string path);
|
||||
FileSystemInfo GetFile(string path);
|
||||
}
|
||||
|
||||
public class DirectoryService : IDirectoryService
|
||||
@@ -50,31 +48,17 @@ namespace MediaBrowser.Controller.Providers
|
||||
return entries;
|
||||
}
|
||||
|
||||
public IEnumerable<FileInfo> GetFiles(string path)
|
||||
public IEnumerable<FileSystemInfo> GetFiles(string path)
|
||||
{
|
||||
return GetFileSystemEntries(path).OfType<FileInfo>();
|
||||
return GetFileSystemEntries(path).Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory);
|
||||
}
|
||||
|
||||
public IEnumerable<DirectoryInfo> GetDirectories(string path)
|
||||
{
|
||||
return GetFileSystemEntries(path).OfType<DirectoryInfo>();
|
||||
}
|
||||
|
||||
public FileInfo GetFile(string path)
|
||||
public FileSystemInfo GetFile(string path)
|
||||
{
|
||||
var directory = Path.GetDirectoryName(path);
|
||||
var filename = Path.GetFileName(path);
|
||||
|
||||
return GetFiles(directory).FirstOrDefault(i => string.Equals(i.Name, filename, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
|
||||
public DirectoryInfo GetDirectory(string path)
|
||||
{
|
||||
var directory = Path.GetDirectoryName(path);
|
||||
var name = Path.GetFileName(path);
|
||||
|
||||
return GetDirectories(directory).FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
|
||||
public class LocalImageInfo
|
||||
{
|
||||
public FileInfo FileInfo { get; set; }
|
||||
public FileSystemInfo FileInfo { get; set; }
|
||||
public ImageType Type { get; set; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user