aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Social/SharingManager.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-07-02 01:08:05 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-07-02 01:08:05 -0400
commit67ed8070dcb31eb41be47fefa5ee29bd081e6c47 (patch)
treeb970323190e8268fceec24773bf8f54dd562abfd /MediaBrowser.Server.Implementations/Social/SharingManager.cs
parent91ce8f443713ed8d9c694ef554e183ac954728b2 (diff)
add sharing function
Diffstat (limited to 'MediaBrowser.Server.Implementations/Social/SharingManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Social/SharingManager.cs29
1 files changed, 22 insertions, 7 deletions
diff --git a/MediaBrowser.Server.Implementations/Social/SharingManager.cs b/MediaBrowser.Server.Implementations/Social/SharingManager.cs
index 1c3f35389..326b2893c 100644
--- a/MediaBrowser.Server.Implementations/Social/SharingManager.cs
+++ b/MediaBrowser.Server.Implementations/Social/SharingManager.cs
@@ -55,17 +55,14 @@ namespace MediaBrowser.Server.Implementations.Social
Id = Guid.NewGuid().ToString("N"),
ExpirationDate = DateTime.UtcNow.AddDays(_config.Configuration.SharingExpirationDays),
ItemId = itemId,
- UserId = userId,
- Overview = item.Overview,
- Name = GetTitle(item)
+ UserId = userId
};
- info.ImageUrl = externalUrl + "/Social/Shares/Public/" + info.Id + "/Image";
- info.ImageUrl = externalUrl + "/web/shared.html?id=" + info.Id;
-
+ AddShareInfo(info);
+
await _repository.CreateShare(info).ConfigureAwait(false);
- return GetShareInfo(info.Id);
+ return info;
}
private string GetTitle(BaseItem item)
@@ -77,9 +74,27 @@ namespace MediaBrowser.Server.Implementations.Social
{
var info = _repository.GetShareInfo(id);
+ AddShareInfo(info);
+
return info;
}
+ private void AddShareInfo(SocialShareInfo info)
+ {
+ var externalUrl = _appHost.GetSystemInfo().WanAddress;
+
+ info.ImageUrl = externalUrl + "/Social/Shares/Public/" + info.Id + "/Image";
+ info.Url = externalUrl + "/web/shared.html?id=" + info.Id;
+
+ var item = _libraryManager.GetItemById(info.ItemId);
+
+ if (item != null)
+ {
+ info.Overview = item.Overview;
+ info.Name = GetTitle(item);
+ }
+ }
+
public Task DeleteShare(string id)
{
return _repository.DeleteShare(id);