add sharing function

pull/702/head
Luke Pulverenti 9 years ago
parent 91ce8f4437
commit 67ed8070dc

@ -736,6 +736,7 @@ namespace MediaBrowser.Server.Implementations.Dto
}
})
.Where(i => i != null)
.DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
.ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
for (var i = 0; i < studios.Count; i++)

@ -813,6 +813,7 @@
"ErrorMessageEmailInUse": "The email address is already in use. Please enter a new email address and try again, or use the forgot password feature.",
"MessageThankYouForConnectSignUp": "Thank you for signing up for Emby Connect. An email will be sent to your address with instructions on how to confirm your new account. Please confirm the account and then return here to sign in.",
"HeaderShare": "Share",
"ButtonShareHelp": "Only a web page containing media information will be shared. Media files are never shared publicly."
"ButtonShareHelp": "Share a web page containing media information with social media. Media files are never shared publicly.",
"ButtonShare": "Share",
"HeaderConfirm": "Confirm"
}

@ -1,3 +1,4 @@
using System.Runtime.Serialization;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.LiveTv;
@ -413,7 +414,15 @@ namespace MediaBrowser.Server.Implementations.Persistence
using (var stream = reader.GetMemoryStream(1))
{
return _jsonSerializer.DeserializeFromStream(stream, type) as BaseItem;
try
{
return _jsonSerializer.DeserializeFromStream(stream, type) as BaseItem;
}
catch (SerializationException ex)
{
_logger.ErrorException("Error deserializing item", ex);
return null;
}
}
}
@ -696,7 +705,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
{
while (reader.Read())
{
list.Add(GetItem(reader));
var item = GetItem(reader);
if (item != null)
{
list.Add(item);
}
}
if (reader.NextResult() && reader.Read())
@ -986,6 +999,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
_deleteChildrenCommand.Transaction = transaction;
_deleteChildrenCommand.ExecuteNonQuery();
// Delete people
_deletePeopleCommand.GetParameter(0).Value = id;
_deletePeopleCommand.Transaction = transaction;
_deletePeopleCommand.ExecuteNonQuery();
// Delete the item
_deleteItemCommand.GetParameter(0).Value = id;
_deleteItemCommand.Transaction = transaction;

@ -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);

@ -375,6 +375,14 @@ namespace MediaBrowser.WebDashboard.Api
sb.Append("<meta name=\"robots\" content=\"noindex, nofollow, noarchive\" />");
// Open graph tags
sb.Append("<meta property=\"og:title\" content=\"Emby\" />");
sb.Append("<meta property=\"og:site_name\" content=\"Emby\"/>");
sb.Append("<meta property=\"og:url\" content=\"http://emby.media\" />");
sb.Append("<meta property=\"og:description\" content=\"Energize your media.\" />");
sb.Append("<meta property=\"og:type\" content=\"article\" />");
//sb.Append("<meta property=\"fb:app_id\" content=\"[FB_APP_ID]\" />");
// http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
sb.Append("<link rel=\"apple-touch-icon\" href=\"css/images/touchicon.png\" />");
sb.Append("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"css/images/touchicon72.png\" />");
@ -649,28 +657,29 @@ namespace MediaBrowser.WebDashboard.Api
var files = new[]
{
"site.css",
"chromecast.css",
"nowplayingbar.css",
"mediaplayer.css",
"mediaplayer-video.css",
"librarymenu.css",
"librarybrowser.css",
"card.css",
"notifications.css",
"search.css",
"pluginupdates.css",
"remotecontrol.css",
"userimage.css",
"nowplaying.css",
"materialize.css"
"css/site.css",
"css/chromecast.css",
"css/nowplayingbar.css",
"css/mediaplayer.css",
"css/mediaplayer-video.css",
"css/librarymenu.css",
"css/librarybrowser.css",
"css/card.css",
"css/notifications.css",
"css/search.css",
"css/pluginupdates.css",
"css/remotecontrol.css",
"css/userimage.css",
"css/nowplaying.css",
"css/materialize.css",
"thirdparty/paper-button-style.css"
};
var builder = new StringBuilder();
foreach (var file in files)
{
var path = GetDashboardResourcePath("css/" + file);
var path = GetDashboardResourcePath(file);
using (var fs = _fileSystem.GetFileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, true))
{

@ -127,6 +127,9 @@
<Content Include="dashboard-ui\cordova\android\logging.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\cordova\sharingwidget.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\clients\androidtv-tile.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

Loading…
Cancel
Save