From b63ed35238ab90f27660a5b3b719f31d1e2c5386 Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Mon, 9 Mar 2020 20:02:53 +0100 Subject: [PATCH] Add descriptive TV episode titles for DLNA browsing When browsing TV episodes in Next Up, etc via DLNA a more descriptive title should be used to easier identify the right episode. --- Emby.Dlna/Didl/DidlBuilder.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs index 145639ab0..03ffedf81 100644 --- a/Emby.Dlna/Didl/DidlBuilder.cs +++ b/Emby.Dlna/Didl/DidlBuilder.cs @@ -436,6 +436,29 @@ namespace Emby.Dlna.Didl return number + " - " + item.Name; } } + else if (item is Episode ep) + { + var parent = ep.GetParent(); + var name = parent.Name + " - "; + + if (ep.ParentIndexNumber.HasValue) + { + name += "S" + ep.ParentIndexNumber.Value.ToString("00", CultureInfo.InvariantCulture); + } + else if (!item.IndexNumber.HasValue) + { + return name + " - " + item.Name; + } + + name += "E" + ep.IndexNumber.Value.ToString("00", CultureInfo.InvariantCulture); + if (ep.IndexNumberEnd.HasValue) + { + name += "-" + ep.IndexNumberEnd.Value.ToString("00", CultureInfo.InvariantCulture); + } + + name += " - " + item.Name; + return name; + } return item.Name; }