diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index 873ac31040..4d35531cb7 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -131,7 +131,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// Creates the name of the sort.
///
/// System.String.
- protected override string CreateSortName()
+ protected override string CreateSortNameInternal()
{
return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 603e59338c..c5422fce9c 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -689,14 +689,22 @@ namespace MediaBrowser.Controller.Entities
return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString);
}
+ protected string CreateSortName()
+ {
+ if (string.IsNullOrWhiteSpace(Name))
+ {
+ return null;
+ }
+
+ return CreateSortNameInternal();
+ }
+
///
/// Creates the name of the sort.
///
/// System.String.
- protected virtual string CreateSortName()
+ protected virtual string CreateSortNameInternal()
{
- if (Name == null) return null; //some items may not have name filled in properly
-
if (!EnableAlphaNumericSorting)
{
return Name.TrimStart();
diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs
index c2f7a6168b..e963ab184e 100644
--- a/MediaBrowser.Controller/Entities/TV/Episode.cs
+++ b/MediaBrowser.Controller/Entities/TV/Episode.cs
@@ -237,7 +237,7 @@ namespace MediaBrowser.Controller.Entities.TV
/// Creates the name of the sort.
///
/// System.String.
- protected override string CreateSortName()
+ protected override string CreateSortNameInternal()
{
return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ") : "")
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs
index 17494eb087..4ccf6d6232 100644
--- a/MediaBrowser.Controller/Entities/TV/Season.cs
+++ b/MediaBrowser.Controller/Entities/TV/Season.cs
@@ -145,7 +145,7 @@ namespace MediaBrowser.Controller.Entities.TV
/// Creates the name of the sort.
///
/// System.String.
- protected override string CreateSortName()
+ protected override string CreateSortNameInternal()
{
return IndexNumber != null ? IndexNumber.Value.ToString("0000") : Name;
}
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
index 6e2fe2495a..8a10ae4178 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
@@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.LiveTv
}
}
- protected override string CreateSortName()
+ protected override string CreateSortNameInternal()
{
if (!string.IsNullOrEmpty(Number))
{