diff options
| author | Michalis Adamidis <gsnerf@gsnerf.de> | 2014-08-06 21:06:34 +0200 |
|---|---|---|
| committer | Michalis Adamidis <gsnerf@gsnerf.de> | 2014-08-06 21:06:34 +0200 |
| commit | b957e7c7b91257d7f33f9890b9a14445a80164ea (patch) | |
| tree | 3a6082b1bdf717d0f28ef96f14a70c1265071ac4 /MediaBrowser.Server.Implementations | |
| parent | 7994f0dcd9082cc657e07dbff6ecc4e638f1f527 (diff) | |
| parent | 284bd3e9f562ae499ad8d8b778392196ac99ed3a (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Server.Implementations')
5 files changed, 42 insertions, 26 deletions
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index e3a386841b..ace794b197 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -112,6 +112,8 @@ namespace MediaBrowser.Server.Implementations.Dto var dto = new BaseItemDto(); + dto.SupportsPlaylists = item.SupportsAddingToPlaylist; + if (fields.Contains(ItemFields.People)) { AttachPeople(dto, item); @@ -849,17 +851,7 @@ namespace MediaBrowser.Server.Implementations.Dto if (fields.Contains(ItemFields.Overview)) { - // TODO: Remove this after a while, since it's been moved to the providers - if (item is MusicArtist) - { - var strippedOverview = string.IsNullOrEmpty(item.Overview) ? item.Overview : item.Overview.StripHtml(); - - dto.Overview = strippedOverview; - } - else - { - dto.Overview = item.Overview; - } + dto.Overview = item.Overview; } if (fields.Contains(ItemFields.ShortOverview)) diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 251acb02dd..ad2b503659 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -12,7 +12,6 @@ using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Sorting; -using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; @@ -551,24 +550,28 @@ namespace MediaBrowser.Server.Implementations.LiveTv }; } - if (!string.IsNullOrEmpty(info.Path)) - { - item.Path = info.Path; - } - else if (!string.IsNullOrEmpty(info.Url)) - { - item.Path = info.Url; - } - isNew = true; } item.RecordingInfo = info; item.ServiceName = serviceName; + var originalPath = item.Path; + + if (!string.IsNullOrEmpty(info.Path)) + { + item.Path = info.Path; + } + else if (!string.IsNullOrEmpty(info.Url)) + { + item.Path = info.Url; + } + + var pathChanged = !string.Equals(originalPath, item.Path); + await item.RefreshMetadata(new MetadataRefreshOptions { - ForceSave = isNew + ForceSave = isNew || pathChanged }, cancellationToken); diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json index ad4ba7dc0f..1c207b0a2c 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json @@ -334,5 +334,6 @@ "OptionNewPlaylist": "New playlist...", "MessageAddedToPlaylistSuccess": "Ok", "ButtonViewSeriesRecording": "View series recording", - "ValueOriginalAirDate": "Original air date: {0}" + "ValueOriginalAirDate": "Original air date: {0}", + "ButtonRemoveFromPlaylist": "Remove from playlist" } diff --git a/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs b/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs index 79b673283d..6ab306c0ba 100644 --- a/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs +++ b/MediaBrowser.Server.Implementations/Playlists/PlaylistManager.cs @@ -190,9 +190,29 @@ namespace MediaBrowser.Server.Implementations.Playlists }, CancellationToken.None).ConfigureAwait(false); } - public Task RemoveFromPlaylist(string playlistId, IEnumerable<int> indeces) + public async Task RemoveFromPlaylist(string playlistId, IEnumerable<string> entryIds) { - throw new NotImplementedException(); + var playlist = _libraryManager.GetItemById(playlistId) as Playlist; + + if (playlist == null) + { + throw new ArgumentException("No Playlist exists with the supplied Id"); + } + + var children = playlist.LinkedChildren.ToList(); + + var idList = entryIds.ToList(); + + var removals = children.Where(i => idList.Contains(i.Id)); + + playlist.LinkedChildren = children.Except(removals) + .ToList(); + + await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); + await playlist.RefreshMetadata(new MetadataRefreshOptions + { + ForceSave = true + }, CancellationToken.None).ConfigureAwait(false); } public Folder GetPlaylistsFolder(string userId) diff --git a/MediaBrowser.Server.Implementations/Udp/UdpServer.cs b/MediaBrowser.Server.Implementations/Udp/UdpServer.cs index e4626bec6c..9028b540f8 100644 --- a/MediaBrowser.Server.Implementations/Udp/UdpServer.cs +++ b/MediaBrowser.Server.Implementations/Udp/UdpServer.cs @@ -124,7 +124,7 @@ namespace MediaBrowser.Server.Implementations.Udp { Address = serverAddress, Id = _appHost.ServerId, - Name = _appHost.Name + Name = _appHost.FriendlyName }; await SendAsync(Encoding.UTF8.GetBytes(_json.SerializeToString(response)), endpoint); |
