diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index 0e4ccf0b17..f2586b0438 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -18,6 +18,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
namespace MediaBrowser.Api.Images
{
@@ -668,26 +669,26 @@ namespace MediaBrowser.Api.Images
{
if (format == ImageFormat.Bmp)
{
- return Common.Net.MimeTypes.GetMimeType("i.bmp");
+ return MimeTypes.GetMimeType("i.bmp");
}
if (format == ImageFormat.Gif)
{
- return Common.Net.MimeTypes.GetMimeType("i.gif");
+ return MimeTypes.GetMimeType("i.gif");
}
if (format == ImageFormat.Jpg)
{
- return Common.Net.MimeTypes.GetMimeType("i.jpg");
+ return MimeTypes.GetMimeType("i.jpg");
}
if (format == ImageFormat.Png)
{
- return Common.Net.MimeTypes.GetMimeType("i.png");
+ return MimeTypes.GetMimeType("i.png");
}
if (format == ImageFormat.Webp)
{
- return Common.Net.MimeTypes.GetMimeType("i.webp");
+ return MimeTypes.GetMimeType("i.webp");
}
- return Common.Net.MimeTypes.GetMimeType(path);
+ return MimeTypes.GetMimeType(path);
}
///
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
index 94198d9745..8a33a88f28 100644
--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
@@ -14,6 +14,7 @@ using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using MediaBrowser.Model.Net;
namespace MediaBrowser.Api.Playback.Hls
{
diff --git a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
index 4892593346..86866bdf5e 100644
--- a/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/DynamicHlsService.cs
@@ -20,6 +20,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
namespace MediaBrowser.Api.Playback.Hls
{
@@ -387,7 +388,7 @@ namespace MediaBrowser.Api.Playback.Hls
playlistText = GetMasterPlaylistFileText(state, videoBitrate + audioBitrate);
}
- return ResultFactory.GetResult(playlistText, Common.Net.MimeTypes.GetMimeType("playlist.m3u8"), new Dictionary());
+ return ResultFactory.GetResult(playlistText, MimeTypes.GetMimeType("playlist.m3u8"), new Dictionary());
}
private string GetMasterPlaylistFileText(StreamState state, int totalBitrate)
@@ -603,7 +604,7 @@ namespace MediaBrowser.Api.Playback.Hls
var playlistText = builder.ToString();
- return ResultFactory.GetResult(playlistText, Common.Net.MimeTypes.GetMimeType("playlist.m3u8"), new Dictionary());
+ return ResultFactory.GetResult(playlistText, MimeTypes.GetMimeType("playlist.m3u8"), new Dictionary());
}
protected override string GetAudioArguments(StreamState state)
@@ -640,10 +641,19 @@ namespace MediaBrowser.Api.Playback.Hls
{
var codec = state.OutputVideoCodec;
+ var args = "-codec:v:0 " + codec;
+
+ if (state.EnableMpegtsM2TsMode)
+ {
+ args += " -mpegts_m2ts_mode 1";
+ }
+
// See if we can save come cpu cycles by avoiding encoding
- if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
+ if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase))
{
- return state.VideoStream != null && IsH264(state.VideoStream) ? "-codec:v:0 copy -bsf:v h264_mp4toannexb" : "-codec:v:0 copy";
+ return state.VideoStream != null && IsH264(state.VideoStream) ?
+ args + " -bsf:v h264_mp4toannexb" :
+ args;
}
var keyFrameArg = string.Format(" -force_key_frames expr:gte(t,n_forced*{0})",
@@ -651,7 +661,7 @@ namespace MediaBrowser.Api.Playback.Hls
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream;
- var args = "-codec:v:0 " + codec + " " + GetVideoQualityParam(state, H264Encoder, true) + keyFrameArg;
+ args += " " + GetVideoQualityParam(state, H264Encoder, true) + keyFrameArg;
// Add resolution params, if specified
if (!hasGraphicalSubs)
diff --git a/MediaBrowser.Api/Playback/Hls/MpegDashService.cs b/MediaBrowser.Api/Playback/Hls/MpegDashService.cs
index e91ed98d1b..87e2eedcf5 100644
--- a/MediaBrowser.Api/Playback/Hls/MpegDashService.cs
+++ b/MediaBrowser.Api/Playback/Hls/MpegDashService.cs
@@ -18,6 +18,7 @@ using System.Security;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
namespace MediaBrowser.Api.Playback.Hls
{
@@ -97,7 +98,7 @@ namespace MediaBrowser.Api.Playback.Hls
playlistText = GetManifestText(state);
}
- return ResultFactory.GetResult(playlistText, Common.Net.MimeTypes.GetMimeType("playlist.mpd"), new Dictionary());
+ return ResultFactory.GetResult(playlistText, MimeTypes.GetMimeType("playlist.mpd"), new Dictionary());
}
private string GetManifestText(StreamState state)
@@ -583,10 +584,19 @@ namespace MediaBrowser.Api.Playback.Hls
{
var codec = state.OutputVideoCodec;
+ var args = "-codec:v:0 " + codec;
+
+ if (state.EnableMpegtsM2TsMode)
+ {
+ args += " -mpegts_m2ts_mode 1";
+ }
+
// See if we can save come cpu cycles by avoiding encoding
if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase))
{
- return IsH264(state.VideoStream) ? "-codec:v:0 copy -bsf:v h264_mp4toannexb" : "-codec:v:0 copy";
+ return state.VideoStream != null && IsH264(state.VideoStream) ?
+ args + " -bsf:v h264_mp4toannexb" :
+ args;
}
var keyFrameArg = string.Format(" -force_key_frames expr:gte(t,n_forced*{0})",
@@ -594,7 +604,7 @@ namespace MediaBrowser.Api.Playback.Hls
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream;
- var args = "-codec:v:0 " + codec + " " + GetVideoQualityParam(state, H264Encoder, true) + keyFrameArg;
+ args+= " " + GetVideoQualityParam(state, H264Encoder, true) + keyFrameArg;
args += " -r 24 -g 24";
diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
index 14f7175a9c..de845c88d8 100644
--- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs
@@ -134,18 +134,27 @@ namespace MediaBrowser.Api.Playback.Hls
{
var codec = state.OutputVideoCodec;
+ var args = "-codec:v:0 " + codec;
+
+ if (state.EnableMpegtsM2TsMode)
+ {
+ args += " -mpegts_m2ts_mode 1";
+ }
+
// See if we can save come cpu cycles by avoiding encoding
if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase))
{
- return state.VideoStream != null && IsH264(state.VideoStream) ? "-codec:v:0 copy -bsf:v h264_mp4toannexb" : "-codec:v:0 copy";
+ return state.VideoStream != null && IsH264(state.VideoStream) ?
+ args + " -bsf:v h264_mp4toannexb" :
+ args;
}
-
+
var keyFrameArg = string.Format(" -force_key_frames expr:gte(t,n_forced*{0})",
state.SegmentLength.ToString(UsCulture));
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream;
- var args = "-codec:v:0 " + codec + " " + GetVideoQualityParam(state, H264Encoder, true) + keyFrameArg;
+ args += " " + GetVideoQualityParam(state, H264Encoder, true) + keyFrameArg;
// Add resolution params, if specified
if (!hasGraphicalSubs)
diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs
index fb2d307327..5ef72a4952 100644
--- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs
+++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs
@@ -124,7 +124,7 @@ namespace MediaBrowser.Api.Playback.Progressive
/// System.String.
private string GetVideoArguments(StreamState state, string codec)
{
- var args = "-vcodec " + codec;
+ var args = "-codec:v:0 " + codec;
if (state.EnableMpegtsM2TsMode)
{
@@ -134,7 +134,9 @@ namespace MediaBrowser.Api.Playback.Progressive
// See if we can save come cpu cycles by avoiding encoding
if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase))
{
- return state.VideoStream != null && IsH264(state.VideoStream) ? args + " -bsf:v h264_mp4toannexb" : args;
+ return state.VideoStream != null && IsH264(state.VideoStream) && string.Equals(state.OutputContainer, "ts", StringComparison.OrdinalIgnoreCase) ?
+ args + " -bsf:v h264_mp4toannexb" :
+ args;
}
var keyFrameArg = string.Format(" -force_key_frames expr:gte(t,n_forced*{0})",
@@ -182,13 +184,13 @@ namespace MediaBrowser.Api.Playback.Progressive
// Get the output codec name
var codec = state.OutputAudioCodec;
+ var args = "-codec:a:0 " + codec;
+
if (codec.Equals("copy", StringComparison.OrdinalIgnoreCase))
{
- return "-acodec copy";
+ return args;
}
- var args = "-acodec " + codec;
-
// Add the number of audio channels
var channels = state.OutputAudioChannels;
diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs
index d26259a3ae..40e765f1ae 100644
--- a/MediaBrowser.Api/Playback/StreamState.cs
+++ b/MediaBrowser.Api/Playback/StreamState.cs
@@ -11,6 +11,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Threading;
+using MediaBrowser.Model.Net;
namespace MediaBrowser.Api.Playback
{
diff --git a/MediaBrowser.Api/Subtitles/SubtitleService.cs b/MediaBrowser.Api/Subtitles/SubtitleService.cs
index a2a93d50e3..32e6ba076d 100644
--- a/MediaBrowser.Api/Subtitles/SubtitleService.cs
+++ b/MediaBrowser.Api/Subtitles/SubtitleService.cs
@@ -15,6 +15,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
namespace MediaBrowser.Api.Subtitles
{
@@ -175,7 +176,7 @@ namespace MediaBrowser.Api.Subtitles
builder.AppendLine("#EXT-X-ENDLIST");
- return ResultFactory.GetResult(builder.ToString(), Common.Net.MimeTypes.GetMimeType("playlist.m3u8"), new Dictionary());
+ return ResultFactory.GetResult(builder.ToString(), MimeTypes.GetMimeType("playlist.m3u8"), new Dictionary());
}
public object Get(GetSubtitle request)
@@ -199,7 +200,7 @@ namespace MediaBrowser.Api.Subtitles
var stream = GetSubtitles(request).Result;
- return ResultFactory.GetResult(stream, Common.Net.MimeTypes.GetMimeType("file." + request.Format));
+ return ResultFactory.GetResult(stream, MimeTypes.GetMimeType("file." + request.Format));
}
private async Task GetSubtitles(GetSubtitle request)
@@ -240,7 +241,7 @@ namespace MediaBrowser.Api.Subtitles
{
var result = _subtitleManager.GetRemoteSubtitles(request.Id, CancellationToken.None).Result;
- return ResultFactory.GetResult(result.Stream, Common.Net.MimeTypes.GetMimeType("file." + result.Format));
+ return ResultFactory.GetResult(result.Stream, MimeTypes.GetMimeType("file." + result.Format));
}
public void Post(DownloadRemoteSubtitles request)
diff --git a/MediaBrowser.Api/Sync/SyncService.cs b/MediaBrowser.Api/Sync/SyncService.cs
index 26e4a2669a..29172ef05f 100644
--- a/MediaBrowser.Api/Sync/SyncService.cs
+++ b/MediaBrowser.Api/Sync/SyncService.cs
@@ -5,6 +5,7 @@ using MediaBrowser.Controller.Sync;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Sync;
+using MediaBrowser.Model.Users;
using ServiceStack;
using System;
using System.Collections.Generic;
@@ -60,7 +61,7 @@ namespace MediaBrowser.Api.Sync
[ApiMember(Name = "ParentId", Description = "ParentId", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string ParentId { get; set; }
-
+
[ApiMember(Name = "Category", Description = "Category", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public SyncCategory? Category { get; set; }
}
@@ -79,6 +80,11 @@ namespace MediaBrowser.Api.Sync
public string Id { get; set; }
}
+ [Route("/Sync/OfflineActions", "POST", Summary = "Reports an action that occurred while offline.")]
+ public class ReportOfflineActions : List, IReturnVoid
+ {
+ }
+
[Authenticated]
public class SyncService : BaseApiService
{
@@ -173,9 +179,9 @@ namespace MediaBrowser.Api.Sync
.Select(i => _dtoService.GetBaseItemDto(i, new DtoOptions
{
Fields = new List
- {
- ItemFields.SyncInfo
- }
+ {
+ ItemFields.SyncInfo
+ }
}))
.ToList();
@@ -184,5 +190,20 @@ namespace MediaBrowser.Api.Sync
return ToOptimizedResult(result);
}
+
+ public void Post(ReportOfflineActions request)
+ {
+ var task = PostAsync(request);
+
+ Task.WaitAll(task);
+ }
+
+ public async Task PostAsync(ReportOfflineActions request)
+ {
+ foreach (var action in request)
+ {
+ await _syncManager.ReportOfflineAction(action).ConfigureAwait(false);
+ }
+ }
}
}
diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj
index 9fdfccaaf6..140a4ae0e4 100644
--- a/MediaBrowser.Common/MediaBrowser.Common.csproj
+++ b/MediaBrowser.Common/MediaBrowser.Common.csproj
@@ -74,7 +74,6 @@
-
diff --git a/MediaBrowser.Controller/Library/IUserDataManager.cs b/MediaBrowser.Controller/Library/IUserDataManager.cs
index 226f77525b..06e7d1763e 100644
--- a/MediaBrowser.Controller/Library/IUserDataManager.cs
+++ b/MediaBrowser.Controller/Library/IUserDataManager.cs
@@ -61,5 +61,9 @@ namespace MediaBrowser.Controller.Library
///
Task SaveAllUserData(Guid userId, IEnumerable userData, CancellationToken cancellationToken);
+ ///
+ /// Updates playstate for an item and returns true or false indicating if it was played to completion
+ ///
+ bool UpdatePlayState(BaseItem item, UserItemData data, long positionTicks);
}
}
diff --git a/MediaBrowser.Controller/Sync/ISyncManager.cs b/MediaBrowser.Controller/Sync/ISyncManager.cs
index 47339f6773..e16a978c39 100644
--- a/MediaBrowser.Controller/Sync/ISyncManager.cs
+++ b/MediaBrowser.Controller/Sync/ISyncManager.cs
@@ -4,6 +4,7 @@ using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Sync;
using System.Collections.Generic;
using System.Threading.Tasks;
+using MediaBrowser.Model.Users;
namespace MediaBrowser.Controller.Sync
{
@@ -80,5 +81,19 @@ namespace MediaBrowser.Controller.Sync
/// The identifier.
/// SyncJobItem.
SyncJobItem GetJobItem(string id);
+
+ ///
+ /// Gets the job item information.
+ ///
+ /// The identifier.
+ /// SyncedItem.
+ SyncedItem GetJobItemInfo(string id);
+
+ ///
+ /// Reports the offline action.
+ ///
+ /// The action.
+ /// Task.
+ Task ReportOfflineAction(UserAction action);
}
}
diff --git a/MediaBrowser.Dlna/Didl/DidlBuilder.cs b/MediaBrowser.Dlna/Didl/DidlBuilder.cs
index bdb1c4cbff..d1941c8563 100644
--- a/MediaBrowser.Dlna/Didl/DidlBuilder.cs
+++ b/MediaBrowser.Dlna/Didl/DidlBuilder.cs
@@ -18,6 +18,7 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Xml;
+using MediaBrowser.Model.Net;
namespace MediaBrowser.Dlna.Didl
{
diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
index a131e70161..7f83aa61d9 100644
--- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
+++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs
@@ -169,8 +169,8 @@ namespace MediaBrowser.LocalMetadata.Images
var names = new List
{
"folder",
- "cover",
"poster",
+ "cover",
"default"
};
diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
index a388e0edb0..68df777bd7 100644
--- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
+++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj
@@ -10,8 +10,8 @@
Properties
MediaBrowser.Model
MediaBrowser.Model
- v4.0
- Profile344
+ v4.5
+ Profile259
512
{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
..\
@@ -479,9 +479,6 @@
Dto\RecommendationType.cs
-
- Dto\StreamOptions.cs
-
Dto\StudioDto.cs
@@ -797,6 +794,12 @@
Net\HttpException.cs
+
+ Net\HttpResponse.cs
+
+
+ Net\MimeTypes.cs
+
Net\NetworkShare.cs
@@ -1037,18 +1040,24 @@
Session\UserDataChangeInfo.cs
+
+ Sync\ItemFIleInfo.cs
+
+
+ Sync\ItemFileType.cs
+
Sync\SyncCategory.cs
Sync\SyncDialogOptions.cs
+
+ Sync\SyncedItem.cs
+
Sync\SyncHelper.cs
-
- Sync\SyncItem.cs
-
Sync\SyncJob.cs
@@ -1151,6 +1160,12 @@
Users\PinRedeemResult.cs
+
+ Users\UserAction.cs
+
+
+ Users\UserActionType.cs
+
Users\UserPolicy.cs
diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
index 5bacb73d7c..bc4e582331 100644
--- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
+++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
@@ -444,9 +444,6 @@
Dto\RecommendationType.cs
-
- Dto\StreamOptions.cs
-
Dto\StudioDto.cs
@@ -756,6 +753,12 @@
Net\HttpException.cs
+
+ Net\HttpResponse.cs
+
+
+ Net\MimeTypes.cs
+
Net\NetworkShare.cs
@@ -996,18 +999,24 @@
Session\UserDataChangeInfo.cs
+
+ Sync\ItemFIleInfo.cs
+
+
+ Sync\ItemFileType.cs
+
Sync\SyncCategory.cs
Sync\SyncDialogOptions.cs
+
+ Sync\SyncedItem.cs
+
Sync\SyncHelper.cs
-
- Sync\SyncItem.cs
-
Sync\SyncJob.cs
@@ -1110,6 +1119,12 @@
Users\PinRedeemResult.cs
+
+ Users\UserAction.cs
+
+
+ Users\UserActionType.cs
+
Users\UserPolicy.cs
diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs
index 0181325fe7..883e54308d 100644
--- a/MediaBrowser.Model/ApiClient/IApiClient.cs
+++ b/MediaBrowser.Model/ApiClient/IApiClient.cs
@@ -7,6 +7,7 @@ using MediaBrowser.Model.Events;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.MediaInfo;
+using MediaBrowser.Model.Net;
using MediaBrowser.Model.Notifications;
using MediaBrowser.Model.Playlists;
using MediaBrowser.Model.Plugins;
@@ -185,6 +186,22 @@ namespace MediaBrowser.Model.ApiClient
/// url
Task GetImageStreamAsync(string url, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets the stream.
+ ///
+ /// The URL.
+ /// The cancellation token.
+ /// Task<Stream>.
+ Task GetStream(string url, CancellationToken cancellationToken = default(CancellationToken));
+
+ ///
+ /// Gets the response.
+ ///
+ /// The URL.
+ /// The cancellation token.
+ /// Task<HttpResponse>.
+ Task GetResponse(string url, CancellationToken cancellationToken = default(CancellationToken));
+
///
/// Updates the user configuration.
///
@@ -1299,15 +1316,6 @@ namespace MediaBrowser.Model.ApiClient
/// Task<QueryResult<BaseItemDto>>.
Task> GetPlaylistItems(PlaylistItemQuery query);
- ///
- /// Gets the url needed to stream an audio file
- ///
- /// The options.
- /// System.String.
- /// options
- [Obsolete]
- string GetAudioStreamUrl(StreamOptions options);
-
///
/// Gets the url needed to stream a video file
///
@@ -1411,5 +1419,19 @@ namespace MediaBrowser.Model.ApiClient
/// The web socket factory.
/// The keep alive timer ms.
void OpenWebSocket(Func webSocketFactory, int keepAliveTimerMs = 60000);
+
+ ///
+ /// Reports the offline actions.
+ ///
+ /// The actions.
+ /// Task.
+ Task ReportOfflineActions(List actions);
+
+ ///
+ /// Gets the ready synchronize items.
+ ///
+ /// The target identifier.
+ /// List<SyncedItem>.
+ Task> GetReadySyncItems(string targetId);
}
}
\ No newline at end of file
diff --git a/MediaBrowser.Model/Dto/StreamOptions.cs b/MediaBrowser.Model/Dto/StreamOptions.cs
deleted file mode 100644
index 5b7cdc6fb1..0000000000
--- a/MediaBrowser.Model/Dto/StreamOptions.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using System;
-
-namespace MediaBrowser.Model.Dto
-{
- ///
- /// Class StreamOptions
- ///
- [Obsolete]
- public class StreamOptions
- {
- ///
- /// Gets or sets the audio bit rate.
- ///
- /// The audio bit rate.
- public int? AudioBitRate { get; set; }
-
- ///
- /// Gets or sets the audio codec.
- /// Omit to copy the original stream
- ///
- /// The audio encoding format.
- public string AudioCodec { get; set; }
-
- ///
- /// Gets or sets the item id.
- ///
- /// The item id.
- public string ItemId { get; set; }
-
- ///
- /// Gets or sets the max audio channels.
- ///
- /// The max audio channels.
- public int? MaxAudioChannels { get; set; }
-
- ///
- /// Gets or sets the max audio sample rate.
- ///
- /// The max audio sample rate.
- public int? MaxAudioSampleRate { get; set; }
-
- ///
- /// Gets or sets the start time ticks.
- ///
- /// The start time ticks.
- public long? StartTimeTicks { get; set; }
-
- ///
- /// Gets or sets a value indicating whether the original media should be served statically
- /// Only used with progressive streaming
- ///
- /// true if static; otherwise, false.
- public bool? Static { get; set; }
-
- ///
- /// Gets or sets the output file extension.
- ///
- /// The output file extension.
- public string OutputFileExtension { get; set; }
-
- ///
- /// Gets or sets the device id.
- ///
- /// The device id.
- public string DeviceId { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/Dto/VideoStreamOptions.cs b/MediaBrowser.Model/Dto/VideoStreamOptions.cs
index 606e928f21..e9a83bd12a 100644
--- a/MediaBrowser.Model/Dto/VideoStreamOptions.cs
+++ b/MediaBrowser.Model/Dto/VideoStreamOptions.cs
@@ -6,8 +6,64 @@ namespace MediaBrowser.Model.Dto
/// Class VideoStreamOptions
///
[Obsolete]
- public class VideoStreamOptions : StreamOptions
+ public class VideoStreamOptions
{
+ ///
+ /// Gets or sets the audio bit rate.
+ ///
+ /// The audio bit rate.
+ public int? AudioBitRate { get; set; }
+
+ ///
+ /// Gets or sets the audio codec.
+ /// Omit to copy the original stream
+ ///
+ /// The audio encoding format.
+ public string AudioCodec { get; set; }
+
+ ///
+ /// Gets or sets the item id.
+ ///
+ /// The item id.
+ public string ItemId { get; set; }
+
+ ///
+ /// Gets or sets the max audio channels.
+ ///
+ /// The max audio channels.
+ public int? MaxAudioChannels { get; set; }
+
+ ///
+ /// Gets or sets the max audio sample rate.
+ ///
+ /// The max audio sample rate.
+ public int? MaxAudioSampleRate { get; set; }
+
+ ///
+ /// Gets or sets the start time ticks.
+ ///
+ /// The start time ticks.
+ public long? StartTimeTicks { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether the original media should be served statically
+ /// Only used with progressive streaming
+ ///
+ /// true if static; otherwise, false.
+ public bool? Static { get; set; }
+
+ ///
+ /// Gets or sets the output file extension.
+ ///
+ /// The output file extension.
+ public string OutputFileExtension { get; set; }
+
+ ///
+ /// Gets or sets the device id.
+ ///
+ /// The device id.
+ public string DeviceId { get; set; }
+
///
/// Gets or sets the video codec.
/// Omit to copy
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index e1f0e78f4c..47a31853ba 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -133,7 +133,6 @@
-
@@ -155,6 +154,8 @@
+
+
@@ -366,10 +367,12 @@
+
+
+
-
@@ -423,6 +426,8 @@
+
+
diff --git a/MediaBrowser.Model/Net/HttpResponse.cs b/MediaBrowser.Model/Net/HttpResponse.cs
new file mode 100644
index 0000000000..f4bd8e681d
--- /dev/null
+++ b/MediaBrowser.Model/Net/HttpResponse.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Net;
+
+namespace MediaBrowser.Model.Net
+{
+ public class HttpResponse : IDisposable
+ {
+ ///
+ /// Gets or sets the type of the content.
+ ///
+ /// The type of the content.
+ public string ContentType { get; set; }
+
+ ///
+ /// Gets or sets the response URL.
+ ///
+ /// The response URL.
+ public string ResponseUrl { get; set; }
+
+ ///
+ /// Gets or sets the content.
+ ///
+ /// The content.
+ public Stream Content { get; set; }
+
+ ///
+ /// Gets or sets the status code.
+ ///
+ /// The status code.
+ public HttpStatusCode StatusCode { get; set; }
+
+ ///
+ /// Gets or sets the length of the content.
+ ///
+ /// The length of the content.
+ public long? ContentLength { get; set; }
+
+ ///
+ /// Gets or sets the headers.
+ ///
+ /// The headers.
+ public Dictionary Headers { get; set; }
+
+ private readonly IDisposable _disposable;
+
+ public HttpResponse(IDisposable disposable)
+ {
+ _disposable = disposable;
+ }
+ public HttpResponse()
+ {
+ }
+
+ public void Dispose()
+ {
+ if (_disposable != null)
+ {
+ _disposable.Dispose();
+ }
+ }
+ }
+}
diff --git a/MediaBrowser.Common/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs
similarity index 66%
rename from MediaBrowser.Common/Net/MimeTypes.cs
rename to MediaBrowser.Model/Net/MimeTypes.cs
index 14052e7599..6eaac8f031 100644
--- a/MediaBrowser.Common/Net/MimeTypes.cs
+++ b/MediaBrowser.Model/Net/MimeTypes.cs
@@ -3,18 +3,13 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
-namespace MediaBrowser.Common.Net
+namespace MediaBrowser.Model.Net
{
///
/// Class MimeTypes
///
public static class MimeTypes
{
- ///
- /// The json MIME type
- ///
- public static string JsonMimeType = "application/json";
-
///
/// Any extension in this list is considered a video file - can be added to at runtime for extensibility
///
@@ -52,35 +47,44 @@ namespace MediaBrowser.Common.Net
private static readonly Dictionary VideoFileExtensionsDictionary = VideoFileExtensions.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
- ///
- /// Determines whether [is video file] [the specified path].
- ///
- /// The path.
- /// true if [is video file] [the specified path]; otherwise, false.
- public static bool IsVideoFile(string path)
- {
- if (string.IsNullOrEmpty(path))
- {
- throw new ArgumentNullException("path");
- }
-
- var extension = Path.GetExtension(path);
+ // http://en.wikipedia.org/wiki/Internet_media_type
+ // Add more as needed
- if (string.IsNullOrEmpty(extension))
+ private static readonly Dictionary MimeTypeLookup =
+ new Dictionary(StringComparer.OrdinalIgnoreCase)
{
- return false;
- }
-
- return VideoFileExtensionsDictionary.ContainsKey(extension);
- }
+ {".jpg", "image/jpeg"},
+ {".jpeg", "image/jpeg"},
+ {".tbn", "image/jpeg"},
+ {".png", "image/png"},
+ {".gif", "image/gif"},
+ {".webp", "image/webp"},
+ {".ico", "image/vnd.microsoft.icon"},
+ {".mpg", "video/mpeg"},
+ {".mpeg", "video/mpeg"},
+ {".ogv", "video/ogg"},
+ {".mov", "video/quicktime"},
+ {".webm", "video/webm"},
+ {".mkv", "video/x-matroska"},
+ {".wmv", "video/x-ms-wmv"},
+ {".flv", "video/x-flv"},
+ {".avi", "video/x-msvideo"},
+ {".asf", "video/x-ms-asf"},
+ {".m4v", "video/x-m4v"}
+ };
+
+ private static readonly Dictionary ExtensionLookup =
+ MimeTypeLookup
+ .GroupBy(i => i.Value)
+ .ToDictionary(x => x.Key, x => x.First().Key, StringComparer.OrdinalIgnoreCase);
///
/// Gets the type of the MIME.
///
/// The path.
/// System.String.
- /// path
- /// Argument not supported: + path
+ /// path
+ /// Argument not supported: + path
public static string GetMimeType(string path)
{
if (string.IsNullOrEmpty(path))
@@ -90,50 +94,13 @@ namespace MediaBrowser.Common.Net
var ext = Path.GetExtension(path) ?? string.Empty;
- // http://en.wikipedia.org/wiki/Internet_media_type
- // Add more as needed
-
- // Type video
- if (ext.Equals(".mpg", StringComparison.OrdinalIgnoreCase) || ext.EndsWith("mpeg", StringComparison.OrdinalIgnoreCase))
- {
- return "video/mpeg";
- }
- if (ext.Equals(".ogv", StringComparison.OrdinalIgnoreCase))
- {
- return "video/ogg";
- }
- if (ext.Equals(".mov", StringComparison.OrdinalIgnoreCase))
- {
- return "video/quicktime";
- }
- if (ext.Equals(".webm", StringComparison.OrdinalIgnoreCase))
- {
- return "video/webm";
- }
- if (ext.Equals(".mkv", StringComparison.OrdinalIgnoreCase))
+ string result;
+ if (MimeTypeLookup.TryGetValue(ext, out result))
{
- return "video/x-matroska";
- }
- if (ext.Equals(".wmv", StringComparison.OrdinalIgnoreCase))
- {
- return "video/x-ms-wmv";
- }
- if (ext.Equals(".flv", StringComparison.OrdinalIgnoreCase))
- {
- return "video/x-flv";
- }
- if (ext.Equals(".avi", StringComparison.OrdinalIgnoreCase))
- {
- return "video/x-msvideo";
- }
- if (ext.Equals(".m4v", StringComparison.OrdinalIgnoreCase))
- {
- return "video/x-m4v";
- }
- if (ext.EndsWith("asf", StringComparison.OrdinalIgnoreCase))
- {
- return "video/x-ms-asf";
+ return result;
}
+
+ // Type video
if (ext.Equals(".3gp", StringComparison.OrdinalIgnoreCase))
{
return "video/3gpp";
@@ -197,28 +164,6 @@ namespace MediaBrowser.Common.Net
return "application/x-cdisplay";
}
- // Type image
- if (ext.Equals(".gif", StringComparison.OrdinalIgnoreCase))
- {
- return "image/gif";
- }
- if (ext.Equals(".jpg", StringComparison.OrdinalIgnoreCase) || ext.Equals(".jpeg", StringComparison.OrdinalIgnoreCase) || ext.Equals(".tbn", StringComparison.OrdinalIgnoreCase))
- {
- return "image/jpeg";
- }
- if (ext.Equals(".png", StringComparison.OrdinalIgnoreCase))
- {
- return "image/png";
- }
- if (ext.Equals(".webp", StringComparison.OrdinalIgnoreCase))
- {
- return "image/webp";
- }
- if (ext.Equals(".ico", StringComparison.OrdinalIgnoreCase))
- {
- return "image/vnd.microsoft.icon";
- }
-
// Type audio
if (ext.Equals(".mp3", StringComparison.OrdinalIgnoreCase))
{
@@ -272,7 +217,7 @@ namespace MediaBrowser.Common.Net
}
if (ext.Equals(".json", StringComparison.OrdinalIgnoreCase))
{
- return JsonMimeType;
+ return "application/json";
}
if (ext.Equals(".map", StringComparison.OrdinalIgnoreCase))
{
@@ -320,19 +265,9 @@ namespace MediaBrowser.Common.Net
throw new ArgumentException("Argument not supported: " + path);
}
- private static readonly Dictionary MimeExtensions =
- new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- {"image/jpeg", "jpg"},
- {"image/jpg", "jpg"},
- {"image/png", "png"},
- {"image/gif", "gif"},
- {"image/webp", "webp"}
- };
-
public static string ToExtension(string mimeType)
{
- return "." + MimeExtensions[mimeType];
+ return ExtensionLookup[mimeType];
}
}
}
diff --git a/MediaBrowser.Model/Sync/ItemFIleInfo.cs b/MediaBrowser.Model/Sync/ItemFIleInfo.cs
new file mode 100644
index 0000000000..6ae9ceb18d
--- /dev/null
+++ b/MediaBrowser.Model/Sync/ItemFIleInfo.cs
@@ -0,0 +1,28 @@
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Model.Sync
+{
+ public class ItemFileInfo
+ {
+ ///
+ /// Gets or sets the type.
+ ///
+ /// The type.
+ public ItemFileType Type { get; set; }
+ ///
+ /// Gets or sets the item identifier.
+ ///
+ /// The item identifier.
+ public string ItemId { get; set; }
+ ///
+ /// Gets or sets the name.
+ ///
+ /// The name.
+ public string Name { get; set; }
+ ///
+ /// Gets or sets the type of the image.
+ ///
+ /// The type of the image.
+ public ImageType ImageType { get; set; }
+ }
+}
diff --git a/MediaBrowser.Model/Sync/ItemFileType.cs b/MediaBrowser.Model/Sync/ItemFileType.cs
new file mode 100644
index 0000000000..305f4c502d
--- /dev/null
+++ b/MediaBrowser.Model/Sync/ItemFileType.cs
@@ -0,0 +1,19 @@
+
+namespace MediaBrowser.Model.Sync
+{
+ public enum ItemFileType
+ {
+ ///
+ /// The media
+ ///
+ Media = 0,
+ ///
+ /// The image
+ ///
+ Image = 1,
+ ///
+ /// The subtitles
+ ///
+ Subtitles = 2
+ }
+}
diff --git a/MediaBrowser.Model/Sync/SyncItem.cs b/MediaBrowser.Model/Sync/SyncItem.cs
deleted file mode 100644
index d50ae98c99..0000000000
--- a/MediaBrowser.Model/Sync/SyncItem.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using MediaBrowser.Model.Dto;
-
-namespace MediaBrowser.Model.Sync
-{
- public class SyncItem
- {
- public BaseItemDto Item { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/Sync/SyncJobItem.cs b/MediaBrowser.Model/Sync/SyncJobItem.cs
index 063f7feb25..d9fb1ed095 100644
--- a/MediaBrowser.Model/Sync/SyncJobItem.cs
+++ b/MediaBrowser.Model/Sync/SyncJobItem.cs
@@ -22,6 +22,12 @@ namespace MediaBrowser.Model.Sync
/// The item identifier.
public string ItemId { get; set; }
+ ///
+ /// Gets or sets the media source identifier.
+ ///
+ /// The media source identifier.
+ public string MediaSourceId { get; set; }
+
///
/// Gets or sets the target identifier.
///
diff --git a/MediaBrowser.Model/Sync/SyncedItem.cs b/MediaBrowser.Model/Sync/SyncedItem.cs
new file mode 100644
index 0000000000..784a12bc94
--- /dev/null
+++ b/MediaBrowser.Model/Sync/SyncedItem.cs
@@ -0,0 +1,38 @@
+using MediaBrowser.Model.Dto;
+
+namespace MediaBrowser.Model.Sync
+{
+ public class SyncedItem
+ {
+ ///
+ /// Gets or sets the server identifier.
+ ///
+ /// The server identifier.
+ public string ServerId { get; set; }
+ ///
+ /// Gets or sets the synchronize job identifier.
+ ///
+ /// The synchronize job identifier.
+ public string SyncJobId { get; set; }
+ ///
+ /// Gets or sets the synchronize job item identifier.
+ ///
+ /// The synchronize job item identifier.
+ public string SyncJobItemId { get; set; }
+ ///
+ /// Gets or sets the name of the original file.
+ ///
+ /// The name of the original file.
+ public string OriginalFileName { get; set; }
+ ///
+ /// Gets or sets the item.
+ ///
+ /// The item.
+ public BaseItemDto Item { get; set; }
+ ///
+ /// Gets or sets the user identifier.
+ ///
+ /// The user identifier.
+ public string UserId { get; set; }
+ }
+}
diff --git a/MediaBrowser.Model/Users/UserAction.cs b/MediaBrowser.Model/Users/UserAction.cs
new file mode 100644
index 0000000000..93c22d726f
--- /dev/null
+++ b/MediaBrowser.Model/Users/UserAction.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace MediaBrowser.Model.Users
+{
+ public class UserAction
+ {
+ public string ServerId { get; set; }
+ public string UserId { get; set; }
+ public string ItemId { get; set; }
+ public UserActionType Type { get; set; }
+ public DateTime Date { get; set; }
+ public long? PositionTicks { get; set; }
+ }
+}
diff --git a/MediaBrowser.Model/Users/UserActionType.cs b/MediaBrowser.Model/Users/UserActionType.cs
new file mode 100644
index 0000000000..493de62729
--- /dev/null
+++ b/MediaBrowser.Model/Users/UserActionType.cs
@@ -0,0 +1,8 @@
+
+namespace MediaBrowser.Model.Users
+{
+ public enum UserActionType
+ {
+ PlayedItem = 0
+ }
+}
diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs
index 2c97f2c169..700bca0fab 100644
--- a/MediaBrowser.Providers/Manager/ImageSaver.cs
+++ b/MediaBrowser.Providers/Manager/ImageSaver.cs
@@ -16,6 +16,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using MediaBrowser.Model.Net;
namespace MediaBrowser.Providers.Manager
{
diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs
index 52c252d24b..52ec5c9b12 100644
--- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs
+++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs
@@ -34,7 +34,7 @@ namespace MediaBrowser.Server.Implementations.Connect
{
LoadCachedAddress();
- _timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(10), TimeSpan.FromHours(6));
+ _timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(3));
}
private async void TimerCallback(object state)
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
index e13e27d5ad..681d3ac5e5 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -12,7 +12,7 @@ using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
-using MimeTypes = MediaBrowser.Common.Net.MimeTypes;
+using MimeTypes = MediaBrowser.Model.Net.MimeTypes;
namespace MediaBrowser.Server.Implementations.HttpServer
{
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
index cc261c3e7b..e3447afc99 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs
@@ -30,12 +30,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
{
return null;
}
-
- // This is a bit of a one-off but it's here to combat MCM's over-aggressive placement of collection.xml files where they don't belong, including in series folders.
- if (args.ContainsMetaFileByName("series.xml"))
- {
- return null;
- }
if (filename.IndexOf("[boxset]", StringComparison.OrdinalIgnoreCase) != -1 ||
args.ContainsFileSystemEntryByName("collection.xml"))
diff --git a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs
index 3f132ab7fa..ed3503c1b9 100644
--- a/MediaBrowser.Server.Implementations/Library/UserDataManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/UserDataManager.cs
@@ -1,6 +1,8 @@
using System.Collections.Generic;
using MediaBrowser.Common.Events;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
@@ -23,9 +25,11 @@ namespace MediaBrowser.Server.Implementations.Library
private readonly ConcurrentDictionary _userData = new ConcurrentDictionary();
private readonly ILogger _logger;
+ private readonly IServerConfigurationManager _config;
- public UserDataManager(ILogManager logManager)
+ public UserDataManager(ILogManager logManager, IServerConfigurationManager config)
{
+ _config = config;
_logger = logManager.GetLogger(GetType().Name);
}
@@ -35,22 +39,6 @@ namespace MediaBrowser.Server.Implementations.Library
/// The repository.
public IUserDataRepository Repository { get; set; }
- ///
- /// Saves the user data.
- ///
- /// The user id.
- /// The item.
- /// The user data.
- /// The reason.
- /// The cancellation token.
- /// Task.
- /// userData
- /// or
- /// cancellationToken
- /// or
- /// userId
- /// or
- /// key
public async Task SaveUserData(Guid userId, IHasUserData item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken)
{
if (userData == null)
@@ -219,5 +207,59 @@ namespace MediaBrowser.Server.Implementations.Library
Key = data.Key
};
}
+
+ public bool UpdatePlayState(BaseItem item, UserItemData data, long positionTicks)
+ {
+ var playedToCompletion = false;
+
+ var hasRuntime = item.RunTimeTicks.HasValue && item.RunTimeTicks > 0;
+
+ // If a position has been reported, and if we know the duration
+ if (positionTicks > 0 && hasRuntime)
+ {
+ var pctIn = Decimal.Divide(positionTicks, item.RunTimeTicks.Value) * 100;
+
+ // Don't track in very beginning
+ if (pctIn < _config.Configuration.MinResumePct)
+ {
+ positionTicks = 0;
+ }
+
+ // If we're at the end, assume completed
+ else if (pctIn > _config.Configuration.MaxResumePct || positionTicks >= item.RunTimeTicks.Value)
+ {
+ positionTicks = 0;
+ data.Played = playedToCompletion = true;
+ }
+
+ else
+ {
+ // Enforce MinResumeDuration
+ var durationSeconds = TimeSpan.FromTicks(item.RunTimeTicks.Value).TotalSeconds;
+
+ if (durationSeconds < _config.Configuration.MinResumeDurationSeconds)
+ {
+ positionTicks = 0;
+ data.Played = playedToCompletion = true;
+ }
+ }
+ }
+ else if (!hasRuntime)
+ {
+ // If we don't know the runtime we'll just have to assume it was fully played
+ data.Played = playedToCompletion = true;
+ positionTicks = 0;
+ }
+
+ if (item is Audio)
+ {
+ positionTicks = 0;
+ }
+
+ data.PlaybackPositionTicks = positionTicks;
+
+ return playedToCompletion;
+ }
+
}
}
diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/en_US.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/en_US.json
index 7a0b1e46a6..ad12450df4 100644
--- a/MediaBrowser.Server.Implementations/Localization/JavaScript/en_US.json
+++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/en_US.json
@@ -251,7 +251,6 @@
"HeaderDeleteItem": "Delete Item",
"ConfirmDeleteItem": "Are you sure you wish to delete this item from your library?",
"MessagePleaseEnterNameOrId": "Please enter a name or an external Id.",
- "MessageValueNotCorrect": "The value entered is not correct. Please try again.",
"MessageItemSaved": "Item saved.",
"OptionEnded": "Ended",
"OptionContinuing": "Continuing",
diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json
index b5c1ea0d3f..f70e110b05 100644
--- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json
+++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json
@@ -252,7 +252,7 @@
"ButtonMoveRight": "Move right",
"ButtonBrowseOnlineImages": "Browse online images",
"HeaderDeleteItem": "Delete Item",
- "ConfirmDeleteItem": "Are you sure you wish to delete this item from your library?",
+ "ConfirmDeleteItem": "Deleting this item will delete it from both the file system and your media library. Are you sure you wish to continue?",
"MessagePleaseEnterNameOrId": "Please enter a name or an external Id.",
"MessageValueNotCorrect": "The value entered is not correct. Please try again.",
"MessageItemSaved": "Item saved.",
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
index 1f294c325e..4c587d1ab6 100644
--- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs
+++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
@@ -67,12 +67,6 @@ namespace MediaBrowser.Server.Implementations.Session
private readonly IAuthenticationRepository _authRepo;
private readonly IDeviceManager _deviceManager;
- ///
- /// Gets or sets the configuration manager.
- ///
- /// The configuration manager.
- private readonly IServerConfigurationManager _configurationManager;
-
///
/// The _active connections
///
@@ -105,18 +99,9 @@ namespace MediaBrowser.Server.Implementations.Session
private readonly SemaphoreSlim _sessionLock = new SemaphoreSlim(1, 1);
- ///
- /// Initializes a new instance of the class.
- ///
- /// The user data repository.
- /// The configuration manager.
- /// The logger.
- /// The user repository.
- /// The library manager.
- public SessionManager(IUserDataManager userDataRepository, IServerConfigurationManager configurationManager, ILogger logger, IUserRepository userRepository, ILibraryManager libraryManager, IUserManager userManager, IMusicManager musicManager, IDtoService dtoService, IImageProcessor imageProcessor, IItemRepository itemRepo, IJsonSerializer jsonSerializer, IServerApplicationHost appHost, IHttpClient httpClient, IAuthenticationRepository authRepo, IDeviceManager deviceManager)
+ public SessionManager(IUserDataManager userDataRepository, ILogger logger, IUserRepository userRepository, ILibraryManager libraryManager, IUserManager userManager, IMusicManager musicManager, IDtoService dtoService, IImageProcessor imageProcessor, IItemRepository itemRepo, IJsonSerializer jsonSerializer, IServerApplicationHost appHost, IHttpClient httpClient, IAuthenticationRepository authRepo, IDeviceManager deviceManager)
{
_userDataRepository = userDataRepository;
- _configurationManager = configurationManager;
_logger = logger;
_userRepository = userRepository;
_libraryManager = libraryManager;
@@ -689,7 +674,7 @@ namespace MediaBrowser.Server.Implementations.Session
if (positionTicks.HasValue)
{
- UpdatePlayState(item, data, positionTicks.Value);
+ _userDataRepository.UpdatePlayState(item, data, positionTicks.Value);
await _userDataRepository.SaveUserData(userId, item, data, UserDataSaveReason.PlaybackProgress, CancellationToken.None).ConfigureAwait(false);
}
@@ -779,7 +764,7 @@ namespace MediaBrowser.Server.Implementations.Session
if (positionTicks.HasValue)
{
- playedToCompletion = UpdatePlayState(item, data, positionTicks.Value);
+ playedToCompletion = _userDataRepository.UpdatePlayState(item, data, positionTicks.Value);
}
else
{
@@ -795,65 +780,6 @@ namespace MediaBrowser.Server.Implementations.Session
return playedToCompletion;
}
- ///
- /// Updates playstate position for an item but does not save
- ///
- /// The item
- /// User data for the item
- /// The current playback position
- private bool UpdatePlayState(BaseItem item, UserItemData data, long positionTicks)
- {
- var playedToCompletion = false;
-
- var hasRuntime = item.RunTimeTicks.HasValue && item.RunTimeTicks > 0;
-
- // If a position has been reported, and if we know the duration
- if (positionTicks > 0 && hasRuntime)
- {
- var pctIn = Decimal.Divide(positionTicks, item.RunTimeTicks.Value) * 100;
-
- // Don't track in very beginning
- if (pctIn < _configurationManager.Configuration.MinResumePct)
- {
- positionTicks = 0;
- }
-
- // If we're at the end, assume completed
- else if (pctIn > _configurationManager.Configuration.MaxResumePct || positionTicks >= item.RunTimeTicks.Value)
- {
- positionTicks = 0;
- data.Played = playedToCompletion = true;
- }
-
- else
- {
- // Enforce MinResumeDuration
- var durationSeconds = TimeSpan.FromTicks(item.RunTimeTicks.Value).TotalSeconds;
-
- if (durationSeconds < _configurationManager.Configuration.MinResumeDurationSeconds)
- {
- positionTicks = 0;
- data.Played = playedToCompletion = true;
- }
- }
- }
- else if (!hasRuntime)
- {
- // If we don't know the runtime we'll just have to assume it was fully played
- data.Played = playedToCompletion = true;
- positionTicks = 0;
- }
-
- if (item is Audio)
- {
- positionTicks = 0;
- }
-
- data.PlaybackPositionTicks = positionTicks;
-
- return playedToCompletion;
- }
-
///
/// Gets the session.
///
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
index 6dda869eee..5c933b4bd5 100644
--- a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
+++ b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
@@ -358,6 +358,9 @@ namespace MediaBrowser.Server.Implementations.Sync
var streamInfo = new StreamBuilder().BuildVideoItem(options);
var mediaSource = streamInfo.MediaSource;
+ jobItem.MediaSourceId = streamInfo.MediaSourceId;
+ await _syncRepo.Update(jobItem).ConfigureAwait(false);
+
if (streamInfo.PlayMethod != PlayMethod.Transcode)
{
if (mediaSource.Protocol == MediaProtocol.File)
@@ -389,6 +392,9 @@ namespace MediaBrowser.Server.Implementations.Sync
var streamInfo = new StreamBuilder().BuildAudioItem(options);
var mediaSource = streamInfo.MediaSource;
+ jobItem.MediaSourceId = streamInfo.MediaSourceId;
+ await _syncRepo.Update(jobItem).ConfigureAwait(false);
+
if (streamInfo.PlayMethod != PlayMethod.Transcode)
{
if (mediaSource.Protocol == MediaProtocol.File)
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs
index 3006c1be92..f92cbeda3d 100644
--- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs
+++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs
@@ -1,5 +1,9 @@
-using MediaBrowser.Common.Extensions;
+using System.IO;
+using MediaBrowser.Common;
+using MediaBrowser.Common.Extensions;
+using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Drawing;
+using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.TV;
@@ -7,10 +11,12 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Sync;
using MediaBrowser.Model.Dlna;
+using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Sync;
+using MediaBrowser.Model.Users;
using MoreLinq;
using System;
using System.Collections.Generic;
@@ -26,16 +32,20 @@ namespace MediaBrowser.Server.Implementations.Sync
private readonly IImageProcessor _imageProcessor;
private readonly ILogger _logger;
private readonly IUserManager _userManager;
+ private readonly IDtoService _dtoService;
+ private readonly IApplicationHost _appHost;
private ISyncProvider[] _providers = { };
- public SyncManager(ILibraryManager libraryManager, ISyncRepository repo, IImageProcessor imageProcessor, ILogger logger, IUserManager userManager)
+ public SyncManager(ILibraryManager libraryManager, ISyncRepository repo, IImageProcessor imageProcessor, ILogger logger, IUserManager userManager, IDtoService dtoService, IApplicationHost appHost)
{
_libraryManager = libraryManager;
_repo = repo;
_imageProcessor = imageProcessor;
_logger = logger;
_userManager = userManager;
+ _dtoService = dtoService;
+ _appHost = appHost;
}
public void AddParts(IEnumerable providers)
@@ -251,6 +261,11 @@ namespace MediaBrowser.Server.Implementations.Sync
}
}
+ if (item is LiveTvChannel || item is IChannelItem || item is ILiveTvRecording)
+ {
+ return false;
+ }
+
return true;
}
@@ -301,5 +316,54 @@ namespace MediaBrowser.Server.Implementations.Sync
{
return _repo.GetJobItems(query);
}
+
+ public SyncedItem GetJobItemInfo(string id)
+ {
+ var jobItem = GetJobItem(id);
+ var job = _repo.GetJob(jobItem.JobId);
+
+ var libraryItem = _libraryManager.GetItemById(jobItem.ItemId);
+
+ var syncedItem = new SyncedItem
+ {
+ SyncJobId = jobItem.JobId,
+ SyncJobItemId = jobItem.Id,
+ ServerId = _appHost.SystemId,
+ UserId = job.UserId
+ };
+
+ // Get everything
+ var fields = Enum.GetNames(typeof(ItemFields)).Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true)).ToList();
+
+ syncedItem.Item = _dtoService.GetBaseItemDto(libraryItem, new DtoOptions
+ {
+ Fields = fields
+ });
+
+ // TODO: this should be the media source of the transcoded output
+ syncedItem.Item.MediaSources = syncedItem.Item.MediaSources
+ .Where(i => string.Equals(i.Id, jobItem.MediaSourceId))
+ .ToList();
+
+ var mediaSource = syncedItem.Item.MediaSources
+ .FirstOrDefault(i => string.Equals(i.Id, jobItem.MediaSourceId));
+
+ // This will be null for items that are not audio/video
+ if (mediaSource == null)
+ {
+ syncedItem.OriginalFileName = Path.GetFileName(libraryItem.Path);
+ }
+ else
+ {
+ syncedItem.OriginalFileName = Path.GetFileName(mediaSource.Path);
+ }
+
+ return syncedItem;
+ }
+
+ public Task ReportOfflineAction(UserAction action)
+ {
+ return Task.FromResult(true);
+ }
}
}
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs b/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs
index e65d4c66e9..2ff6d7ae6b 100644
--- a/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs
+++ b/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs
@@ -36,7 +36,7 @@ namespace MediaBrowser.Server.Implementations.Sync
public async Task Initialize()
{
- var dbFile = Path.Combine(_appPaths.DataPath, "sync6.db");
+ var dbFile = Path.Combine(_appPaths.DataPath, "sync7.db");
_connection = await SqliteExtensions.ConnectToDb(dbFile, _logger).ConfigureAwait(false);
@@ -45,7 +45,7 @@ namespace MediaBrowser.Server.Implementations.Sync
"create table if not exists SyncJobs (Id GUID PRIMARY KEY, TargetId TEXT NOT NULL, Name TEXT NOT NULL, Quality TEXT NOT NULL, Status TEXT NOT NULL, Progress FLOAT, UserId TEXT NOT NULL, ItemIds TEXT NOT NULL, Category TEXT, ParentId TEXT, UnwatchedOnly BIT, ItemLimit INT, SyncNewContent BIT, DateCreated DateTime, DateLastModified DateTime, ItemCount int)",
"create index if not exists idx_SyncJobs on SyncJobs(Id)",
- "create table if not exists SyncJobItems (Id GUID PRIMARY KEY, ItemId TEXT, JobId TEXT, OutputPath TEXT, Status TEXT, TargetId TEXT, DateCreated DateTime, Progress FLOAT)",
+ "create table if not exists SyncJobItems (Id GUID PRIMARY KEY, ItemId TEXT, MediaSourceId TEXT, JobId TEXT, OutputPath TEXT, Status TEXT, TargetId TEXT, DateCreated DateTime, Progress FLOAT)",
"create index if not exists idx_SyncJobItems on SyncJobs(Id)",
//pragmas
@@ -90,10 +90,11 @@ namespace MediaBrowser.Server.Implementations.Sync
_saveJobCommand.Parameters.Add(_saveJobCommand, "@ItemCount");
_saveJobItemCommand = _connection.CreateCommand();
- _saveJobItemCommand.CommandText = "replace into SyncJobItems (Id, ItemId, JobId, OutputPath, Status, TargetId, DateCreated, Progress) values (@Id, @ItemId, @JobId, @OutputPath, @Status, @TargetId, @DateCreated, @Progress)";
+ _saveJobItemCommand.CommandText = "replace into SyncJobItems (Id, ItemId, MediaSourceId, JobId, OutputPath, Status, TargetId, DateCreated, Progress) values (@Id, @ItemId, @MediaSourceId, @JobId, @OutputPath, @Status, @TargetId, @DateCreated, @Progress)";
_saveJobItemCommand.Parameters.Add(_saveJobCommand, "@Id");
_saveJobItemCommand.Parameters.Add(_saveJobCommand, "@ItemId");
+ _saveJobItemCommand.Parameters.Add(_saveJobCommand, "@MediaSourceId");
_saveJobItemCommand.Parameters.Add(_saveJobCommand, "@JobId");
_saveJobItemCommand.Parameters.Add(_saveJobCommand, "@OutputPath");
_saveJobItemCommand.Parameters.Add(_saveJobCommand, "@Status");
@@ -103,7 +104,7 @@ namespace MediaBrowser.Server.Implementations.Sync
}
private const string BaseJobSelectText = "select Id, TargetId, Name, Quality, Status, Progress, UserId, ItemIds, Category, ParentId, UnwatchedOnly, ItemLimit, SyncNewContent, DateCreated, DateLastModified, ItemCount from SyncJobs";
- private const string BaseJobItemSelectText = "select Id, ItemId, JobId, OutputPath, Status, TargetId, DateCreated, Progress from SyncJobItems";
+ private const string BaseJobItemSelectText = "select Id, ItemId, MediaSourceId, JobId, OutputPath, Status, TargetId, DateCreated, Progress from SyncJobItems";
public SyncJob GetJob(string id)
{
@@ -556,6 +557,7 @@ namespace MediaBrowser.Server.Implementations.Sync
_saveJobItemCommand.GetParameter(index++).Value = new Guid(jobItem.Id);
_saveJobItemCommand.GetParameter(index++).Value = jobItem.ItemId;
+ _saveJobItemCommand.GetParameter(index++).Value = jobItem.MediaSourceId;
_saveJobItemCommand.GetParameter(index++).Value = jobItem.JobId;
_saveJobItemCommand.GetParameter(index++).Value = jobItem.OutputPath;
_saveJobItemCommand.GetParameter(index++).Value = jobItem.Status;
@@ -606,26 +608,27 @@ namespace MediaBrowser.Server.Implementations.Sync
{
Id = reader.GetGuid(0).ToString("N"),
ItemId = reader.GetString(1),
- JobId = reader.GetString(2)
+ MediaSourceId = reader.GetString(2),
+ JobId = reader.GetString(3)
};
- if (!reader.IsDBNull(3))
+ if (!reader.IsDBNull(4))
{
- info.OutputPath = reader.GetString(3);
+ info.OutputPath = reader.GetString(4);
}
- if (!reader.IsDBNull(4))
+ if (!reader.IsDBNull(5))
{
- info.Status = (SyncJobItemStatus)Enum.Parse(typeof(SyncJobItemStatus), reader.GetString(4), true);
+ info.Status = (SyncJobItemStatus)Enum.Parse(typeof(SyncJobItemStatus), reader.GetString(5), true);
}
- info.TargetId = reader.GetString(5);
+ info.TargetId = reader.GetString(6);
- info.DateCreated = reader.GetDateTime(6);
+ info.DateCreated = reader.GetDateTime(7);
- if (!reader.IsDBNull(7))
+ if (!reader.IsDBNull(8))
{
- info.Progress = reader.GetDouble(7);
+ info.Progress = reader.GetDouble(8);
}
return info;
diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
index c2520ff6bb..06d63b355e 100644
--- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
+++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
@@ -410,7 +410,7 @@ namespace MediaBrowser.Server.Startup.Common
RegisterSingleInstance(() => new BdInfoExaminer());
- UserDataManager = new UserDataManager(LogManager);
+ UserDataManager = new UserDataManager(LogManager, ServerConfigurationManager);
RegisterSingleInstance(UserDataManager);
UserRepository = await GetUserRepository().ConfigureAwait(false);
@@ -470,7 +470,7 @@ namespace MediaBrowser.Server.Startup.Common
ImageProcessor = new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, MediaEncoder);
RegisterSingleInstance(ImageProcessor);
- SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager);
+ SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager, DtoService, this);
RegisterSingleInstance(SyncManager);
DtoService = new DtoService(Logger, LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, SyncManager, this);
@@ -485,7 +485,7 @@ namespace MediaBrowser.Server.Startup.Common
DeviceManager = new DeviceManager(new DeviceRepository(ApplicationPaths, JsonSerializer, Logger), UserManager, FileSystemManager, LibraryMonitor, ConfigurationManager, LogManager.GetLogger("DeviceManager"));
RegisterSingleInstance(DeviceManager);
- SessionManager = new SessionManager(UserDataManager, ServerConfigurationManager, Logger, UserRepository, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, ItemRepository, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager);
+ SessionManager = new SessionManager(UserDataManager, Logger, UserRepository, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, ItemRepository, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager);
RegisterSingleInstance(SessionManager);
var newsService = new Implementations.News.NewsService(ApplicationPaths, JsonSerializer);
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index eb44f6d35c..6e34390797 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -8,6 +8,7 @@ using MediaBrowser.Controller.Localization;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Logging;
+using MediaBrowser.Model.Net;
using MediaBrowser.Model.Serialization;
using ServiceStack;
using ServiceStack.Web;
diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec
index 6dfb39b4c6..8f4e916dde 100644
--- a/Nuget/MediaBrowser.Common.Internal.nuspec
+++ b/Nuget/MediaBrowser.Common.Internal.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common.Internal
- 3.0.523
+ 3.0.530
MediaBrowser.Common.Internal
Luke
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.
Copyright © Media Browser 2013
-
+
diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec
index 49fd835c33..01fe110fba 100644
--- a/Nuget/MediaBrowser.Common.nuspec
+++ b/Nuget/MediaBrowser.Common.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common
- 3.0.523
+ 3.0.530
MediaBrowser.Common
Media Browser Team
ebr,Luke,scottisafool
diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspec
index d5164f0254..86a6d19d3b 100644
--- a/Nuget/MediaBrowser.Model.Signed.nuspec
+++ b/Nuget/MediaBrowser.Model.Signed.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Model.Signed
- 3.0.523
+ 3.0.530
MediaBrowser.Model - Signed Edition
Media Browser Team
ebr,Luke,scottisafool
diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec
index 297b0f07ec..686396f894 100644
--- a/Nuget/MediaBrowser.Server.Core.nuspec
+++ b/Nuget/MediaBrowser.Server.Core.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Server.Core
- 3.0.523
+ 3.0.530
Media Browser.Server.Core
Media Browser Team
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains core components required to build plugins for Media Browser Server.
Copyright © Media Browser 2013
-
+