Merge pull request #2366 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-12-26 12:48:24 -05:00 committed by GitHub
commit 6a89ec6556
40 changed files with 260 additions and 216 deletions

View File

@ -77,6 +77,11 @@ namespace BDInfo
public BDROM(
string path, IFileSystem fileSystem, ITextEncoding textEncoding)
{
if (string.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException("path");
}
_fileSystem = fileSystem;
//
// Locate BDMV directories.
@ -326,15 +331,28 @@ namespace BDInfo
private FileSystemMetadata GetDirectoryBDMV(
string path)
{
if (string.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException("path");
}
FileSystemMetadata dir = _fileSystem.GetDirectoryInfo(path);
while (dir != null)
{
if (dir.Name == "BDMV")
if (string.Equals(dir.Name, "BDMV", StringComparison.OrdinalIgnoreCase))
{
return dir;
}
dir = _fileSystem.GetDirectoryInfo(Path.GetDirectoryName(dir.FullName));
var parentFolder = Path.GetDirectoryName(dir.FullName);
if (string.IsNullOrEmpty(parentFolder))
{
dir = null;
}
else
{
dir = _fileSystem.GetDirectoryInfo(parentFolder);
}
}
return GetDirectory("BDMV", _fileSystem.GetDirectoryInfo(path), 0);
@ -350,7 +368,7 @@ namespace BDInfo
FileSystemMetadata[] children = _fileSystem.GetDirectories(dir.FullName).ToArray();
foreach (FileSystemMetadata child in children)
{
if (child.Name == name)
if (string.Equals(child.Name, name, StringComparison.OrdinalIgnoreCase))
{
return child;
}

View File

@ -795,6 +795,8 @@ return null;
/// </summary>
public void NotifyPendingRestart()
{
Logger.Info("App needs to be restarted.");
var changed = !HasPendingRestart;
HasPendingRestart = true;

View File

@ -268,7 +268,7 @@ namespace Emby.Dlna.ContentDirectory
}
else
{
_didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, item, null, null, deviceId, filter);
_didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, item, user, null, null, deviceId, filter);
}
provided++;
@ -294,7 +294,7 @@ namespace Emby.Dlna.ContentDirectory
}
else
{
_didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, childItem, item, serverItem.StubType, deviceId, filter);
_didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, childItem, user, item, serverItem.StubType, deviceId, filter);
}
}
}
@ -390,7 +390,7 @@ namespace Emby.Dlna.ContentDirectory
}
else
{
_didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, i, item, serverItem.StubType, deviceId, filter);
_didlBuilder.WriteItemElement(_config.GetDlnaConfiguration(), writer, i, user, item, serverItem.StubType, deviceId, filter);
}
}

View File

@ -61,7 +61,7 @@ namespace Emby.Dlna.Didl
_user = user;
}
public string GetItemDidl(DlnaOptions options, BaseItem item, BaseItem context, string deviceId, Filter filter, StreamInfo streamInfo)
public string GetItemDidl(DlnaOptions options, BaseItem item, User user, BaseItem context, string deviceId, Filter filter, StreamInfo streamInfo)
{
var settings = new XmlWriterSettings
{
@ -86,7 +86,7 @@ namespace Emby.Dlna.Didl
WriteXmlRootAttributes(_profile, writer);
WriteItemElement(options, writer, item, context, null, deviceId, filter, streamInfo);
WriteItemElement(options, writer, item, user, context, null, deviceId, filter, streamInfo);
writer.WriteFullEndElement();
//writer.WriteEndDocument();
@ -111,7 +111,15 @@ namespace Emby.Dlna.Didl
}
}
public void WriteItemElement(DlnaOptions options, XmlWriter writer, BaseItem item, BaseItem context, StubType? contextStubType, string deviceId, Filter filter, StreamInfo streamInfo = null)
public void WriteItemElement(DlnaOptions options,
XmlWriter writer,
BaseItem item,
User user,
BaseItem context,
StubType? contextStubType,
string deviceId,
Filter filter,
StreamInfo streamInfo = null)
{
var clientId = GetClientId(item, null);
@ -135,7 +143,7 @@ namespace Emby.Dlna.Didl
AddGeneralProperties(item, null, context, writer, filter);
//AddBookmarkInfo(item, user, element);
AddSamsungBookmarkInfo(item, user, writer);
// refID?
// storeAttribute(itemNode, object, ClassProperties.REF_ID, false);
@ -555,17 +563,37 @@ namespace Emby.Dlna.Didl
writer.WriteFullEndElement();
}
//private void AddBookmarkInfo(BaseItem item, User user, XmlElement element)
//{
// var userdata = _userDataManager.GetUserData(user.Id, item.GetUserDataKey());
private void AddSamsungBookmarkInfo(BaseItem item, User user, XmlWriter writer)
{
if (!item.SupportsPositionTicksResume || item is Folder)
{
return;
}
// if (userdata.PlaybackPositionTicks > 0)
// {
// var dcmInfo = element.OwnerDocument.CreateElement("sec", "dcmInfo", NS_SEC);
// dcmInfo.InnerText = string.Format("BM={0}", Convert.ToInt32(TimeSpan.FromTicks(userdata.PlaybackPositionTicks).TotalSeconds).ToString(_usCulture));
// element.AppendChild(dcmInfo);
// }
//}
XmlAttribute secAttribute = null;
foreach (var attribute in _profile.XmlRootAttributes)
{
if (string.Equals(attribute.Name, "xmlns:sec", StringComparison.OrdinalIgnoreCase))
{
secAttribute = attribute;
break;
}
}
// Not a samsung device
if (secAttribute == null)
{
return;
}
var userdata = _userDataManager.GetUserData(user.Id, item);
if (userdata.PlaybackPositionTicks > 0)
{
var elementValue = string.Format("BM={0}", Convert.ToInt32(TimeSpan.FromTicks(userdata.PlaybackPositionTicks).TotalSeconds).ToString(_usCulture));
AddValue(writer, "sec", "dcmInfo", elementValue, secAttribute.Value);
}
}
/// <summary>
/// Adds fields used by both items and folders

View File

@ -493,7 +493,7 @@ namespace Emby.Dlna.PlayTo
playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken);
var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _libraryManager, _mediaEncoder)
.GetItemDidl(_config.GetDlnaConfiguration(), item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
.GetItemDidl(_config.GetDlnaConfiguration(), item, user, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
playlistItem.Didl = itemXml;

View File

@ -201,6 +201,21 @@ namespace Emby.Dlna.Profiles
IsRequired = true
}
}
},
new CodecProfile
{
Type = CodecType.VideoAudio,
Conditions = new []
{
// The device does not have any audio switching capabilities
new ProfileCondition
{
Condition = ProfileConditionType.Equals,
Property = ProfileConditionValue.IsSecondaryAudio,
Value = "false"
}
}
}
};

View File

@ -55,27 +55,26 @@ namespace Emby.Dlna.Profiles
{
Container = "ts",
VideoCodec = "h264",
AudioCodec = "aac,ac3,mp3",
AudioCodec = "aac,ac3,mp3,dca,dts",
Type = DlnaProfileType.Video
},
new DirectPlayProfile
{
Container = "mkv",
VideoCodec = "h264",
AudioCodec = "aac,ac3,mp3",
AudioCodec = "aac,ac3,mp3,dca,dts",
Type = DlnaProfileType.Video
},
new DirectPlayProfile
{
Container = "mp4",
VideoCodec = "h264,mpeg4",
AudioCodec = "aac,ac3,mp3",
AudioCodec = "aac,ac3,mp3,dca,dts",
Type = DlnaProfileType.Video
},
new DirectPlayProfile
{
Container = "mp3",
AudioCodec = "mp3",
Type = DlnaProfileType.Audio
},
new DirectPlayProfile

View File

@ -80,6 +80,12 @@
</Conditions>
<ApplyConditions />
</CodecProfile>
<CodecProfile type="VideoAudio">
<Conditions>
<ProfileCondition condition="Equals" property="IsSecondaryAudio" value="false" isRequired="true" />
</Conditions>
<ApplyConditions />
</CodecProfile>
</CodecProfiles>
<ResponseProfiles>
<ResponseProfile container="mkv,ts" type="Video" mimeType="video/mp4">

View File

@ -35,10 +35,10 @@
<IgnoreTranscodeByteRangeRequests>false</IgnoreTranscodeByteRangeRequests>
<XmlRootAttributes />
<DirectPlayProfiles>
<DirectPlayProfile container="ts" audioCodec="aac,ac3,mp3" videoCodec="h264" type="Video" />
<DirectPlayProfile container="mkv" audioCodec="aac,ac3,mp3" videoCodec="h264" type="Video" />
<DirectPlayProfile container="mp4" audioCodec="aac,ac3,mp3" videoCodec="h264,mpeg4" type="Video" />
<DirectPlayProfile container="mp3" audioCodec="mp3" type="Audio" />
<DirectPlayProfile container="ts" audioCodec="aac,ac3,mp3,dca,dts" videoCodec="h264" type="Video" />
<DirectPlayProfile container="mkv" audioCodec="aac,ac3,mp3,dca,dts" videoCodec="h264" type="Video" />
<DirectPlayProfile container="mp4" audioCodec="aac,ac3,mp3,dca,dts" videoCodec="h264,mpeg4" type="Video" />
<DirectPlayProfile container="mp3" type="Audio" />
<DirectPlayProfile container="jpeg" type="Photo" />
</DirectPlayProfiles>
<TranscodingProfiles>

View File

@ -1083,6 +1083,8 @@ namespace Emby.Server.Core
if (requiresRestart)
{
Logger.Info("App needs to be restarted due to configuration change.");
NotifyPendingRestart();
}
}
@ -1204,7 +1206,8 @@ namespace Emby.Server.Core
var exclude = new[]
{
"mbplus.dll",
"mbintros.dll"
"mbintros.dll",
"embytv.dll"
};
return !exclude.Contains(filename ?? string.Empty, StringComparer.OrdinalIgnoreCase);

View File

@ -79,21 +79,6 @@ namespace Emby.Server.Implementations.Channels
_channels = channels.ToArray();
}
public string ChannelDownloadPath
{
get
{
var options = _config.GetChannelsConfiguration();
if (!string.IsNullOrWhiteSpace(options.DownloadPath))
{
return options.DownloadPath;
}
return Path.Combine(_config.ApplicationPaths.ProgramDataPath, "channels");
}
}
private IEnumerable<IChannel> GetAllChannels()
{
return _channels
@ -288,7 +273,7 @@ namespace Emby.Server.Implementations.Channels
_jsonSerializer.SerializeToFile(mediaSources, path);
}
public async Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken)
public async Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken)
{
IEnumerable<ChannelMediaInfo> results = new List<ChannelMediaInfo>();
var video = item as Video;
@ -302,17 +287,9 @@ namespace Emby.Server.Implementations.Channels
results = audio.ChannelMediaSources ?? GetSavedMediaSources(audio);
}
var sources = SortMediaInfoResults(results)
return SortMediaInfoResults(results)
.Select(i => GetMediaSource(item, i))
.ToList();
if (includeCachedVersions)
{
var cachedVersions = GetCachedChannelItemMediaSources(item);
sources.InsertRange(0, cachedVersions);
}
return sources;
}
public async Task<IEnumerable<MediaSourceInfo>> GetDynamicMediaSources(BaseItem item, CancellationToken cancellationToken)
@ -334,14 +311,9 @@ namespace Emby.Server.Implementations.Channels
results = new List<ChannelMediaInfo>();
}
var list = SortMediaInfoResults(results)
return SortMediaInfoResults(results)
.Select(i => GetMediaSource(item, i))
.ToList();
var cachedVersions = GetCachedChannelItemMediaSources(item);
list.InsertRange(0, cachedVersions);
return list;
}
private readonly ConcurrentDictionary<string, Tuple<DateTime, List<ChannelMediaInfo>>> _channelItemMediaInfo =
@ -369,55 +341,6 @@ namespace Emby.Server.Implementations.Channels
return list;
}
private IEnumerable<MediaSourceInfo> GetCachedChannelItemMediaSources(BaseItem item)
{
var filenamePrefix = item.Id.ToString("N");
var parentPath = Path.Combine(ChannelDownloadPath, item.ChannelId);
try
{
var files = _fileSystem.GetFiles(parentPath);
if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
{
files = files.Where(i => _libraryManager.IsVideoFile(i.FullName));
}
else
{
files = files.Where(i => _libraryManager.IsAudioFile(i.FullName));
}
var file = files
.FirstOrDefault(i => i.Name.StartsWith(filenamePrefix, StringComparison.OrdinalIgnoreCase));
if (file != null)
{
var cachedItem = _libraryManager.ResolvePath(file);
if (cachedItem != null)
{
var hasMediaSources = _libraryManager.GetItemById(cachedItem.Id) as IHasMediaSources;
if (hasMediaSources != null)
{
var source = hasMediaSources.GetMediaSources(true).FirstOrDefault();
if (source != null)
{
return new[] { source };
}
}
}
}
}
catch (IOException)
{
}
return new List<MediaSourceInfo>();
}
private MediaSourceInfo GetMediaSource(BaseItem item, ChannelMediaInfo info)
{
var source = info.ToMediaSource();

View File

@ -346,6 +346,18 @@ namespace Emby.Server.Implementations.Data
}
}
public static void TryBind(this IStatement statement, string name, double? value)
{
if (value.HasValue)
{
TryBind(statement, name, value.Value);
}
else
{
TryBindNull(statement, name);
}
}
public static void TryBind(this IStatement statement, string name, int? value)
{
if (value.HasValue)

View File

@ -5267,11 +5267,19 @@ namespace Emby.Server.Implementations.Data
{
foreach (var pair in values)
{
var itemValue = pair.Item2;
// Don't save if invalid
if (string.IsNullOrWhiteSpace(itemValue))
{
continue;
}
statement.Reset();
statement.TryBind("@ItemId", itemId.ToGuidParamValue());
statement.TryBind("@Type", pair.Item1);
statement.TryBind("@Value", pair.Item2);
statement.TryBind("@Value", itemValue);
if (pair.Item2 == null)
{

View File

@ -312,8 +312,8 @@
<HintPath>..\packages\Emby.XmlTv.1.0.3\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MediaBrowser.Naming, Version=1.0.6178.4191, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Naming.1.0.3\lib\portable-net45+win8\MediaBrowser.Naming.dll</HintPath>
<Reference Include="MediaBrowser.Naming, Version=1.0.6201.24431, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Naming.1.0.4\lib\portable-net45+win8\MediaBrowser.Naming.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SQLitePCL.pretty, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">

View File

@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.EntryPoints
if (_appHost.HasPendingRestart)
{
_timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10));
_timer = _timerFactory.Create(TimerCallback, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15));
}
}
@ -65,6 +65,8 @@ namespace Emby.Server.Implementations.EntryPoints
{
DisposeTimer();
_logger.Info("Automatically restarting the system because it is idle and a restart is required.");
try
{
_appHost.Restart();

View File

@ -228,11 +228,14 @@ namespace Emby.Server.Implementations.HttpServer
}
}
private void ErrorHandler(Exception ex, IRequest httpReq)
private void ErrorHandler(Exception ex, IRequest httpReq, bool logException = true)
{
try
{
_logger.ErrorException("Error processing request", ex);
if (logException)
{
_logger.ErrorException("Error processing request", ex);
}
var httpRes = httpReq.Response;
@ -529,6 +532,10 @@ namespace Emby.Server.Implementations.HttpServer
ErrorHandler(new FileNotFoundException(), httpReq);
}
}
catch (OperationCanceledException ex)
{
ErrorHandler(ex, httpReq, false);
}
catch (Exception ex)
{
ErrorHandler(ex, httpReq);

View File

@ -12,7 +12,7 @@ namespace Emby.Server.Implementations.HttpServer
/// Gets or sets the error handler.
/// </summary>
/// <value>The error handler.</value>
Action<Exception, IRequest> ErrorHandler { get; set; }
Action<Exception, IRequest, bool> ErrorHandler { get; set; }
/// <summary>
/// Gets or sets the request handler.

View File

@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
_httpRequestFactory = httpRequestFactory;
}
public Action<Exception, IRequest> ErrorHandler { get; set; }
public Action<Exception, IRequest, bool> ErrorHandler { get; set; }
public Func<IHttpRequest, Uri, Task> RequestHandler { get; set; }
public Action<WebSocketConnectingEventArgs> WebSocketConnecting { get; set; }
@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
_logger.ErrorException("Error processing request", ex);
httpReq = httpReq ?? GetRequest(context);
ErrorHandler(ex, httpReq);
ErrorHandler(ex, httpReq, true);
return Task.FromResult(true);
}

View File

@ -3084,7 +3084,11 @@ namespace Emby.Server.Implementations.Library
foreach (var contentType in ConfigurationManager.Configuration.ContentTypes)
{
if (string.Equals(path, contentType.Name, StringComparison.OrdinalIgnoreCase)
if (string.IsNullOrWhiteSpace(contentType.Name))
{
removeList.Add(contentType);
}
else if (string.Equals(path, contentType.Name, StringComparison.OrdinalIgnoreCase)
|| _fileSystem.ContainsSubPath(path, contentType.Name))
{
removeList.Add(contentType);

View File

@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
new TaskTriggerInfo
{
Type = TaskTriggerInfo.TriggerDaily,
TimeOfDayTicks = TimeSpan.FromHours(1).Ticks,
TimeOfDayTicks = TimeSpan.FromHours(2).Ticks,
MaxRuntimeMs = Convert.ToInt32(TimeSpan.FromHours(4).TotalMilliseconds)
}
};

View File

@ -68,7 +68,7 @@ namespace Emby.Server.Implementations.Sync
},
new ProfileCondition
{
Condition = ProfileConditionType.EqualsAny,
Condition = ProfileConditionType.Equals,
Property = ProfileConditionValue.NumVideoStreams,
Value = "1",
IsRequired = false
@ -230,20 +230,6 @@ namespace Emby.Server.Implementations.Sync
Codec = "aac,mp3",
Conditions = new[]
{
new ProfileCondition
{
Condition = ProfileConditionType.LessThanEqual,
Property = ProfileConditionValue.AudioChannels,
Value = "2",
IsRequired = true
},
new ProfileCondition
{
Condition = ProfileConditionType.LessThanEqual,
Property = ProfileConditionValue.AudioBitrate,
Value = "320000",
IsRequired = true
},
new ProfileCondition
{
Condition = ProfileConditionType.Equals,

View File

@ -221,48 +221,77 @@ namespace Emby.Server.Implementations.Sync
using (var connection = CreateConnection())
{
string commandText;
var paramList = new List<object>();
if (insert)
{
commandText = "insert into SyncJobs (Id, TargetId, Name, Profile, Quality, Bitrate, Status, Progress, UserId, ItemIds, Category, ParentId, UnwatchedOnly, ItemLimit, SyncNewContent, DateCreated, DateLastModified, ItemCount) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
commandText = "insert into SyncJobs (Id, TargetId, Name, Profile, Quality, Bitrate, Status, Progress, UserId, ItemIds, Category, ParentId, UnwatchedOnly, ItemLimit, SyncNewContent, DateCreated, DateLastModified, ItemCount) values (@Id, @TargetId, @Name, @Profile, @Quality, @Bitrate, @Status, @Progress, @UserId, @ItemIds, @Category, @ParentId, @UnwatchedOnly, @ItemLimit, @SyncNewContent, @DateCreated, @DateLastModified, @ItemCount)";
}
else
{
commandText = "update SyncJobs set TargetId=?,Name=?,Profile=?,Quality=?,Bitrate=?,Status=?,Progress=?,UserId=?,ItemIds=?,Category=?,ParentId=?,UnwatchedOnly=?,ItemLimit=?,SyncNewContent=?,DateCreated=?,DateLastModified=?,ItemCount=? where Id=?";
}
paramList.Add(job.TargetId);
paramList.Add(job.Name);
paramList.Add(job.Profile);
paramList.Add(job.Quality);
paramList.Add(job.Bitrate);
paramList.Add(job.Status.ToString());
paramList.Add(job.Progress);
paramList.Add(job.UserId);
paramList.Add(string.Join(",", job.RequestedItemIds.ToArray()));
paramList.Add(job.Category);
paramList.Add(job.ParentId);
paramList.Add(job.UnwatchedOnly);
paramList.Add(job.ItemLimit);
paramList.Add(job.SyncNewContent);
paramList.Add(job.DateCreated.ToDateTimeParamValue());
paramList.Add(job.DateLastModified.ToDateTimeParamValue());
paramList.Add(job.ItemCount);
if (insert)
{
paramList.Insert(0, job.Id.ToGuidParamValue());
}
else
{
paramList.Add(job.Id.ToGuidParamValue());
commandText = "update SyncJobs set TargetId=@TargetId,Name=@Name,Profile=@Profile,Quality=@Quality,Bitrate=@Bitrate,Status=@Status,Progress=@Progress,UserId=@UserId,ItemIds=@ItemIds,Category=@Category,ParentId=@ParentId,UnwatchedOnly=@UnwatchedOnly,ItemLimit=@ItemLimit,SyncNewContent=@SyncNewContent,DateCreated=@DateCreated,DateLastModified=@DateLastModified,ItemCount=@ItemCount where Id=@Id";
}
connection.RunInTransaction(conn =>
{
conn.Execute(commandText, paramList.ToArray());
using (var statement = PrepareStatementSafe(connection, commandText))
{
statement.TryBind("@TargetId", job.TargetId);
statement.TryBind("@Name", job.Name);
statement.TryBind("@Profile", job.Profile);
statement.TryBind("@Quality", job.Quality);
statement.TryBind("@Bitrate", job.Bitrate);
statement.TryBind("@Status", job.Status.ToString());
statement.TryBind("@Progress", job.Progress);
statement.TryBind("@UserId", job.UserId);
if (job.RequestedItemIds.Count > 0)
{
statement.TryBind("@ItemIds", string.Join(",", job.RequestedItemIds.ToArray()));
}
else
{
statement.TryBindNull("@ItemIds");
}
if (job.Category.HasValue)
{
statement.TryBind("@Category", job.Category.Value.ToString());
}
else
{
statement.TryBindNull("@Category");
}
if (!string.IsNullOrWhiteSpace(job.ParentId))
{
statement.TryBind("@ParentId", job.ParentId);
}
else
{
statement.TryBindNull("@ParentId");
}
statement.TryBind("@UnwatchedOnly", job.UnwatchedOnly);
if (job.ItemLimit.HasValue)
{
statement.TryBind("@ItemLimit", job.ItemLimit);
}
else
{
statement.TryBindNull("@ItemLimit");
}
statement.TryBind("@SyncNewContent", job.SyncNewContent);
statement.TryBind("@DateCreated", job.DateCreated.ToDateTimeParamValue());
statement.TryBind("@DateLastModified", job.DateLastModified.ToDateTimeParamValue());
statement.TryBind("@ItemCount", job.ItemCount);
statement.TryBind("@Id", job.Id.ToGuidParamValue());
statement.MoveNext();
}
}, TransactionMode);
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Emby.XmlTv" version="1.0.3" targetFramework="portable45-net45+win8" />
<package id="MediaBrowser.Naming" version="1.0.3" targetFramework="portable45-net45+win8" />
<package id="MediaBrowser.Naming" version="1.0.4" targetFramework="portable45-net45+win8" />
<package id="SQLitePCL.pretty" version="1.1.0" targetFramework="portable45-net45+win8" />
<package id="SQLitePCLRaw.core" version="1.1.1" targetFramework="portable45-net45+win8" />
<package id="UniversalDetector" version="1.0.1" targetFramework="portable45-net45+win8" />

View File

@ -99,6 +99,7 @@ namespace MediaBrowser.Api
var path = item.ContainingFolderPath;
var types = _config.Configuration.ContentTypes
.Where(i => !string.IsNullOrWhiteSpace(i.Name))
.Where(i => !string.Equals(i.Name, path, StringComparison.OrdinalIgnoreCase))
.ToList();

View File

@ -1467,7 +1467,7 @@ namespace MediaBrowser.Api.Playback
}
// h264
return string.Format(" -b:v {0} -maxrate {0} -bufsize {1}",
return string.Format(" -maxrate {0} -bufsize {1}",
bitrate.Value.ToString(UsCulture),
(bitrate.Value * 2).ToString(UsCulture));
}

View File

@ -15,15 +15,8 @@ namespace MediaBrowser.Controller.Channels
/// Adds the parts.
/// </summary>
/// <param name="channels">The channels.</param>
/// <param name="factories">The factories.</param>
void AddParts(IEnumerable<IChannel> channels);
/// <summary>
/// Gets the channel download path.
/// </summary>
/// <value>The channel download path.</value>
string ChannelDownloadPath { get; }
/// <summary>
/// Gets the channel features.
/// </summary>
@ -115,10 +108,9 @@ namespace MediaBrowser.Controller.Channels
/// Gets the channel item media sources.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="includeCachedVersions">if set to <c>true</c> [include cached versions].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IEnumerable{MediaSourceInfo}}.</returns>
Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken);
Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken);
/// <summary>
/// Gets the channel folder.

View File

@ -206,7 +206,7 @@ namespace MediaBrowser.Controller.Entities.Audio
{
if (SourceType == SourceType.Channel)
{
var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
var sources = ChannelManager.GetStaticMediaSources(this, CancellationToken.None)
.Result.ToList();
if (sources.Count > 0)

View File

@ -549,7 +549,7 @@ namespace MediaBrowser.Controller.Entities
{
if (SourceType == SourceType.Channel)
{
var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
var sources = ChannelManager.GetStaticMediaSources(this, CancellationToken.None)
.Result.ToList();
if (sources.Count > 0)

View File

@ -30,6 +30,11 @@ namespace MediaBrowser.MediaEncoding.BdInfo
/// <returns>BlurayDiscInfo.</returns>
public BlurayDiscInfo GetDiscInfo(string path)
{
if (string.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException("path");
}
var bdrom = new BDROM(path, _fileSystem, _textEncoding);
bdrom.Scan();

View File

@ -816,7 +816,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
}
// h264
return string.Format(" -b:v {0} -maxrate {0} -bufsize {1}",
return string.Format(" -maxrate {0} -bufsize {1}",
bitrate.Value.ToString(UsCulture),
(bitrate.Value * 2).ToString(UsCulture));
}

View File

@ -287,6 +287,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
return;
}
_logger.Info("Attempting to update encoder path to {0}. pathType: {1}", path ?? string.Empty, pathType ?? string.Empty);
Tuple<string, string> newPaths;
if (string.Equals(pathType, "system", StringComparison.OrdinalIgnoreCase))

View File

@ -462,11 +462,9 @@ namespace MediaBrowser.Model.Configuration
Type = ImageType.Art
},
// Don't download this by default
// Generally not used
new ImageOption
{
Limit = 0,
Limit = 1,
Type = ImageType.Logo
}
},
@ -556,7 +554,7 @@ namespace MediaBrowser.Model.Configuration
Type = ImageType.Thumb
}
},
DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
DisabledMetadataFetchers = new []{ "TheMovieDb" }
},
new MetadataOptions(0, 1280)
@ -577,8 +575,8 @@ namespace MediaBrowser.Model.Configuration
Type = ImageType.Primary
}
},
DisabledMetadataFetchers = new []{ "The Open Movie Database" },
DisabledImageFetchers = new []{ "TheMovieDb" }
DisabledMetadataFetchers = new []{ "The Open Movie Database", "TheMovieDb" },
DisabledImageFetchers = new []{ "The Open Movie Database", "TheMovieDb" }
}
};
}

View File

@ -124,6 +124,7 @@ namespace MediaBrowser.Model.Dlna
switch (condition.Condition)
{
case ProfileConditionType.Equals:
case ProfileConditionType.EqualsAny:
return currentValue.Value.Equals(expected);
case ProfileConditionType.GreaterThanEqual:
return currentValue.Value >= expected;
@ -132,7 +133,7 @@ namespace MediaBrowser.Model.Dlna
case ProfileConditionType.NotEquals:
return !currentValue.Value.Equals(expected);
default:
throw new InvalidOperationException("Unexpected ProfileConditionType");
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
@ -160,7 +161,7 @@ namespace MediaBrowser.Model.Dlna
case ProfileConditionType.NotEquals:
return !StringHelper.EqualsIgnoreCase(currentValue, expected);
default:
throw new InvalidOperationException("Unexpected ProfileConditionType");
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
@ -182,7 +183,7 @@ namespace MediaBrowser.Model.Dlna
case ProfileConditionType.NotEquals:
return currentValue.Value != expected;
default:
throw new InvalidOperationException("Unexpected ProfileConditionType");
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
@ -211,7 +212,7 @@ namespace MediaBrowser.Model.Dlna
case ProfileConditionType.NotEquals:
return !currentValue.Value.Equals(expected);
default:
throw new InvalidOperationException("Unexpected ProfileConditionType");
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
@ -240,7 +241,7 @@ namespace MediaBrowser.Model.Dlna
case ProfileConditionType.NotEquals:
return !currentValue.Value.Equals(expected);
default:
throw new InvalidOperationException("Unexpected ProfileConditionType");
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
@ -264,7 +265,7 @@ namespace MediaBrowser.Model.Dlna
case ProfileConditionType.NotEquals:
return timestamp != expected;
default:
throw new InvalidOperationException("Unexpected ProfileConditionType");
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
}

View File

@ -410,8 +410,6 @@ namespace MediaBrowser.Model.Dlna
audioStreamIndex = audioStream.Index;
}
var allMediaStreams = item.MediaStreams;
MediaStream videoStream = item.VideoStream;
// TODO: This doesn't accout for situation of device being able to handle media bitrate, but wifi connection not fast enough
@ -427,7 +425,7 @@ namespace MediaBrowser.Model.Dlna
if (isEligibleForDirectPlay || isEligibleForDirectStream)
{
// See if it can be direct played
PlayMethod? directPlay = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectPlay, isEligibleForDirectStream, allMediaStreams);
PlayMethod? directPlay = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectPlay, isEligibleForDirectStream);
if (directPlay != null)
{
@ -656,8 +654,7 @@ namespace MediaBrowser.Model.Dlna
MediaStream videoStream,
MediaStream audioStream,
bool isEligibleForDirectPlay,
bool isEligibleForDirectStream,
List<MediaStream> allMediaStreams)
bool isEligibleForDirectStream)
{
DeviceProfile profile = options.Profile;

View File

@ -328,6 +328,11 @@ namespace MediaBrowser.Providers.MediaInfo
/// <returns>VideoStream.</returns>
private BlurayDiscInfo GetBDInfo(string path)
{
if (string.IsNullOrWhiteSpace(path))
{
throw new ArgumentNullException("path");
}
try
{
return _blurayExaminer.GetDiscInfo(path);

View File

@ -46,7 +46,7 @@ namespace MediaBrowser.Providers.Omdb
T item = itemResult.Item;
var result = await GetRootObject(imdbId, cancellationToken);
var result = await GetRootObject(imdbId, cancellationToken).ConfigureAwait(false);
// Only take the name and rating if the user's language is set to english, since Omdb has no localization
if (string.Equals(language, "en", StringComparison.OrdinalIgnoreCase))
@ -221,7 +221,7 @@ namespace MediaBrowser.Providers.Omdb
internal async Task<RootObject> GetRootObject(string imdbId, CancellationToken cancellationToken)
{
var path = await EnsureItemInfo(imdbId, cancellationToken);
var path = await EnsureItemInfo(imdbId, cancellationToken).ConfigureAwait(false);
string resultString;
@ -240,7 +240,7 @@ namespace MediaBrowser.Providers.Omdb
internal async Task<SeasonRootObject> GetSeasonRootObject(string imdbId, int seasonId, CancellationToken cancellationToken)
{
var path = await EnsureSeasonInfo(imdbId, seasonId, cancellationToken);
var path = await EnsureSeasonInfo(imdbId, seasonId, cancellationToken).ConfigureAwait(false);
string resultString;

View File

@ -87,6 +87,12 @@ namespace MediaBrowser.Providers.TV
var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
// Doesn't have required provider id's
if (string.IsNullOrWhiteSpace(seriesDataPath))
{
return;
}
var episodeFiles = _fileSystem.GetFilePaths(seriesDataPath)
.Where(i => string.Equals(Path.GetExtension(i), ".xml", StringComparison.OrdinalIgnoreCase))
.Select(Path.GetFileNameWithoutExtension)

View File

@ -55,11 +55,15 @@ namespace MediaBrowser.Providers.TV
return result;
}
if (OmdbProvider.IsValidSeries(info.SeriesProviderIds) && info.IndexNumber.HasValue && info.ParentIndexNumber.HasValue)
string seriesImdbId;
if (info.SeriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesImdbId) && !string.IsNullOrEmpty(seriesImdbId))
{
var seriesImdbId = info.GetProviderId(MetadataProviders.Imdb);
result.HasMetadata = await new OmdbProvider(_jsonSerializer, _httpClient, _fileSystem, _configurationManager).FetchEpisodeData(result, info.IndexNumber.Value, info.ParentIndexNumber.Value, seriesImdbId, info.MetadataLanguage, info.MetadataCountryCode, cancellationToken).ConfigureAwait(false);
if (info.IndexNumber.HasValue &&
info.ParentIndexNumber.HasValue)
{
result.HasMetadata = await new OmdbProvider(_jsonSerializer, _httpClient, _fileSystem, _configurationManager)
.FetchEpisodeData(result, info.IndexNumber.Value, info.ParentIndexNumber.Value, seriesImdbId, info.MetadataLanguage, info.MetadataCountryCode, cancellationToken).ConfigureAwait(false);
}
}
return result;

View File

@ -112,7 +112,7 @@ namespace MediaBrowser.ServerApplication
// save it
IPersistFile file = (IPersistFile)link;
file.Save(targetPath, false);
file.Save(targetPath, true);
}
else
{

View File

@ -162,9 +162,6 @@
<Content Include="dashboard-ui\components\remotecontrolautoplay.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\syncjoblist\syncjoblist.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\tvproviders\xmltv.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -507,9 +504,6 @@
<Content Include="dashboard-ui\scripts\streamingsettings.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\syncjob.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\appservices.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -534,9 +528,6 @@
<Content Include="dashboard-ui\streamingsettings.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\syncjob.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\appservices.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>