update camera upload

This commit is contained in:
Luke Pulverenti 2015-09-10 14:28:22 -04:00
parent ce0435a66d
commit baf2f80154
13 changed files with 98 additions and 30 deletions

View File

@ -1,4 +1,6 @@
using MediaBrowser.Controller.Devices; using System;
using System.Linq;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Devices; using MediaBrowser.Model.Devices;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
@ -128,15 +130,32 @@ namespace MediaBrowser.Api.Devices
var id = Request.QueryString["Id"]; var id = Request.QueryString["Id"];
var name = Request.QueryString["Name"]; var name = Request.QueryString["Name"];
var task = _deviceManager.AcceptCameraUpload(deviceId, request.RequestStream, new LocalFileInfo if (Request.ContentType.IndexOf("multi", StringComparison.OrdinalIgnoreCase) == -1)
{ {
MimeType = Request.ContentType, var task = _deviceManager.AcceptCameraUpload(deviceId, request.RequestStream, new LocalFileInfo
Album = album, {
Name = name, MimeType = Request.ContentType,
Id = id Album = album,
}); Name = name,
Id = id
});
Task.WaitAll(task); Task.WaitAll(task);
}
else
{
var file = Request.Files.First();
var task = _deviceManager.AcceptCameraUpload(deviceId, file.InputStream, new LocalFileInfo
{
MimeType = file.ContentType,
Album = album,
Name = name,
Id = id
});
Task.WaitAll(task);
}
} }
} }
} }

View File

@ -58,7 +58,7 @@ namespace MediaBrowser.Common.ScheduledTasks
{ {
if (isApplicationStartup) if (isApplicationStartup)
{ {
triggerDate = DateTime.UtcNow.AddMinutes(5); triggerDate = DateTime.UtcNow.AddMinutes(2);
} }
else else
{ {

View File

@ -20,6 +20,7 @@ namespace MediaBrowser.Controller.LiveTv
public string EpisodeTitle { get; set; } public string EpisodeTitle { get; set; }
public bool IsSeries { get; set; } public bool IsSeries { get; set; }
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
[IgnoreDataMember]
public DateTime StartDate { get; set; } public DateTime StartDate { get; set; }
public RecordingStatus Status { get; set; } public RecordingStatus Status { get; set; }
[IgnoreDataMember] [IgnoreDataMember]

View File

@ -56,6 +56,7 @@ namespace MediaBrowser.Controller.LiveTv
/// <summary> /// <summary>
/// The start date of the program, in UTC. /// The start date of the program, in UTC.
/// </summary> /// </summary>
[IgnoreDataMember]
public DateTime StartDate { get; set; } public DateTime StartDate { get; set; }
/// <summary> /// <summary>

View File

@ -20,6 +20,7 @@ namespace MediaBrowser.Controller.LiveTv
public string EpisodeTitle { get; set; } public string EpisodeTitle { get; set; }
public bool IsSeries { get; set; } public bool IsSeries { get; set; }
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
[IgnoreDataMember]
public DateTime StartDate { get; set; } public DateTime StartDate { get; set; }
public RecordingStatus Status { get; set; } public RecordingStatus Status { get; set; }
[IgnoreDataMember] [IgnoreDataMember]

View File

@ -78,9 +78,9 @@ namespace MediaBrowser.Controller.Providers
public bool IsDirty { get; private set; } public bool IsDirty { get; private set; }
public void SetDateLastMetadataRefresh(DateTime date) public void SetDateLastMetadataRefresh(DateTime? date)
{ {
if (date != (DateLastMetadataRefresh ?? DateTime.MinValue)) if (date != DateLastMetadataRefresh)
{ {
IsDirty = true; IsDirty = true;
} }
@ -88,9 +88,9 @@ namespace MediaBrowser.Controller.Providers
DateLastMetadataRefresh = date; DateLastMetadataRefresh = date;
} }
public void SetDateLastImagesRefresh(DateTime date) public void SetDateLastImagesRefresh(DateTime? date)
{ {
if (date != (DateLastImagesRefresh ?? DateTime.MinValue)) if (date != DateLastImagesRefresh)
{ {
IsDirty = true; IsDirty = true;
} }

View File

@ -318,7 +318,7 @@ namespace MediaBrowser.Model.Net
{ {
return result; return result;
} }
throw new ArgumentNullException("Unable to determine extension for mimeType: " + mimeType); return null;
} }
} }
} }

View File

@ -147,7 +147,14 @@ namespace MediaBrowser.Providers.Manager
updateType = updateType | result.UpdateType; updateType = updateType | result.UpdateType;
refreshResult.AddStatus(result.Status, result.ErrorMessage); refreshResult.AddStatus(result.Status, result.ErrorMessage);
refreshResult.SetDateLastMetadataRefresh(DateTime.UtcNow); if (result.Failures == 0)
{
refreshResult.SetDateLastMetadataRefresh(DateTime.UtcNow);
}
else
{
refreshResult.SetDateLastMetadataRefresh(null);
}
MergeIdentities(itemOfType, id); MergeIdentities(itemOfType, id);
} }
@ -164,7 +171,14 @@ namespace MediaBrowser.Providers.Manager
updateType = updateType | result.UpdateType; updateType = updateType | result.UpdateType;
refreshResult.AddStatus(result.Status, result.ErrorMessage); refreshResult.AddStatus(result.Status, result.ErrorMessage);
refreshResult.SetDateLastImagesRefresh(DateTime.UtcNow); if (result.Failures == 0)
{
refreshResult.SetDateLastImagesRefresh(DateTime.UtcNow);
}
else
{
refreshResult.SetDateLastImagesRefresh(null);
}
} }
} }
@ -503,7 +517,7 @@ namespace MediaBrowser.Providers.Manager
{ {
return false; return false;
} }
return true; return true;
} }

View File

@ -8,6 +8,7 @@ using MediaBrowser.Model.Devices;
using MediaBrowser.Model.Events; using MediaBrowser.Model.Events;
using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Session; using MediaBrowser.Model.Session;
using MediaBrowser.Model.Users; using MediaBrowser.Model.Users;
@ -151,12 +152,13 @@ namespace MediaBrowser.Server.Implementations.Devices
path = Path.Combine(path, _fileSystem.GetValidFilename(file.Album)); path = Path.Combine(path, _fileSystem.GetValidFilename(file.Album));
} }
Directory.CreateDirectory(path);
path = Path.Combine(path, file.Name); path = Path.Combine(path, file.Name);
path = Path.ChangeExtension(path, MimeTypes.ToExtension(file.MimeType) ?? "jpg");
_libraryMonitor.ReportFileSystemChangeBeginning(path); _libraryMonitor.ReportFileSystemChangeBeginning(path);
Directory.CreateDirectory(Path.GetDirectoryName(path));
try try
{ {
using (var fs = _fileSystem.GetFileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read)) using (var fs = _fileSystem.GetFileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))

View File

@ -369,6 +369,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
} }
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken) public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
{
try
{
return await GetProgramsAsyncInternal(channelId, startDateUtc, endDateUtc, cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{
_logger.ErrorException("Error getting programs", ex);
return GetEpgDataForChannel(channelId).Where(i => i.StartDate <= endDateUtc && i.EndDate >= startDateUtc);
}
}
private async Task<IEnumerable<ProgramInfo>> GetProgramsAsyncInternal(string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
{ {
var channels = await GetChannelsAsync(true, cancellationToken).ConfigureAwait(false); var channels = await GetChannelsAsync(true, cancellationToken).ConfigureAwait(false);
var channel = channels.First(i => string.Equals(i.Id, channelId, StringComparison.OrdinalIgnoreCase)); var channel = channels.First(i => string.Equals(i.Id, channelId, StringComparison.OrdinalIgnoreCase));
@ -377,6 +390,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{ {
var programs = await provider.Item1.GetProgramsAsync(provider.Item2, channel.Number, startDateUtc, endDateUtc, cancellationToken) var programs = await provider.Item1.GetProgramsAsync(provider.Item2, channel.Number, startDateUtc, endDateUtc, cancellationToken)
.ConfigureAwait(false); .ConfigureAwait(false);
var list = programs.ToList(); var list = programs.ToList();
// Replace the value that came from the provider with a normalized value // Replace the value that came from the provider with a normalized value

View File

@ -331,7 +331,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
Container = "ts", Container = "ts",
Id = profile, Id = profile,
SupportsDirectPlay = true, SupportsDirectPlay = true,
SupportsDirectStream = false, SupportsDirectStream = true,
SupportsTranscoding = true SupportsTranscoding = true
}; };

View File

@ -191,6 +191,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
{ {
"type", "type",
"data", "data",
"StartDate",
"EndDate", "EndDate",
"IsOffline", "IsOffline",
"ChannelId", "ChannelId",
@ -516,35 +517,44 @@ namespace MediaBrowser.Server.Implementations.Persistence
if (!reader.IsDBNull(2)) if (!reader.IsDBNull(2))
{ {
item.EndDate = reader.GetDateTime(2).ToUniversalTime(); var hasStartDate = item as IHasStartDate;
if (hasStartDate != null)
{
hasStartDate.StartDate = reader.GetDateTime(2).ToUniversalTime();
}
} }
if (!reader.IsDBNull(3)) if (!reader.IsDBNull(3))
{ {
item.IsOffline = reader.GetBoolean(3); item.EndDate = reader.GetDateTime(3).ToUniversalTime();
} }
if (!reader.IsDBNull(4)) if (!reader.IsDBNull(4))
{ {
item.ChannelId = reader.GetString(4); item.IsOffline = reader.GetBoolean(4);
}
if (!reader.IsDBNull(5))
{
item.ChannelId = reader.GetString(5);
} }
var hasProgramAttributes = item as IHasProgramAttributes; var hasProgramAttributes = item as IHasProgramAttributes;
if (hasProgramAttributes != null) if (hasProgramAttributes != null)
{ {
if (!reader.IsDBNull(5))
{
hasProgramAttributes.IsMovie = reader.GetBoolean(5);
}
if (!reader.IsDBNull(6)) if (!reader.IsDBNull(6))
{ {
hasProgramAttributes.IsSports = reader.GetBoolean(6); hasProgramAttributes.IsMovie = reader.GetBoolean(6);
} }
if (!reader.IsDBNull(7)) if (!reader.IsDBNull(7))
{ {
hasProgramAttributes.IsKids = reader.GetBoolean(7); hasProgramAttributes.IsSports = reader.GetBoolean(7);
}
if (!reader.IsDBNull(8))
{
hasProgramAttributes.IsKids = reader.GetBoolean(8);
} }
} }

View File

@ -90,6 +90,9 @@
<Content Include="dashboard-ui\apiclient\sync\contentuploader.js"> <Content Include="dashboard-ui\apiclient\sync\contentuploader.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\apiclient\fileupload.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\apiclient\sync\mediasync.js"> <Content Include="dashboard-ui\apiclient\sync\mediasync.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -165,6 +168,9 @@
<Content Include="dashboard-ui\cordova\android\logging.js"> <Content Include="dashboard-ui\cordova\android\logging.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\cordova\fileupload.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\cordova\ios\vlcplayer.js"> <Content Include="dashboard-ui\cordova\ios\vlcplayer.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>