aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/GameGenre.cs
diff options
context:
space:
mode:
authorhatharry <hatharry@hotmail.com>2016-08-29 01:27:43 +1200
committerhatharry <hatharry@hotmail.com>2016-08-29 01:27:43 +1200
commitcabf2cdc1be4c06714ac6bcf835a19d2f652a6e2 (patch)
treed375b8a41e9fd40a2569ceea6b02e4f8237db797 /MediaBrowser.Controller/Entities/GameGenre.cs
parente564b54686029a90595e1bb4277f87490763e183 (diff)
parentc974641a352685b2e6595dd7b291843c8e6364ac (diff)
Merge branch 'dev' of https://github.com/hatharry/Emby.git
Diffstat (limited to 'MediaBrowser.Controller/Entities/GameGenre.cs')
-rw-r--r--MediaBrowser.Controller/Entities/GameGenre.cs50
1 files changed, 45 insertions, 5 deletions
diff --git a/MediaBrowser.Controller/Entities/GameGenre.cs b/MediaBrowser.Controller/Entities/GameGenre.cs
index 45e766c0f0..6448828fb3 100644
--- a/MediaBrowser.Controller/Entities/GameGenre.cs
+++ b/MediaBrowser.Controller/Entities/GameGenre.cs
@@ -16,12 +16,9 @@ namespace MediaBrowser.Controller.Entities
return list;
}
- public override string PresentationUniqueKey
+ public override string CreatePresentationUniqueKey()
{
- get
- {
- return GetUserDataKeys()[0];
- }
+ return GetUserDataKeys()[0];
}
/// <summary>
@@ -87,5 +84,48 @@ namespace MediaBrowser.Controller.Entities
return false;
}
}
+
+ public static string GetPath(string name, bool normalizeName = true)
+ {
+ // Trim the period at the end because windows will have a hard time with that
+ var validName = normalizeName ?
+ FileSystem.GetValidFilename(name).Trim().TrimEnd('.') :
+ name;
+
+ return System.IO.Path.Combine(ConfigurationManager.ApplicationPaths.GameGenrePath, validName);
+ }
+
+ private string GetRebasedPath()
+ {
+ return GetPath(System.IO.Path.GetFileName(Path), false);
+ }
+
+ public override bool RequiresRefresh()
+ {
+ var newPath = GetRebasedPath();
+ if (!string.Equals(Path, newPath, StringComparison.Ordinal))
+ {
+ Logger.Debug("{0} path has changed from {1} to {2}", GetType().Name, Path, newPath);
+ return true;
+ }
+ return base.RequiresRefresh();
+ }
+
+ /// <summary>
+ /// This is called before any metadata refresh and returns true or false indicating if changes were made
+ /// </summary>
+ public override bool BeforeMetadataRefresh()
+ {
+ var hasChanges = base.BeforeMetadataRefresh();
+
+ var newPath = GetRebasedPath();
+ if (!string.Equals(Path, newPath, StringComparison.Ordinal))
+ {
+ Path = newPath;
+ hasChanges = true;
+ }
+
+ return hasChanges;
+ }
}
}