Merge pull request #2303 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-11-22 15:08:36 -05:00 committed by GitHub
commit 7edcda0216
37 changed files with 237 additions and 176 deletions

View File

@ -289,7 +289,9 @@ namespace Emby.Dlna
var allFiles = _fileSystem.GetFiles(path) var allFiles = _fileSystem.GetFiles(path)
.ToList(); .ToList();
var xmlFies = allFiles var xmlFies = type == DeviceProfileType.System ?
new List<FileSystemMetadata>() :
allFiles
.Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase)) .Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
.ToList(); .ToList();
@ -332,7 +334,7 @@ namespace Emby.Dlna
if (string.Equals(Path.GetExtension(path), ".xml", StringComparison.OrdinalIgnoreCase)) if (string.Equals(Path.GetExtension(path), ".xml", StringComparison.OrdinalIgnoreCase))
{ {
var tempProfile = (Emby.Dlna.ProfileSerialization.DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(Emby.Dlna.ProfileSerialization.DeviceProfile), path); var tempProfile = (ProfileSerialization.DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(Emby.Dlna.ProfileSerialization.DeviceProfile), path);
var json = _jsonSerializer.SerializeToString(tempProfile); var json = _jsonSerializer.SerializeToString(tempProfile);
profile = (DeviceProfile)_jsonSerializer.DeserializeFromString<DeviceProfile>(json); profile = (DeviceProfile)_jsonSerializer.DeserializeFromString<DeviceProfile>(json);

View File

@ -30,8 +30,8 @@ namespace Emby.Dlna.Profiles
MaxIconWidth = 48; MaxIconWidth = 48;
MaxIconHeight = 48; MaxIconHeight = 48;
MaxStreamingBitrate = 20000000; MaxStreamingBitrate = 24000000;
MaxStaticBitrate = 20000000; MaxStaticBitrate = 24000000;
MusicStreamingTranscodingBitrate = 192000; MusicStreamingTranscodingBitrate = 192000;
EnableAlbumArtInDidl = false; EnableAlbumArtInDidl = false;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"Name":"Dish Hopper-Joey","Identification":{"Manufacturer":"Echostar Technologies LLC","ManufacturerUrl":"http://www.echostar.com","Headers":[{"Name":"User-Agent","Value":"XiP","Match":"Substring"}]},"Manufacturer":"Emby","ManufacturerUrl":"http://emby.media/","ModelName":"Emby Server","ModelDescription":"Emby","ModelNumber":"Emby","ModelUrl":"http://emby.media/","EnableAlbumArtInDidl":false,"EnableSingleAlbumArtLimit":false,"EnableSingleSubtitleLimit":false,"SupportedMediaTypes":"Audio,Photo,Video","AlbumArtPn":"JPEG_SM","MaxAlbumArtWidth":480,"MaxAlbumArtHeight":480,"MaxIconWidth":48,"MaxIconHeight":48,"MaxStreamingBitrate":20000000,"MaxStaticBitrate":20000000,"MusicStreamingTranscodingBitrate":192000,"XDlnaDoc":"DMS-1.50","ProtocolInfo":"http-get:*:video/mp2t:*,http-get:*:video/MP1S:*,http-get:*:video/mpeg2:*,http-get:*:video/mp4:*,http-get:*:video/x-matroska:*,http-get:*:audio/mpeg:*,http-get:*:audio/mpeg3:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/mp4a-latm:*,http-get:*:image/jpeg:*","TimelineOffsetSeconds":0,"RequiresPlainVideoItems":false,"RequiresPlainFolders":false,"EnableMSMediaReceiverRegistrar":false,"IgnoreTranscodeByteRangeRequests":false,"XmlRootAttributes":[],"DirectPlayProfiles":[{"Container":"mp4,mkv,mpeg,ts","AudioCodec":"mp3,ac3,aac,he-aac,pcm","VideoCodec":"h264,mpeg2video","Type":"Video"},{"Container":"mp3","AudioCodec":"mp3","Type":"Audio"},{"Container":"alac","AudioCodec":"alac","Type":"Audio"},{"Container":"flac","AudioCodec":"flac","Type":"Audio"},{"Container":"jpeg","Type":"Photo"}],"TranscodingProfiles":[{"Container":"mp3","Type":"Audio","AudioCodec":"mp3","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","EnableSubtitlesInManifest":false,"EnableSplittingOnNonKeyFrames":false},{"Container":"mp4","Type":"Video","VideoCodec":"h264","AudioCodec":"aac","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","EnableSubtitlesInManifest":false,"EnableSplittingOnNonKeyFrames":false},{"Container":"jpeg","Type":"Photo","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","EnableSubtitlesInManifest":false,"EnableSplittingOnNonKeyFrames":false}],"ContainerProfiles":[],"CodecProfiles":[{"Type":"Video","Conditions":[{"Condition":"LessThanEqual","Property":"Width","Value":"1920","IsRequired":true},{"Condition":"LessThanEqual","Property":"Height","Value":"1080","IsRequired":true},{"Condition":"LessThanEqual","Property":"VideoFramerate","Value":"30","IsRequired":true},{"Condition":"LessThanEqual","Property":"VideoBitrate","Value":"20000000","IsRequired":true},{"Condition":"LessThanEqual","Property":"VideoLevel","Value":"41","IsRequired":true}],"ApplyConditions":[],"Codec":"h264"},{"Type":"Video","Conditions":[{"Condition":"LessThanEqual","Property":"Width","Value":"1920","IsRequired":true},{"Condition":"LessThanEqual","Property":"Height","Value":"1080","IsRequired":true},{"Condition":"LessThanEqual","Property":"VideoFramerate","Value":"30","IsRequired":true},{"Condition":"LessThanEqual","Property":"VideoBitrate","Value":"20000000","IsRequired":true}],"ApplyConditions":[]},{"Type":"VideoAudio","Conditions":[{"Condition":"LessThanEqual","Property":"AudioChannels","Value":"6","IsRequired":true}],"ApplyConditions":[],"Codec":"ac3,he-aac"},{"Type":"VideoAudio","Conditions":[{"Condition":"LessThanEqual","Property":"AudioChannels","Value":"2","IsRequired":true}],"ApplyConditions":[],"Codec":"aac"}],"ResponseProfiles":[{"Container":"mkv,ts","Type":"Video","MimeType":"video/mp4","Conditions":[]}],"SubtitleProfiles":[{"Format":"srt","Method":"Embed"}]} {"Name":"Dish Hopper-Joey","Identification":{"Manufacturer":"Echostar Technologies LLC","ManufacturerUrl":"http://www.echostar.com","Headers":[{"Name":"User-Agent","Value":"XiP","Match":"Substring"}]},"Manufacturer":"Emby","ManufacturerUrl":"http://emby.media/","ModelName":"Emby Server","ModelDescription":"Emby","ModelNumber":"Emby","ModelUrl":"http://emby.media/","EnableAlbumArtInDidl":false,"EnableSingleAlbumArtLimit":false,"EnableSingleSubtitleLimit":false,"SupportedMediaTypes":"Audio,Photo,Video","AlbumArtPn":"JPEG_SM","MaxAlbumArtWidth":480,"MaxAlbumArtHeight":480,"MaxIconWidth":48,"MaxIconHeight":48,"MaxStreamingBitrate":24000000,"MaxStaticBitrate":24000000,"MusicStreamingTranscodingBitrate":192000,"XDlnaDoc":"DMS-1.50","ProtocolInfo":"http-get:*:video/mp2t:*,http-get:*:video/MP1S:*,http-get:*:video/mpeg2:*,http-get:*:video/mp4:*,http-get:*:video/x-matroska:*,http-get:*:audio/mpeg:*,http-get:*:audio/mpeg3:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/mp4a-latm:*,http-get:*:image/jpeg:*","TimelineOffsetSeconds":0,"RequiresPlainVideoItems":false,"RequiresPlainFolders":false,"EnableMSMediaReceiverRegistrar":false,"IgnoreTranscodeByteRangeRequests":false,"XmlRootAttributes":[],"DirectPlayProfiles":[{"Container":"mp4,mkv,mpeg,ts","AudioCodec":"mp3,ac3,aac,he-aac,pcm","VideoCodec":"h264,mpeg2video","Type":"Video"},{"Container":"mp3","AudioCodec":"mp3","Type":"Audio"},{"Container":"alac","AudioCodec":"alac","Type":"Audio"},{"Container":"flac","AudioCodec":"flac","Type":"Audio"},{"Container":"jpeg","Type":"Photo"}],"TranscodingProfiles":[{"Container":"mp3","Type":"Audio","AudioCodec":"mp3","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","EnableSubtitlesInManifest":false,"EnableSplittingOnNonKeyFrames":false},{"Container":"mp4","Type":"Video","VideoCodec":"h264","AudioCodec":"aac","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","EnableSubtitlesInManifest":false,"EnableSplittingOnNonKeyFrames":false},{"Container":"jpeg","Type":"Photo","EstimateContentLength":false,"EnableMpegtsM2TsMode":false,"TranscodeSeekInfo":"Auto","CopyTimestamps":false,"Context":"Streaming","EnableSubtitlesInManifest":false,"EnableSplittingOnNonKeyFrames":false}],"ContainerProfiles":[],"CodecProfiles":[{"Type":"Video","Conditions":[{"Condition":"LessThanEqual","Property":"Width","Value":"1920","IsRequired":true},{"Condition":"LessThanEqual","Property":"Height","Value":"1080","IsRequired":true},{"Condition":"LessThanEqual","Property":"VideoFramerate","Value":"30","IsRequired":true},{"Condition":"LessThanEqual","Property":"VideoBitrate","Value":"20000000","IsRequired":true},{"Condition":"LessThanEqual","Property":"VideoLevel","Value":"41","IsRequired":true}],"ApplyConditions":[],"Codec":"h264"},{"Type":"Video","Conditions":[{"Condition":"LessThanEqual","Property":"Width","Value":"1920","IsRequired":true},{"Condition":"LessThanEqual","Property":"Height","Value":"1080","IsRequired":true},{"Condition":"LessThanEqual","Property":"VideoFramerate","Value":"30","IsRequired":true},{"Condition":"LessThanEqual","Property":"VideoBitrate","Value":"20000000","IsRequired":true}],"ApplyConditions":[]},{"Type":"VideoAudio","Conditions":[{"Condition":"LessThanEqual","Property":"AudioChannels","Value":"6","IsRequired":true}],"ApplyConditions":[],"Codec":"ac3,he-aac"},{"Type":"VideoAudio","Conditions":[{"Condition":"LessThanEqual","Property":"AudioChannels","Value":"2","IsRequired":true}],"ApplyConditions":[],"Codec":"aac"}],"ResponseProfiles":[{"Container":"mkv,ts","Type":"Video","MimeType":"video/mp4","Conditions":[]}],"SubtitleProfiles":[{"Format":"srt","Method":"Embed"}]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -38,8 +38,6 @@ namespace Emby.Server.Implementations.Data
/// </summary> /// </summary>
public class SqliteItemRepository : BaseSqliteRepository, IItemRepository public class SqliteItemRepository : BaseSqliteRepository, IItemRepository
{ {
private SQLiteDatabaseConnection _connection;
private readonly TypeMapper _typeMapper; private readonly TypeMapper _typeMapper;
/// <summary> /// <summary>
@ -121,25 +119,37 @@ namespace Emby.Server.Implementations.Data
} }
} }
private SQLiteDatabaseConnection _backgroundConnection;
protected override void CloseConnection()
{
base.CloseConnection();
if (_backgroundConnection != null)
{
_backgroundConnection.Dispose();
_backgroundConnection = null;
}
}
/// <summary> /// <summary>
/// Opens the connection to the database /// Opens the connection to the database
/// </summary> /// </summary>
/// <returns>Task.</returns> /// <returns>Task.</returns>
public async Task Initialize(SqliteUserDataRepository userDataRepo) public async Task Initialize(SqliteUserDataRepository userDataRepo)
{ {
_connection = CreateConnection(false); using (var connection = CreateConnection())
_connection.ExecuteAll(string.Join(";", new[]
{ {
connection.ExecuteAll(string.Join(";", new[]
{
"PRAGMA page_size=4096", "PRAGMA page_size=4096",
"PRAGMA default_temp_store=memory", "PRAGMA default_temp_store=memory",
"PRAGMA temp_store=memory" "PRAGMA temp_store=memory"
})); }));
var createMediaStreamsTableCommand var createMediaStreamsTableCommand
= "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))"; = "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))";
string[] queries = { string[] queries = {
"PRAGMA locking_mode=NORMAL", "PRAGMA locking_mode=NORMAL",
"create table if not exists TypedBaseItems (guid GUID primary key NOT NULL, type TEXT NOT NULL, data BLOB NULL, ParentId GUID NULL, Path TEXT NULL)", "create table if not exists TypedBaseItems (guid GUID primary key NOT NULL, type TEXT NOT NULL, data BLOB NULL, ParentId GUID NULL, Path TEXT NULL)",
@ -164,133 +174,133 @@ namespace Emby.Server.Implementations.Data
}; };
_connection.RunQueries(queries); connection.RunQueries(queries);
_connection.RunInTransaction(db => connection.RunInTransaction(db =>
{ {
var existingColumnNames = GetColumnNames(db, "AncestorIds"); var existingColumnNames = GetColumnNames(db, "AncestorIds");
AddColumn(db, "AncestorIds", "AncestorIdText", "Text", existingColumnNames); AddColumn(db, "AncestorIds", "AncestorIdText", "Text", existingColumnNames);
existingColumnNames = GetColumnNames(db, "TypedBaseItems"); existingColumnNames = GetColumnNames(db, "TypedBaseItems");
AddColumn(db, "TypedBaseItems", "Path", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Path", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "StartDate", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "StartDate", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "EndDate", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "EndDate", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ChannelId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ChannelId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsMovie", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsMovie", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsSports", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsSports", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsKids", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsKids", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "CommunityRating", "Float", existingColumnNames); AddColumn(db, "TypedBaseItems", "CommunityRating", "Float", existingColumnNames);
AddColumn(db, "TypedBaseItems", "CustomRating", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "CustomRating", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IndexNumber", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IndexNumber", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsLocked", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsLocked", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Name", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Name", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "OfficialRating", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "OfficialRating", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "MediaType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "MediaType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Overview", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Overview", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ParentIndexNumber", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "ParentIndexNumber", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "PremiereDate", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "PremiereDate", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ProductionYear", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "ProductionYear", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ParentId", "GUID", existingColumnNames); AddColumn(db, "TypedBaseItems", "ParentId", "GUID", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Genres", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Genres", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SortName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "SortName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "RunTimeTicks", "BIGINT", existingColumnNames); AddColumn(db, "TypedBaseItems", "RunTimeTicks", "BIGINT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "OfficialRatingDescription", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "OfficialRatingDescription", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "HomePageUrl", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "HomePageUrl", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "VoteCount", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "VoteCount", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DisplayMediaType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "DisplayMediaType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateCreated", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateCreated", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateModified", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateModified", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ForcedSortName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ForcedSortName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "LocationType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "LocationType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsSeries", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsSeries", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsLive", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsLive", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsNews", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsNews", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsPremiere", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsPremiere", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "EpisodeTitle", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "EpisodeTitle", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsRepeat", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsRepeat", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "PreferredMetadataLanguage", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "PreferredMetadataLanguage", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "PreferredMetadataCountryCode", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "PreferredMetadataCountryCode", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsHD", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsHD", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ExternalEtag", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ExternalEtag", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateLastRefreshed", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateLastRefreshed", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateLastSaved", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateLastSaved", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsInMixedFolder", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsInMixedFolder", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "LockedFields", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "LockedFields", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Studios", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Studios", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Audio", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Audio", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ExternalServiceId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ExternalServiceId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Tags", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Tags", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsFolder", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsFolder", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "InheritedParentalRatingValue", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "InheritedParentalRatingValue", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "UnratedType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "UnratedType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "TopParentId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "TopParentId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsItemByName", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsItemByName", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SourceType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "SourceType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "TrailerTypes", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "TrailerTypes", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "CriticRating", "Float", existingColumnNames); AddColumn(db, "TypedBaseItems", "CriticRating", "Float", existingColumnNames);
AddColumn(db, "TypedBaseItems", "CriticRatingSummary", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "CriticRatingSummary", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "InheritedTags", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "InheritedTags", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "CleanName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "CleanName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "PresentationUniqueKey", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "PresentationUniqueKey", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SlugName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "SlugName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "OriginalTitle", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "OriginalTitle", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "PrimaryVersionId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "PrimaryVersionId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateLastMediaAdded", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateLastMediaAdded", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Album", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Album", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsVirtualItem", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsVirtualItem", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SeriesName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "SeriesName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "UserDataKey", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "UserDataKey", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SeasonName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "SeasonName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SeasonId", "GUID", existingColumnNames); AddColumn(db, "TypedBaseItems", "SeasonId", "GUID", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SeriesId", "GUID", existingColumnNames); AddColumn(db, "TypedBaseItems", "SeriesId", "GUID", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SeriesSortName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "SeriesSortName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ExternalSeriesId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ExternalSeriesId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ShortOverview", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ShortOverview", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Tagline", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Tagline", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Keywords", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Keywords", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ProviderIds", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ProviderIds", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Images", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Images", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ProductionLocations", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ProductionLocations", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ThemeSongIds", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ThemeSongIds", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ThemeVideoIds", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ThemeVideoIds", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "TotalBitrate", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "TotalBitrate", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ExtraType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ExtraType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Artists", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Artists", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "AlbumArtists", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "AlbumArtists", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ExternalId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ExternalId", "Text", existingColumnNames);
existingColumnNames = GetColumnNames(db, "ItemValues"); existingColumnNames = GetColumnNames(db, "ItemValues");
AddColumn(db, "ItemValues", "CleanValue", "Text", existingColumnNames); AddColumn(db, "ItemValues", "CleanValue", "Text", existingColumnNames);
existingColumnNames = GetColumnNames(db, ChaptersTableName); existingColumnNames = GetColumnNames(db, ChaptersTableName);
AddColumn(db, ChaptersTableName, "ImageDateModified", "DATETIME", existingColumnNames); AddColumn(db, ChaptersTableName, "ImageDateModified", "DATETIME", existingColumnNames);
existingColumnNames = GetColumnNames(db, "MediaStreams"); existingColumnNames = GetColumnNames(db, "MediaStreams");
AddColumn(db, "MediaStreams", "IsAvc", "BIT", existingColumnNames); AddColumn(db, "MediaStreams", "IsAvc", "BIT", existingColumnNames);
AddColumn(db, "MediaStreams", "TimeBase", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "TimeBase", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "CodecTimeBase", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "CodecTimeBase", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "Title", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "Title", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "NalLengthSize", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "NalLengthSize", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "Comment", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "Comment", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "CodecTag", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "CodecTag", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "PixelFormat", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "PixelFormat", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "BitDepth", "INT", existingColumnNames); AddColumn(db, "MediaStreams", "BitDepth", "INT", existingColumnNames);
AddColumn(db, "MediaStreams", "RefFrames", "INT", existingColumnNames); AddColumn(db, "MediaStreams", "RefFrames", "INT", existingColumnNames);
AddColumn(db, "MediaStreams", "KeyFrames", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "KeyFrames", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "IsAnamorphic", "BIT", existingColumnNames); AddColumn(db, "MediaStreams", "IsAnamorphic", "BIT", existingColumnNames);
}); });
string[] postQueries = string[] postQueries =
{ {
// obsolete // obsolete
"drop index if exists idx_TypedBaseItems", "drop index if exists idx_TypedBaseItems",
"drop index if exists idx_mediastreams", "drop index if exists idx_mediastreams",
@ -350,11 +360,15 @@ namespace Emby.Server.Implementations.Data
"create index if not exists idx_ItemValues7 on ItemValues(Type,CleanValue,ItemId)" "create index if not exists idx_ItemValues7 on ItemValues(Type,CleanValue,ItemId)"
}; };
_connection.RunQueries(postQueries); connection.RunQueries(postQueries);
//SqliteExtensions.Attach(_connection, Path.Combine(_config.ApplicationPaths.DataPath, "userdata_v2.db"), "UserDataDb");
//await Vacuum(_connection).ConfigureAwait(false);
}
//SqliteExtensions.Attach(_connection, Path.Combine(_config.ApplicationPaths.DataPath, "userdata_v2.db"), "UserDataDb");
userDataRepo.Initialize(WriteLock); userDataRepo.Initialize(WriteLock);
//await Vacuum(_connection).ConfigureAwait(false);
_backgroundConnection = CreateConnection(true);
} }
private readonly string[] _retriveItemColumns = private readonly string[] _retriveItemColumns =
@ -2127,15 +2141,6 @@ namespace Emby.Server.Implementations.Data
} }
} }
protected override void CloseConnection()
{
if (_connection != null)
{
_connection.Dispose();
_connection = null;
}
}
private bool EnableJoinUserData(InternalItemsQuery query) private bool EnableJoinUserData(InternalItemsQuery query)
{ {
if (query.User == null) if (query.User == null)

View File

@ -38,6 +38,7 @@ using MediaBrowser.Model.Diagnostics;
using MediaBrowser.Model.FileOrganization; using MediaBrowser.Model.FileOrganization;
using MediaBrowser.Model.System; using MediaBrowser.Model.System;
using MediaBrowser.Model.Threading; using MediaBrowser.Model.Threading;
using MediaBrowser.Model.Extensions;
namespace Emby.Server.Implementations.LiveTv.EmbyTV namespace Emby.Server.Implementations.LiveTv.EmbyTV
{ {
@ -1550,6 +1551,49 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
// _logger.ErrorException("Error processing new recording", ex); // _logger.ErrorException("Error processing new recording", ex);
// } // }
//} //}
PostProcessRecording(timer, path);
}
private void PostProcessRecording(TimerInfo timer, string path)
{
var options = GetConfiguration();
if (string.IsNullOrWhiteSpace(options.RecordingPostProcessor))
{
return;
}
try
{
var process = _processFactory.Create(new ProcessOptions
{
Arguments = GetPostProcessArguments(path, options.RecordingPostProcessorArguments),
CreateNoWindow = true,
EnableRaisingEvents = true,
ErrorDialog = false,
FileName = options.RecordingPostProcessor,
IsHidden = true,
UseShellExecute = true
});
_logger.Info("Running recording post processor {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
process.Exited += Process_Exited;
process.Start();
}
catch (Exception ex)
{
_logger.ErrorException("Error running recording post processor", ex);
}
}
private string GetPostProcessArguments(string path, string arguments)
{
return arguments.Replace("{path}", path, StringComparison.OrdinalIgnoreCase);
}
private void Process_Exited(object sender, EventArgs e)
{
((IProcess)sender).Dispose();
} }
private void SaveNfo(TimerInfo timer, string recordingPath, string seriesPath) private void SaveNfo(TimerInfo timer, string recordingPath, string seriesPath)

View File

@ -13,6 +13,7 @@
public bool SaveLocalMetadata { get; set; } public bool SaveLocalMetadata { get; set; }
public bool EnableInternetProviders { get; set; } public bool EnableInternetProviders { get; set; }
public bool ImportMissingEpisodes { get; set; }
public LibraryOptions() public LibraryOptions()
{ {

View File

@ -57,6 +57,7 @@ namespace MediaBrowser.Model.Configuration
HidePlayedInLatest = true; HidePlayedInLatest = true;
PlayDefaultAudioTrack = true; PlayDefaultAudioTrack = true;
DisplayMissingEpisodes = true;
LatestItemsExcludes = new string[] { }; LatestItemsExcludes = new string[] { };
OrderedViews = new string[] { }; OrderedViews = new string[] { };

View File

@ -26,6 +26,9 @@ namespace MediaBrowser.Model.LiveTv
public string[] MediaLocationsCreated { get; set; } public string[] MediaLocationsCreated { get; set; }
public string RecordingPostProcessor { get; set; }
public string RecordingPostProcessorArguments { get; set; }
public LiveTvOptions() public LiveTvOptions()
{ {
EnableMovieProviders = true; EnableMovieProviders = true;
@ -34,6 +37,7 @@ namespace MediaBrowser.Model.LiveTv
ListingProviders = new List<ListingsProviderInfo>(); ListingProviders = new List<ListingsProviderInfo>();
MediaLocationsCreated = new string[] { }; MediaLocationsCreated = new string[] { };
RecordingEncodingFormat = "mp4"; RecordingEncodingFormat = "mp4";
RecordingPostProcessorArguments = "\"{path}\"";
} }
} }

View File

@ -120,10 +120,13 @@ namespace MediaBrowser.Providers.TV
var hasBadData = HasInvalidContent(seriesList); var hasBadData = HasInvalidContent(seriesList);
// Be conservative here to avoid creating missing episodes for ones they already have
var addMissingEpisodes = !hasBadData && seriesList.All(i => _libraryManager.GetLibraryOptions(i).ImportMissingEpisodes);
var anySeasonsRemoved = await RemoveObsoleteOrMissingSeasons(seriesList, episodeLookup) var anySeasonsRemoved = await RemoveObsoleteOrMissingSeasons(seriesList, episodeLookup)
.ConfigureAwait(false); .ConfigureAwait(false);
var anyEpisodesRemoved = await RemoveObsoleteOrMissingEpisodes(seriesList, episodeLookup) var anyEpisodesRemoved = await RemoveObsoleteOrMissingEpisodes(seriesList, episodeLookup, addMissingEpisodes)
.ConfigureAwait(false); .ConfigureAwait(false);
var hasNewEpisodes = false; var hasNewEpisodes = false;
@ -134,7 +137,7 @@ namespace MediaBrowser.Providers.TV
if (seriesConfig == null || !seriesConfig.DisabledMetadataFetchers.Contains(TvdbSeriesProvider.Current.Name, StringComparer.OrdinalIgnoreCase)) if (seriesConfig == null || !seriesConfig.DisabledMetadataFetchers.Contains(TvdbSeriesProvider.Current.Name, StringComparer.OrdinalIgnoreCase))
{ {
hasNewEpisodes = await AddMissingEpisodes(seriesList, hasBadData, seriesDataPath, episodeLookup, cancellationToken) hasNewEpisodes = await AddMissingEpisodes(seriesList, addMissingEpisodes, seriesDataPath, episodeLookup, cancellationToken)
.ConfigureAwait(false); .ConfigureAwait(false);
} }
} }
@ -180,13 +183,9 @@ namespace MediaBrowser.Providers.TV
/// Adds the missing episodes. /// Adds the missing episodes.
/// </summary> /// </summary>
/// <param name="series">The series.</param> /// <param name="series">The series.</param>
/// <param name="seriesHasBadData">if set to <c>true</c> [series has bad data].</param>
/// <param name="seriesDataPath">The series data path.</param>
/// <param name="episodeLookup">The episode lookup.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns> /// <returns>Task.</returns>
private async Task<bool> AddMissingEpisodes(List<Series> series, private async Task<bool> AddMissingEpisodes(List<Series> series,
bool seriesHasBadData, bool addMissingEpisodes,
string seriesDataPath, string seriesDataPath,
IEnumerable<Tuple<int, int>> episodeLookup, IEnumerable<Tuple<int, int>> episodeLookup,
CancellationToken cancellationToken) CancellationToken cancellationToken)
@ -240,8 +239,7 @@ namespace MediaBrowser.Providers.TV
if (airDate.Value < now) if (airDate.Value < now)
{ {
// Be conservative here to avoid creating missing episodes for ones they already have if (addMissingEpisodes)
if (!seriesHasBadData)
{ {
// tvdb has a lot of nearly blank episodes // tvdb has a lot of nearly blank episodes
_logger.Info("Creating virtual missing episode {0} {1}x{2}", targetSeries.Name, tuple.Item1, tuple.Item2); _logger.Info("Creating virtual missing episode {0} {1}x{2}", targetSeries.Name, tuple.Item1, tuple.Item2);
@ -278,7 +276,8 @@ namespace MediaBrowser.Providers.TV
/// Removes the virtual entry after a corresponding physical version has been added /// Removes the virtual entry after a corresponding physical version has been added
/// </summary> /// </summary>
private async Task<bool> RemoveObsoleteOrMissingEpisodes(IEnumerable<Series> series, private async Task<bool> RemoveObsoleteOrMissingEpisodes(IEnumerable<Series> series,
IEnumerable<Tuple<int, int>> episodeLookup) IEnumerable<Tuple<int, int>> episodeLookup,
bool allowMissingEpisodes)
{ {
var existingEpisodes = (from s in series var existingEpisodes = (from s in series
let seasonOffset = TvdbSeriesProvider.GetSeriesOffset(s.ProviderIds) ?? ((s.AnimeSeriesIndex ?? 1) - 1) let seasonOffset = TvdbSeriesProvider.GetSeriesOffset(s.ProviderIds) ?? ((s.AnimeSeriesIndex ?? 1) - 1)
@ -316,6 +315,11 @@ namespace MediaBrowser.Providers.TV
return true; return true;
} }
if (!allowMissingEpisodes && i.Episode.IsMissingEpisode)
{
return true;
}
return false; return false;
} }