aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-23 23:50:45 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-23 23:50:45 -0500
commit1af651bc56025935cebe2762d6f36be41530eba1 (patch)
tree685083558027d3123bd3b9f6a4efa886a574bf26 /MediaBrowser.Controller
parent86a9df53f28d54c9668d66f134d3d73220e0411d (diff)
add Add to collection buttons
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Channels/Channel.cs7
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs17
-rw-r--r--MediaBrowser.Controller/Entities/UserViewBuilder.cs18
3 files changed, 27 insertions, 15 deletions
diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs
index 32ad2ff12..87d257f12 100644
--- a/MediaBrowser.Controller/Channels/Channel.cs
+++ b/MediaBrowser.Controller/Channels/Channel.cs
@@ -60,7 +60,12 @@ namespace MediaBrowser.Controller.Channels
protected override string GetInternalMetadataPath(string basePath)
{
- return System.IO.Path.Combine(basePath, "channels", Id.ToString("N"), "metadata");
+ return GetInternalMetadataPath(basePath, Id);
+ }
+
+ public static string GetInternalMetadataPath(string basePath, Guid id)
+ {
+ return System.IO.Path.Combine(basePath, "channels", id.ToString("N"), "metadata");
}
}
}
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 6a30df7fe..2be4f99e9 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -381,11 +381,6 @@ namespace MediaBrowser.Controller.Entities
{
var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;
- if (ConfigurationManager.Configuration.EnableLibraryMetadataSubFolder)
- {
- basePath = System.IO.Path.Combine(basePath, "library");
- }
-
return GetInternalMetadataPath(basePath);
}
@@ -393,14 +388,10 @@ namespace MediaBrowser.Controller.Entities
{
var idString = Id.ToString("N");
- return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString);
- }
-
- public static string GetInternalMetadataPathForId(Guid id)
- {
- var idString = id.ToString("N");
-
- var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;
+ if (ConfigurationManager.Configuration.EnableLibraryMetadataSubFolder)
+ {
+ basePath = System.IO.Path.Combine(basePath, "library");
+ }
return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString);
}
diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
index 166d56c51..deb85ed6a 100644
--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs
+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs
@@ -117,7 +117,7 @@ namespace MediaBrowser.Controller.Entities
return await GetGameView(user, queryParent, query).ConfigureAwait(false);
case CollectionType.BoxSets:
- return GetResult(GetMediaFolders(user).SelectMany(i => i.GetRecursiveChildren(user)).OfType<BoxSet>(), queryParent, query);
+ return await GetBoxsetView(queryParent, user, query).ConfigureAwait(false);
case CollectionType.TvShows:
return await GetTvView(queryParent, user, query).ConfigureAwait(false);
@@ -526,6 +526,22 @@ namespace MediaBrowser.Controller.Entities
return GetResult(items, queryParent, query);
}
+ private async Task<QueryResult<BaseItem>> GetBoxsetView(Folder parent, User user, InternalItemsQuery query)
+ {
+ return GetResult(GetMediaFolders(user).SelectMany(i =>
+ {
+ var hasCollectionType = i as ICollectionFolder;
+
+ if (hasCollectionType != null && string.Equals(hasCollectionType.CollectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
+ {
+ return i.GetChildren(user, true);
+ }
+
+ return i.GetRecursiveChildren(user);
+
+ }).OfType<BoxSet>(), parent, query);
+ }
+
private async Task<QueryResult<BaseItem>> GetTvView(Folder parent, User user, InternalItemsQuery query)
{
if (query.Recursive)