From 5d4c53522bb0b723047455ec308095e85cb104e8 Mon Sep 17 00:00:00 2001 From: GuzziMP Date: Fri, 2 Jan 2015 15:29:20 +0100 Subject: add imdbid detection from media file --- MediaBrowser.Server.Implementations/Library/PathExtensions.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'MediaBrowser.Server.Implementations/Library/PathExtensions.cs') diff --git a/MediaBrowser.Server.Implementations/Library/PathExtensions.cs b/MediaBrowser.Server.Implementations/Library/PathExtensions.cs index 00bd65125..822f41da2 100644 --- a/MediaBrowser.Server.Implementations/Library/PathExtensions.cs +++ b/MediaBrowser.Server.Implementations/Library/PathExtensions.cs @@ -1,4 +1,5 @@ using System; +using System.Text.RegularExpressions; namespace MediaBrowser.Server.Implementations.Library { @@ -31,6 +32,14 @@ namespace MediaBrowser.Server.Implementations.Library int end = str.IndexOf(']', start); return str.Substring(start, end - start); } + // for imdbid we also accept pattern matching + if (attrib == "imdbid") + { + Regex imdbPattern = new Regex("tt\\d{7}"); + var m = imdbPattern.Match(str); + return m.Success ? m.Value : null; + } + return null; } } -- cgit v1.2.3