mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-03 05:34:16 -04:00
remove trailing whitespace
This commit is contained in:
parent
ba1794f64b
commit
bd169e4fd4
@ -3,7 +3,7 @@ using System.Reflection;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("BDInfo")]
|
[assembly: AssemblyTitle("BDInfo")]
|
||||||
@ -19,11 +19,11 @@ using System.Runtime.InteropServices;
|
|||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.1")]
|
[assembly: AssemblyVersion("1.0.1")]
|
@ -148,7 +148,7 @@ namespace BDInfo
|
|||||||
stream.IsVBR = true;
|
stream.IsVBR = true;
|
||||||
stream.IsInitialized = true;
|
stream.IsInitialized = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
stream.IsVBR = false;
|
stream.IsVBR = false;
|
||||||
stream.IsInitialized = true;
|
stream.IsInitialized = true;
|
||||||
|
@ -22,9 +22,9 @@ namespace BDInfo
|
|||||||
{
|
{
|
||||||
public abstract class TSCodecDTSHD
|
public abstract class TSCodecDTSHD
|
||||||
{
|
{
|
||||||
private static int[] SampleRates = new int[]
|
private static int[] SampleRates = new int[]
|
||||||
{ 0x1F40, 0x3E80, 0x7D00, 0x0FA00, 0x1F400, 0x5622, 0x0AC44, 0x15888, 0x2B110, 0x56220, 0x2EE0, 0x5DC0, 0x0BB80, 0x17700, 0x2EE00, 0x5DC00 };
|
{ 0x1F40, 0x3E80, 0x7D00, 0x0FA00, 0x1F400, 0x5622, 0x0AC44, 0x15888, 0x2B110, 0x56220, 0x2EE0, 0x5DC0, 0x0BB80, 0x17700, 0x2EE00, 0x5DC00 };
|
||||||
|
|
||||||
public static void Scan(
|
public static void Scan(
|
||||||
TSAudioStream stream,
|
TSAudioStream stream,
|
||||||
TSStreamBuffer buffer,
|
TSStreamBuffer buffer,
|
||||||
@ -131,7 +131,7 @@ namespace BDInfo
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
AssetSizes[i] = buffer.ReadBits(16) + 1;
|
AssetSizes[i] = buffer.ReadBits(16) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < nuNumAssets; i++)
|
for (int i = 0; i < nuNumAssets; i++)
|
||||||
{
|
{
|
||||||
@ -189,7 +189,7 @@ namespace BDInfo
|
|||||||
}
|
}
|
||||||
stream.SampleRate = SampleRates[nuMaxSampleRate];
|
stream.SampleRate = SampleRates[nuMaxSampleRate];
|
||||||
stream.BitDepth = nuBitResolution;
|
stream.BitDepth = nuBitResolution;
|
||||||
|
|
||||||
stream.LFE = 0;
|
stream.LFE = 0;
|
||||||
if ((nuSpkrActivityMask & 0x8) == 0x8)
|
if ((nuSpkrActivityMask & 0x8) == 0x8)
|
||||||
{
|
{
|
||||||
@ -240,7 +240,7 @@ namespace BDInfo
|
|||||||
stream.IsInitialized = true;
|
stream.IsInitialized = true;
|
||||||
}
|
}
|
||||||
stream.IsInitialized = (stream.BitRate > 0 ? true : false);
|
stream.IsInitialized = (stream.BitRate > 0 ? true : false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace BDInfo
|
|||||||
int pictureParse = 0;
|
int pictureParse = 0;
|
||||||
int sequenceHeaderParse = 0;
|
int sequenceHeaderParse = 0;
|
||||||
int extensionParse = 0;
|
int extensionParse = 0;
|
||||||
int sequenceExtensionParse = 0;
|
int sequenceExtensionParse = 0;
|
||||||
|
|
||||||
for (int i = 0; i < buffer.Length; i++)
|
for (int i = 0; i < buffer.Length; i++)
|
||||||
{
|
{
|
||||||
@ -189,7 +189,7 @@ namespace BDInfo
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (sequenceExtensionParse == 0)
|
if (sequenceExtensionParse == 0)
|
||||||
{
|
{
|
||||||
uint sequenceExtension =
|
uint sequenceExtension =
|
||||||
((parse & 0x8) >> 3);
|
((parse & 0x8) >> 3);
|
||||||
if (sequenceExtension == 0)
|
if (sequenceExtension == 0)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ namespace BDInfo
|
|||||||
for (int i = 0; i < buffer.Length; i++)
|
for (int i = 0; i < buffer.Length; i++)
|
||||||
{
|
{
|
||||||
sync = (sync << 8) + buffer.ReadByte();
|
sync = (sync << 8) + buffer.ReadByte();
|
||||||
if (sync == 0xF8726FBA)
|
if (sync == 0xF8726FBA)
|
||||||
{
|
{
|
||||||
syncFound = true;
|
syncFound = true;
|
||||||
break;
|
break;
|
||||||
@ -63,7 +63,7 @@ namespace BDInfo
|
|||||||
int ratebits = buffer.ReadBits(4);
|
int ratebits = buffer.ReadBits(4);
|
||||||
if (ratebits != 0xF)
|
if (ratebits != 0xF)
|
||||||
{
|
{
|
||||||
stream.SampleRate =
|
stream.SampleRate =
|
||||||
(((ratebits & 8) > 0 ? 44100 : 48000) << (ratebits & 7));
|
(((ratebits & 8) > 0 ? 44100 : 48000) << (ratebits & 7));
|
||||||
}
|
}
|
||||||
int temp1 = buffer.ReadBits(8);
|
int temp1 = buffer.ReadBits(8);
|
||||||
@ -149,9 +149,9 @@ namespace BDInfo
|
|||||||
int peak_bitrate = buffer.ReadBits(15);
|
int peak_bitrate = buffer.ReadBits(15);
|
||||||
peak_bitrate = (peak_bitrate * stream.SampleRate) >> 4;
|
peak_bitrate = (peak_bitrate * stream.SampleRate) >> 4;
|
||||||
|
|
||||||
double peak_bitdepth =
|
double peak_bitdepth =
|
||||||
(double)peak_bitrate /
|
(double)peak_bitrate /
|
||||||
(stream.ChannelCount + stream.LFE) /
|
(stream.ChannelCount + stream.LFE) /
|
||||||
stream.SampleRate;
|
stream.SampleRate;
|
||||||
if (peak_bitdepth > 14)
|
if (peak_bitdepth > 14)
|
||||||
{
|
{
|
||||||
@ -164,7 +164,7 @@ namespace BDInfo
|
|||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
System.Diagnostics.Debug.WriteLine(string.Format(
|
System.Diagnostics.Debug.WriteLine(string.Format(
|
||||||
"{0}\t{1}\t{2:F2}",
|
"{0}\t{1}\t{2:F2}",
|
||||||
stream.PID, peak_bitrate, peak_bitdepth));
|
stream.PID, peak_bitrate, peak_bitdepth));
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
|
@ -50,18 +50,18 @@ namespace BDInfo
|
|||||||
{
|
{
|
||||||
if ((parse & 0x80000000) == 0)
|
if ((parse & 0x80000000) == 0)
|
||||||
{
|
{
|
||||||
pictureType =
|
pictureType =
|
||||||
(uint)((parse & 0x78000000) >> 13);
|
(uint)((parse & 0x78000000) >> 13);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pictureType =
|
pictureType =
|
||||||
(uint)((parse & 0x3c000000) >> 12);
|
(uint)((parse & 0x3c000000) >> 12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pictureType =
|
pictureType =
|
||||||
(uint)((parse & 0xf0000000) >> 14);
|
(uint)((parse & 0xf0000000) >> 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ namespace BDInfo
|
|||||||
|
|
||||||
public List<double> Chapters = new List<double>();
|
public List<double> Chapters = new List<double>();
|
||||||
|
|
||||||
public Dictionary<ushort, TSStream> Streams =
|
public Dictionary<ushort, TSStream> Streams =
|
||||||
new Dictionary<ushort, TSStream>();
|
new Dictionary<ushort, TSStream>();
|
||||||
public Dictionary<ushort, TSStream> PlaylistStreams =
|
public Dictionary<ushort, TSStream> PlaylistStreams =
|
||||||
new Dictionary<ushort, TSStream>();
|
new Dictionary<ushort, TSStream>();
|
||||||
@ -50,19 +50,19 @@ namespace BDInfo
|
|||||||
new List<TSStreamClip>();
|
new List<TSStreamClip>();
|
||||||
public List<Dictionary<ushort, TSStream>> AngleStreams =
|
public List<Dictionary<ushort, TSStream>> AngleStreams =
|
||||||
new List<Dictionary<ushort, TSStream>>();
|
new List<Dictionary<ushort, TSStream>>();
|
||||||
public List<Dictionary<double, TSStreamClip>> AngleClips =
|
public List<Dictionary<double, TSStreamClip>> AngleClips =
|
||||||
new List<Dictionary<double, TSStreamClip>>();
|
new List<Dictionary<double, TSStreamClip>>();
|
||||||
public int AngleCount = 0;
|
public int AngleCount = 0;
|
||||||
|
|
||||||
public List<TSStream> SortedStreams =
|
public List<TSStream> SortedStreams =
|
||||||
new List<TSStream>();
|
new List<TSStream>();
|
||||||
public List<TSVideoStream> VideoStreams =
|
public List<TSVideoStream> VideoStreams =
|
||||||
new List<TSVideoStream>();
|
new List<TSVideoStream>();
|
||||||
public List<TSAudioStream> AudioStreams =
|
public List<TSAudioStream> AudioStreams =
|
||||||
new List<TSAudioStream>();
|
new List<TSAudioStream>();
|
||||||
public List<TSTextStream> TextStreams =
|
public List<TSTextStream> TextStreams =
|
||||||
new List<TSTextStream>();
|
new List<TSTextStream>();
|
||||||
public List<TSGraphicsStream> GraphicsStreams =
|
public List<TSGraphicsStream> GraphicsStreams =
|
||||||
new List<TSGraphicsStream>();
|
new List<TSGraphicsStream>();
|
||||||
|
|
||||||
public TSPlaylistFile(
|
public TSPlaylistFile(
|
||||||
@ -388,8 +388,8 @@ namespace BDInfo
|
|||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Debug.WriteLine(string.Format(
|
Debug.WriteLine(string.Format(
|
||||||
"{0} : {1} -> V:{2} A:{3} PG:{4} IG:{5} 2A:{6} 2V:{7} PIP:{8}",
|
"{0} : {1} -> V:{2} A:{3} PG:{4} IG:{5} 2A:{6} 2V:{7} PIP:{8}",
|
||||||
Name, streamFileName, streamCountVideo, streamCountAudio, streamCountPG, streamCountIG,
|
Name, streamFileName, streamCountVideo, streamCountAudio, streamCountPG, streamCountIG,
|
||||||
streamCountSecondaryAudio, streamCountSecondaryVideo, streamCountPIP));
|
streamCountSecondaryAudio, streamCountSecondaryVideo, streamCountPIP));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -427,7 +427,7 @@ namespace BDInfo
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* TODO
|
* TODO
|
||||||
*
|
*
|
||||||
for (int i = 0; i < streamCountPIP; i++)
|
for (int i = 0; i < streamCountPIP; i++)
|
||||||
{
|
{
|
||||||
TSStream stream = CreatePlaylistStream(data, ref pos);
|
TSStream stream = CreatePlaylistStream(data, ref pos);
|
||||||
@ -955,7 +955,7 @@ namespace BDInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int CompareVideoStreams(
|
public int CompareVideoStreams(
|
||||||
TSVideoStream x,
|
TSVideoStream x,
|
||||||
TSVideoStream y)
|
TSVideoStream y)
|
||||||
{
|
{
|
||||||
if (x == null && y == null)
|
if (x == null && y == null)
|
||||||
@ -996,7 +996,7 @@ namespace BDInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int CompareAudioStreams(
|
public int CompareAudioStreams(
|
||||||
TSAudioStream x,
|
TSAudioStream x,
|
||||||
TSAudioStream y)
|
TSAudioStream y)
|
||||||
{
|
{
|
||||||
if (x == y)
|
if (x == y)
|
||||||
|
@ -109,7 +109,7 @@ namespace BDInfo
|
|||||||
|
|
||||||
public TSDescriptor Clone()
|
public TSDescriptor Clone()
|
||||||
{
|
{
|
||||||
TSDescriptor descriptor =
|
TSDescriptor descriptor =
|
||||||
new TSDescriptor(Name, (byte)Value.Length);
|
new TSDescriptor(Name, (byte)Value.Length);
|
||||||
Value.CopyTo(descriptor.Value, 0);
|
Value.CopyTo(descriptor.Value, 0);
|
||||||
return descriptor;
|
return descriptor;
|
||||||
@ -153,15 +153,15 @@ namespace BDInfo
|
|||||||
private string _LanguageCode;
|
private string _LanguageCode;
|
||||||
public string LanguageCode
|
public string LanguageCode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _LanguageCode;
|
return _LanguageCode;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_LanguageCode = value;
|
_LanguageCode = value;
|
||||||
LanguageName = LanguageCodes.GetName(value);
|
LanguageName = LanguageCodes.GetName(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsVideoStream
|
public bool IsVideoStream
|
||||||
@ -407,7 +407,7 @@ namespace BDInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract TSStream Clone();
|
public abstract TSStream Clone();
|
||||||
|
|
||||||
protected void CopyTo(TSStream stream)
|
protected void CopyTo(TSStream stream)
|
||||||
{
|
{
|
||||||
stream.PID = PID;
|
stream.PID = PID;
|
||||||
@ -435,7 +435,7 @@ namespace BDInfo
|
|||||||
|
|
||||||
public int Width;
|
public int Width;
|
||||||
public int Height;
|
public int Height;
|
||||||
public bool IsInterlaced;
|
public bool IsInterlaced;
|
||||||
public int FrameRateEnumerator;
|
public int FrameRateEnumerator;
|
||||||
public int FrameRateDenominator;
|
public int FrameRateDenominator;
|
||||||
public TSAspectRatio AspectRatio;
|
public TSAspectRatio AspectRatio;
|
||||||
@ -581,7 +581,7 @@ namespace BDInfo
|
|||||||
stream.FrameRate = _FrameRate;
|
stream.FrameRate = _FrameRate;
|
||||||
stream.Width = Width;
|
stream.Width = Width;
|
||||||
stream.Height = Height;
|
stream.Height = Height;
|
||||||
stream.IsInterlaced = IsInterlaced;
|
stream.IsInterlaced = IsInterlaced;
|
||||||
stream.FrameRateEnumerator = FrameRateEnumerator;
|
stream.FrameRateEnumerator = FrameRateEnumerator;
|
||||||
stream.FrameRateDenominator = FrameRateDenominator;
|
stream.FrameRateDenominator = FrameRateDenominator;
|
||||||
stream.AspectRatio = AspectRatio;
|
stream.AspectRatio = AspectRatio;
|
||||||
|
@ -69,7 +69,7 @@ namespace BDInfo
|
|||||||
|
|
||||||
byte[] fileType = new byte[8];
|
byte[] fileType = new byte[8];
|
||||||
Array.Copy(data, 0, fileType, 0, fileType.Length);
|
Array.Copy(data, 0, fileType, 0, fileType.Length);
|
||||||
|
|
||||||
FileType = _textEncoding.GetASCIIEncoding().GetString(fileType, 0, fileType.Length);
|
FileType = _textEncoding.GetASCIIEncoding().GetString(fileType, 0, fileType.Length);
|
||||||
if (FileType != "HDMV0100" &&
|
if (FileType != "HDMV0100" &&
|
||||||
FileType != "HDMV0200")
|
FileType != "HDMV0200")
|
||||||
@ -78,7 +78,7 @@ namespace BDInfo
|
|||||||
"Clip info file {0} has an unknown file type {1}.",
|
"Clip info file {0} has an unknown file type {1}.",
|
||||||
FileInfo.Name, FileType));
|
FileInfo.Name, FileType));
|
||||||
}
|
}
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Debug.WriteLine(string.Format(
|
Debug.WriteLine(string.Format(
|
||||||
"\tFileType: {0}", FileType));
|
"\tFileType: {0}", FileType));
|
||||||
#endif
|
#endif
|
||||||
@ -110,9 +110,9 @@ namespace BDInfo
|
|||||||
TSStream stream = null;
|
TSStream stream = null;
|
||||||
|
|
||||||
ushort PID = (ushort)
|
ushort PID = (ushort)
|
||||||
((clipData[streamOffset] << 8) +
|
((clipData[streamOffset] << 8) +
|
||||||
clipData[streamOffset + 1]);
|
clipData[streamOffset + 1]);
|
||||||
|
|
||||||
streamOffset += 2;
|
streamOffset += 2;
|
||||||
|
|
||||||
TSStreamType streamType = (TSStreamType)
|
TSStreamType streamType = (TSStreamType)
|
||||||
@ -240,7 +240,7 @@ namespace BDInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
streamOffset += clipData[streamOffset] + 1;
|
streamOffset += clipData[streamOffset] + 1;
|
||||||
}
|
}
|
||||||
IsValid = true;
|
IsValid = true;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -391,7 +391,7 @@ namespace BDInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<ushort, TSStream> playlistStreams = playlist.Streams;
|
Dictionary<ushort, TSStream> playlistStreams = playlist.Streams;
|
||||||
if (clip.AngleIndex > 0 &&
|
if (clip.AngleIndex > 0 &&
|
||||||
clip.AngleIndex < playlist.AngleStreams.Count + 1)
|
clip.AngleIndex < playlist.AngleStreams.Count + 1)
|
||||||
{
|
{
|
||||||
playlistStreams = playlist.AngleStreams[clip.AngleIndex - 1];
|
playlistStreams = playlist.AngleStreams[clip.AngleIndex - 1];
|
||||||
@ -428,7 +428,7 @@ namespace BDInfo
|
|||||||
TSStream stream = Streams[PID];
|
TSStream stream = Streams[PID];
|
||||||
stream.PayloadBytes += streamState.WindowBytes;
|
stream.PayloadBytes += streamState.WindowBytes;
|
||||||
stream.PacketCount += streamState.WindowPackets;
|
stream.PacketCount += streamState.WindowPackets;
|
||||||
|
|
||||||
if (stream.IsVideoStream)
|
if (stream.IsVideoStream)
|
||||||
{
|
{
|
||||||
TSStreamDiagnostics diag = new TSStreamDiagnostics();
|
TSStreamDiagnostics diag = new TSStreamDiagnostics();
|
||||||
@ -457,7 +457,7 @@ namespace BDInfo
|
|||||||
int dataSize = 16384;
|
int dataSize = 16384;
|
||||||
Stream fileStream = null;
|
Stream fileStream = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string fileName;
|
string fileName;
|
||||||
if (BDInfoSettings.EnableSSIF &&
|
if (BDInfoSettings.EnableSSIF &&
|
||||||
InterleavedFile != null)
|
InterleavedFile != null)
|
||||||
@ -482,13 +482,13 @@ namespace BDInfo
|
|||||||
StreamStates.Clear();
|
StreamStates.Clear();
|
||||||
StreamDiagnostics.Clear();
|
StreamDiagnostics.Clear();
|
||||||
|
|
||||||
TSPacketParser parser =
|
TSPacketParser parser =
|
||||||
new TSPacketParser();
|
new TSPacketParser();
|
||||||
|
|
||||||
long fileLength = (uint)fileStream.Length;
|
long fileLength = (uint)fileStream.Length;
|
||||||
byte[] buffer = new byte[dataSize];
|
byte[] buffer = new byte[dataSize];
|
||||||
int bufferLength = 0;
|
int bufferLength = 0;
|
||||||
while ((bufferLength =
|
while ((bufferLength =
|
||||||
fileStream.Read(buffer, 0, buffer.Length)) > 0)
|
fileStream.Read(buffer, 0, buffer.Length)) > 0)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
@ -598,8 +598,8 @@ namespace BDInfo
|
|||||||
parser.StreamState.TransferCount++;
|
parser.StreamState.TransferCount++;
|
||||||
|
|
||||||
bool isFinished = ScanStream(
|
bool isFinished = ScanStream(
|
||||||
parser.Stream,
|
parser.Stream,
|
||||||
parser.StreamState,
|
parser.StreamState,
|
||||||
parser.StreamState.StreamBuffer);
|
parser.StreamState.StreamBuffer);
|
||||||
|
|
||||||
if (!isFullScan && isFinished)
|
if (!isFullScan && isFinished)
|
||||||
@ -680,10 +680,10 @@ namespace BDInfo
|
|||||||
for (int k = 0; k < (parser.PATOffset - 4); k += 4)
|
for (int k = 0; k < (parser.PATOffset - 4); k += 4)
|
||||||
{
|
{
|
||||||
uint programNumber = (uint)
|
uint programNumber = (uint)
|
||||||
((parser.PAT[k] << 8) +
|
((parser.PAT[k] << 8) +
|
||||||
parser.PAT[k + 1]);
|
parser.PAT[k + 1]);
|
||||||
|
|
||||||
ushort programPID = (ushort)
|
ushort programPID = (ushort)
|
||||||
(((parser.PAT[k + 2] & 0x1F) << 8) +
|
(((parser.PAT[k + 2] & 0x1F) << 8) +
|
||||||
parser.PAT[k + 3]);
|
parser.PAT[k + 3]);
|
||||||
|
|
||||||
@ -985,7 +985,7 @@ namespace BDInfo
|
|||||||
parser.PMTProgramDescriptorLength = buffer[i];
|
parser.PMTProgramDescriptorLength = buffer[i];
|
||||||
parser.PMTProgramDescriptors.Add(
|
parser.PMTProgramDescriptors.Add(
|
||||||
new TSDescriptor(
|
new TSDescriptor(
|
||||||
parser.PMTProgramDescriptor,
|
parser.PMTProgramDescriptor,
|
||||||
parser.PMTProgramDescriptorLength));
|
parser.PMTProgramDescriptorLength));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -998,7 +998,7 @@ namespace BDInfo
|
|||||||
parser.PMTProgramDescriptors.Count - 1];
|
parser.PMTProgramDescriptors.Count - 1];
|
||||||
|
|
||||||
int valueIndex =
|
int valueIndex =
|
||||||
descriptor.Value.Length -
|
descriptor.Value.Length -
|
||||||
parser.PMTProgramDescriptorLength - 1;
|
parser.PMTProgramDescriptorLength - 1;
|
||||||
|
|
||||||
descriptor.Value[valueIndex] = buffer[i];
|
descriptor.Value[valueIndex] = buffer[i];
|
||||||
@ -1020,8 +1020,8 @@ namespace BDInfo
|
|||||||
parser.SyncState = false;
|
parser.SyncState = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (parser.Stream != null &&
|
else if (parser.Stream != null &&
|
||||||
parser.StreamState != null &&
|
parser.StreamState != null &&
|
||||||
parser.TransportScramblingControl == 0)
|
parser.TransportScramblingControl == 0)
|
||||||
{
|
{
|
||||||
TSStream stream = parser.Stream;
|
TSStream stream = parser.Stream;
|
||||||
@ -1032,7 +1032,7 @@ namespace BDInfo
|
|||||||
|
|
||||||
if (streamState.TransferState)
|
if (streamState.TransferState)
|
||||||
{
|
{
|
||||||
if ((bufferLength - i) >= streamState.PacketLength &&
|
if ((bufferLength - i) >= streamState.PacketLength &&
|
||||||
streamState.PacketLength > 0)
|
streamState.PacketLength > 0)
|
||||||
{
|
{
|
||||||
offset = streamState.PacketLength;
|
offset = streamState.PacketLength;
|
||||||
@ -1085,7 +1085,7 @@ namespace BDInfo
|
|||||||
--parser.PacketLength;
|
--parser.PacketLength;
|
||||||
|
|
||||||
bool headerFound = false;
|
bool headerFound = false;
|
||||||
if (stream.IsVideoStream &&
|
if (stream.IsVideoStream &&
|
||||||
streamState.Parse == 0x000001FD)
|
streamState.Parse == 0x000001FD)
|
||||||
{
|
{
|
||||||
headerFound = true;
|
headerFound = true;
|
||||||
@ -1170,18 +1170,18 @@ namespace BDInfo
|
|||||||
(byte)(streamState.Parse & 0xFF);
|
(byte)(streamState.Parse & 0xFF);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
streamState.PESHeaderFlags =
|
streamState.PESHeaderFlags =
|
||||||
(byte)(streamState.Parse & 0xFF);
|
(byte)(streamState.Parse & 0xFF);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xFF);
|
(byte)(streamState.Parse & 0xFF);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
streamState.PESHeaderLength =
|
streamState.PESHeaderLength =
|
||||||
(byte)(streamState.Parse & 0xFF);
|
(byte)(streamState.Parse & 0xFF);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
@ -1211,48 +1211,48 @@ namespace BDInfo
|
|||||||
switch (streamState.PTSParse)
|
switch (streamState.PTSParse)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
streamState.PTSTemp =
|
streamState.PTSTemp =
|
||||||
((streamState.Parse & 0xE) << 29);
|
((streamState.Parse & 0xE) << 29);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xff);
|
(byte)(streamState.Parse & 0xff);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
streamState.PTSTemp |=
|
streamState.PTSTemp |=
|
||||||
((streamState.Parse & 0xFF) << 22);
|
((streamState.Parse & 0xFF) << 22);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xFF);
|
(byte)(streamState.Parse & 0xFF);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
streamState.PTSTemp |=
|
streamState.PTSTemp |=
|
||||||
((streamState.Parse & 0xFE) << 14);
|
((streamState.Parse & 0xFE) << 14);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xFF);
|
(byte)(streamState.Parse & 0xFF);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
streamState.PTSTemp |=
|
streamState.PTSTemp |=
|
||||||
((streamState.Parse & 0xFF) << 7);
|
((streamState.Parse & 0xFF) << 7);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xFF);
|
(byte)(streamState.Parse & 0xFF);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
streamState.PTSTemp |=
|
streamState.PTSTemp |=
|
||||||
((streamState.Parse & 0xFE) >> 1);
|
((streamState.Parse & 0xFE) >> 1);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xff);
|
(byte)(streamState.Parse & 0xff);
|
||||||
#endif
|
#endif
|
||||||
streamState.PTS = streamState.PTSTemp;
|
streamState.PTS = streamState.PTSTemp;
|
||||||
|
|
||||||
if (streamState.PTS > streamState.PTSLast)
|
if (streamState.PTS > streamState.PTSLast)
|
||||||
@ -1260,13 +1260,13 @@ namespace BDInfo
|
|||||||
if (streamState.PTSLast > 0)
|
if (streamState.PTSLast > 0)
|
||||||
{
|
{
|
||||||
streamState.PTSTransfer = (streamState.PTS - streamState.PTSLast);
|
streamState.PTSTransfer = (streamState.PTS - streamState.PTSLast);
|
||||||
}
|
}
|
||||||
streamState.PTSLast = streamState.PTS;
|
streamState.PTSLast = streamState.PTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
streamState.PTSDiff = streamState.PTS - streamState.DTSPrev;
|
streamState.PTSDiff = streamState.PTS - streamState.DTSPrev;
|
||||||
|
|
||||||
if (streamState.PTSCount > 0 &&
|
if (streamState.PTSCount > 0 &&
|
||||||
stream.IsVideoStream)
|
stream.IsVideoStream)
|
||||||
{
|
{
|
||||||
UpdateStreamBitrates(stream.PID, streamState.PTS, streamState.PTSDiff);
|
UpdateStreamBitrates(stream.PID, streamState.PTS, streamState.PTSDiff);
|
||||||
@ -1280,7 +1280,7 @@ namespace BDInfo
|
|||||||
}
|
}
|
||||||
Length = (double)(parser.PTSLast - parser.PTSFirst) / 90000;
|
Length = (double)(parser.PTSLast - parser.PTSFirst) / 90000;
|
||||||
}
|
}
|
||||||
|
|
||||||
streamState.DTSPrev = streamState.PTS;
|
streamState.DTSPrev = streamState.PTS;
|
||||||
streamState.PTSCount++;
|
streamState.PTSCount++;
|
||||||
if (streamState.PESHeaderLength == 0)
|
if (streamState.PESHeaderLength == 0)
|
||||||
@ -1299,46 +1299,46 @@ namespace BDInfo
|
|||||||
switch (streamState.DTSParse)
|
switch (streamState.DTSParse)
|
||||||
{
|
{
|
||||||
case 9:
|
case 9:
|
||||||
streamState.PTSTemp =
|
streamState.PTSTemp =
|
||||||
((streamState.Parse & 0xE) << 29);
|
((streamState.Parse & 0xE) << 29);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xFF);
|
(byte)(streamState.Parse & 0xFF);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
streamState.PTSTemp |=
|
streamState.PTSTemp |=
|
||||||
((streamState.Parse & 0xFF) << 22);
|
((streamState.Parse & 0xFF) << 22);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xFF);
|
(byte)(streamState.Parse & 0xFF);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
streamState.PTSTemp |=
|
streamState.PTSTemp |=
|
||||||
((streamState.Parse & 0xFE) << 14);
|
((streamState.Parse & 0xFE) << 14);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xff);
|
(byte)(streamState.Parse & 0xff);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
streamState.PTSTemp |=
|
streamState.PTSTemp |=
|
||||||
((streamState.Parse & 0xFF) << 7);
|
((streamState.Parse & 0xFF) << 7);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xFF);
|
(byte)(streamState.Parse & 0xFF);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
streamState.PTSTemp |=
|
streamState.PTSTemp |=
|
||||||
((streamState.Parse & 0xFE) >> 1);
|
((streamState.Parse & 0xFE) >> 1);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xff);
|
(byte)(streamState.Parse & 0xff);
|
||||||
#endif
|
#endif
|
||||||
streamState.PTS = streamState.PTSTemp;
|
streamState.PTS = streamState.PTSTemp;
|
||||||
@ -1347,48 +1347,48 @@ namespace BDInfo
|
|||||||
streamState.PTSLast = streamState.PTS;
|
streamState.PTSLast = streamState.PTS;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
streamState.DTSTemp =
|
streamState.DTSTemp =
|
||||||
((streamState.Parse & 0xE) << 29);
|
((streamState.Parse & 0xE) << 29);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xff);
|
(byte)(streamState.Parse & 0xff);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
streamState.DTSTemp |=
|
streamState.DTSTemp |=
|
||||||
((streamState.Parse & 0xFF) << 22);
|
((streamState.Parse & 0xFF) << 22);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xff);
|
(byte)(streamState.Parse & 0xff);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
streamState.DTSTemp |=
|
streamState.DTSTemp |=
|
||||||
((streamState.Parse & 0xFE) << 14);
|
((streamState.Parse & 0xFE) << 14);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xff);
|
(byte)(streamState.Parse & 0xff);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
streamState.DTSTemp |=
|
streamState.DTSTemp |=
|
||||||
((streamState.Parse & 0xFF) << 7);
|
((streamState.Parse & 0xFF) << 7);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xFF);
|
(byte)(streamState.Parse & 0xFF);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
streamState.DTSTemp |=
|
streamState.DTSTemp |=
|
||||||
((streamState.Parse & 0xFE) >> 1);
|
((streamState.Parse & 0xFE) >> 1);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
streamState.PESHeader[streamState.PESHeaderIndex++] =
|
||||||
(byte)(streamState.Parse & 0xff);
|
(byte)(streamState.Parse & 0xff);
|
||||||
#endif
|
#endif
|
||||||
streamState.PTSDiff = streamState.DTSTemp - streamState.DTSPrev;
|
streamState.PTSDiff = streamState.DTSTemp - streamState.DTSPrev;
|
||||||
@ -1482,8 +1482,8 @@ namespace BDInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private TSStream CreateStream(
|
private TSStream CreateStream(
|
||||||
ushort streamPID,
|
ushort streamPID,
|
||||||
byte streamType,
|
byte streamType,
|
||||||
List<TSDescriptor> streamDescriptors)
|
List<TSDescriptor> streamDescriptors)
|
||||||
{
|
{
|
||||||
TSStream stream = null;
|
TSStream stream = null;
|
||||||
@ -1548,6 +1548,6 @@ namespace BDInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ namespace DvdLib.Ifo
|
|||||||
ProhibitedUserOperations = (UserOperation)br.ReadUInt32();
|
ProhibitedUserOperations = (UserOperation)br.ReadUInt32();
|
||||||
AudioStreamControl = br.ReadBytes(16);
|
AudioStreamControl = br.ReadBytes(16);
|
||||||
SubpictureStreamControl = br.ReadBytes(128);
|
SubpictureStreamControl = br.ReadBytes(128);
|
||||||
|
|
||||||
_nextProgramNumber = br.ReadUInt16();
|
_nextProgramNumber = br.ReadUInt16();
|
||||||
_prevProgramNumber = br.ReadUInt16();
|
_prevProgramNumber = br.ReadUInt16();
|
||||||
_goupProgramNumber = br.ReadUInt16();
|
_goupProgramNumber = br.ReadUInt16();
|
||||||
|
@ -20,7 +20,7 @@ namespace DvdLib.Ifo
|
|||||||
public ProgramChain EntryProgramChain { get; private set; }
|
public ProgramChain EntryProgramChain { get; private set; }
|
||||||
public readonly List<ProgramChain> ProgramChains;
|
public readonly List<ProgramChain> ProgramChains;
|
||||||
|
|
||||||
public readonly List<Chapter> Chapters;
|
public readonly List<Chapter> Chapters;
|
||||||
|
|
||||||
public Title(uint titleNum)
|
public Title(uint titleNum)
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ using System.Reflection;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("DvdLib")]
|
[assembly: AssemblyTitle("DvdLib")]
|
||||||
@ -19,11 +19,11 @@ using System.Runtime.InteropServices;
|
|||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.1")]
|
[assembly: AssemblyVersion("1.0.1")]
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
namespace Emby.Dlna.Common
|
namespace Emby.Dlna.Common
|
||||||
{
|
{
|
||||||
public class Argument
|
public class Argument
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
@ -77,7 +77,7 @@ namespace Emby.Dlna.ConnectionManager
|
|||||||
|
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetCurrentConnectionInfo()
|
private ServiceAction GetCurrentConnectionInfo()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
|
@ -8,7 +8,7 @@ namespace Emby.Dlna.ContentDirectory
|
|||||||
{
|
{
|
||||||
public string GetXml()
|
public string GetXml()
|
||||||
{
|
{
|
||||||
return new ServiceXmlBuilder().GetXml(new ServiceActionListBuilder().GetActions(),
|
return new ServiceXmlBuilder().GetXml(new ServiceActionListBuilder().GetActions(),
|
||||||
GetStateVariables());
|
GetStateVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ namespace Emby.Dlna.ContentDirectory
|
|||||||
|
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServiceAction GetXSetBookmarkAction()
|
private ServiceAction GetXSetBookmarkAction()
|
||||||
{
|
{
|
||||||
var action = new ServiceAction
|
var action = new ServiceAction
|
||||||
|
@ -10,7 +10,7 @@ namespace Emby.Dlna
|
|||||||
/// <param name="headers">The headers.</param>
|
/// <param name="headers">The headers.</param>
|
||||||
/// <returns>System.String.</returns>
|
/// <returns>System.String.</returns>
|
||||||
string GetServiceXml(IDictionary<string, string> headers);
|
string GetServiceXml(IDictionary<string, string> headers);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes the control request.
|
/// Processes the control request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -75,11 +75,11 @@ namespace Emby.Dlna.Main
|
|||||||
IUserDataManager userDataManager,
|
IUserDataManager userDataManager,
|
||||||
ILocalizationManager localizationManager,
|
ILocalizationManager localizationManager,
|
||||||
IMediaSourceManager mediaSourceManager,
|
IMediaSourceManager mediaSourceManager,
|
||||||
IDeviceDiscovery deviceDiscovery,
|
IDeviceDiscovery deviceDiscovery,
|
||||||
IMediaEncoder mediaEncoder,
|
IMediaEncoder mediaEncoder,
|
||||||
ISocketFactory socketFactory,
|
ISocketFactory socketFactory,
|
||||||
ITimerFactory timerFactory,
|
ITimerFactory timerFactory,
|
||||||
IEnvironmentInfo environmentInfo,
|
IEnvironmentInfo environmentInfo,
|
||||||
INetworkManager networkManager,
|
INetworkManager networkManager,
|
||||||
IUserViewManager userViewManager,
|
IUserViewManager userViewManager,
|
||||||
IXmlReaderSettingsFactory xmlReaderSettingsFactory,
|
IXmlReaderSettingsFactory xmlReaderSettingsFactory,
|
||||||
@ -104,19 +104,19 @@ namespace Emby.Dlna.Main
|
|||||||
_networkManager = networkManager;
|
_networkManager = networkManager;
|
||||||
_logger = loggerFactory.CreateLogger("Dlna");
|
_logger = loggerFactory.CreateLogger("Dlna");
|
||||||
|
|
||||||
ContentDirectory = new ContentDirectory.ContentDirectory(dlnaManager,
|
ContentDirectory = new ContentDirectory.ContentDirectory(dlnaManager,
|
||||||
userDataManager,
|
userDataManager,
|
||||||
imageProcessor,
|
imageProcessor,
|
||||||
libraryManager,
|
libraryManager,
|
||||||
config,
|
config,
|
||||||
userManager,
|
userManager,
|
||||||
_logger,
|
_logger,
|
||||||
httpClient,
|
httpClient,
|
||||||
localizationManager,
|
localizationManager,
|
||||||
mediaSourceManager,
|
mediaSourceManager,
|
||||||
userViewManager,
|
userViewManager,
|
||||||
mediaEncoder,
|
mediaEncoder,
|
||||||
xmlReaderSettingsFactory,
|
xmlReaderSettingsFactory,
|
||||||
tvSeriesManager);
|
tvSeriesManager);
|
||||||
|
|
||||||
ConnectionManager = new ConnectionManager.ConnectionManager(dlnaManager, config, _logger, httpClient, xmlReaderSettingsFactory);
|
ConnectionManager = new ConnectionManager.ConnectionManager(dlnaManager, config, _logger, httpClient, xmlReaderSettingsFactory);
|
||||||
@ -271,12 +271,12 @@ namespace Emby.Dlna.Main
|
|||||||
var device = new SsdpRootDevice
|
var device = new SsdpRootDevice
|
||||||
{
|
{
|
||||||
CacheLifetime = TimeSpan.FromSeconds(1800), //How long SSDP clients can cache this info.
|
CacheLifetime = TimeSpan.FromSeconds(1800), //How long SSDP clients can cache this info.
|
||||||
Location = uri, // Must point to the URL that serves your devices UPnP description document.
|
Location = uri, // Must point to the URL that serves your devices UPnP description document.
|
||||||
FriendlyName = "Jellyfin",
|
FriendlyName = "Jellyfin",
|
||||||
Manufacturer = "Jellyfin",
|
Manufacturer = "Jellyfin",
|
||||||
ModelName = "Jellyfin Server",
|
ModelName = "Jellyfin Server",
|
||||||
Uuid = udn
|
Uuid = udn
|
||||||
// This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
|
// This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
|
||||||
};
|
};
|
||||||
|
|
||||||
SetProperies(device, fullService);
|
SetProperies(device, fullService);
|
||||||
@ -297,7 +297,7 @@ namespace Emby.Dlna.Main
|
|||||||
Manufacturer = device.Manufacturer,
|
Manufacturer = device.Manufacturer,
|
||||||
ModelName = device.ModelName,
|
ModelName = device.ModelName,
|
||||||
Uuid = udn
|
Uuid = udn
|
||||||
// This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
|
// This must be a globally unique value that survives reboots etc. Get from storage or embedded hardware etc.
|
||||||
};
|
};
|
||||||
|
|
||||||
SetProperies(embeddedDevice, subDevice);
|
SetProperies(embeddedDevice, subDevice);
|
||||||
|
@ -739,7 +739,7 @@ namespace Emby.Dlna.PlayTo
|
|||||||
|
|
||||||
if (track == null)
|
if (track == null)
|
||||||
{
|
{
|
||||||
//If track is null, some vendors do this, use GetMediaInfo instead
|
//If track is null, some vendors do this, use GetMediaInfo instead
|
||||||
return new Tuple<bool, uBaseObject>(true, null);
|
return new Tuple<bool, uBaseObject>(true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ namespace Emby.Dlna.PlayTo
|
|||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<XDocument> SendCommandAsync(string baseUrl,
|
public async Task<XDocument> SendCommandAsync(string baseUrl,
|
||||||
DeviceService service,
|
DeviceService service,
|
||||||
string command,
|
string command,
|
||||||
string postData,
|
string postData,
|
||||||
bool logRequest = true,
|
bool logRequest = true,
|
||||||
string header = null)
|
string header = null)
|
||||||
{
|
{
|
||||||
@ -62,12 +62,12 @@ namespace Emby.Dlna.PlayTo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
public async Task SubscribeAsync(string url,
|
public async Task SubscribeAsync(string url,
|
||||||
string ip,
|
string ip,
|
||||||
int port,
|
int port,
|
||||||
string localIp,
|
string localIp,
|
||||||
int eventport,
|
int eventport,
|
||||||
int timeOut = 3600)
|
int timeOut = 3600)
|
||||||
{
|
{
|
||||||
var options = new HttpRequestOptions
|
var options = new HttpRequestOptions
|
||||||
@ -121,9 +121,9 @@ namespace Emby.Dlna.PlayTo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task<HttpResponseInfo> PostSoapDataAsync(string url,
|
private Task<HttpResponseInfo> PostSoapDataAsync(string url,
|
||||||
string soapAction,
|
string soapAction,
|
||||||
string postData,
|
string postData,
|
||||||
string header,
|
string header,
|
||||||
bool logRequest,
|
bool logRequest,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
|
@ -171,7 +171,7 @@ namespace Emby.Dlna.PlayTo
|
|||||||
if (state != null)
|
if (state != null)
|
||||||
{
|
{
|
||||||
var sendValue = state.AllowedValues.FirstOrDefault(a => string.Equals(a, commandParameter, StringComparison.OrdinalIgnoreCase)) ??
|
var sendValue = state.AllowedValues.FirstOrDefault(a => string.Equals(a, commandParameter, StringComparison.OrdinalIgnoreCase)) ??
|
||||||
state.AllowedValues.FirstOrDefault() ??
|
state.AllowedValues.FirstOrDefault() ??
|
||||||
value;
|
value;
|
||||||
|
|
||||||
return string.Format("<{0} xmlns:dt=\"urn:schemas-microsoft-com:datatypes\" dt:dt=\"{1}\">{2}</{0}>", argument.Name, state.DataType ?? "string", sendValue);
|
return string.Format("<{0} xmlns:dt=\"urn:schemas-microsoft-com:datatypes\" dt:dt=\"{1}\">{2}</{0}>", argument.Name, state.DataType ?? "string", sendValue);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Emby.Dlna.PlayTo
|
namespace Emby.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
public class uBaseObject
|
public class uBaseObject
|
||||||
{
|
{
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ namespace Emby.Dlna.PlayTo
|
|||||||
|
|
||||||
if (document == null)
|
if (document == null)
|
||||||
return list;
|
return list;
|
||||||
|
|
||||||
var item = (from result in document.Descendants("Result") select result).FirstOrDefault();
|
var item = (from result in document.Descendants("Result") select result).FirstOrDefault();
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
|
@ -41,7 +41,7 @@ namespace Emby.Dlna.Profiles
|
|||||||
|
|
||||||
EnableSingleAlbumArtLimit = true;
|
EnableSingleAlbumArtLimit = true;
|
||||||
EnableAlbumArtInDidl = true;
|
EnableAlbumArtInDidl = true;
|
||||||
|
|
||||||
TranscodingProfiles = new[]
|
TranscodingProfiles = new[]
|
||||||
{
|
{
|
||||||
new TranscodingProfile
|
new TranscodingProfile
|
||||||
|
@ -3,7 +3,7 @@ using System.Reflection;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Emby.Dlna2")]
|
[assembly: AssemblyTitle("Emby.Dlna2")]
|
||||||
@ -19,11 +19,11 @@ using System.Runtime.InteropServices;
|
|||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
@ -14,7 +14,7 @@ namespace Emby.Dlna.Service
|
|||||||
protected BaseService(ILogger logger, IHttpClient httpClient)
|
protected BaseService(ILogger logger, IHttpClient httpClient)
|
||||||
{
|
{
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
HttpClient = httpClient;
|
HttpClient = httpClient;
|
||||||
|
|
||||||
EventManager = new EventManager(Logger, HttpClient);
|
EventManager = new EventManager(Logger, HttpClient);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ namespace Emby.Dlna.Service
|
|||||||
public class ControlErrorHandler
|
public class ControlErrorHandler
|
||||||
{
|
{
|
||||||
private const string NS_SOAPENV = "http://schemas.xmlsoap.org/soap/envelope/";
|
private const string NS_SOAPENV = "http://schemas.xmlsoap.org/soap/envelope/";
|
||||||
|
|
||||||
public ControlResponse GetResponse(Exception ex)
|
public ControlResponse GetResponse(Exception ex)
|
||||||
{
|
{
|
||||||
var settings = new XmlWriterSettings
|
var settings = new XmlWriterSettings
|
||||||
|
@ -83,8 +83,8 @@ namespace Emby.Dlna.Ssdp
|
|||||||
{
|
{
|
||||||
_deviceLocator = new SsdpDeviceLocator(_commsServer, _timerFactory);
|
_deviceLocator = new SsdpDeviceLocator(_commsServer, _timerFactory);
|
||||||
|
|
||||||
// (Optional) Set the filter so we only see notifications for devices we care about
|
// (Optional) Set the filter so we only see notifications for devices we care about
|
||||||
// (can be any search target value i.e device type, uuid value etc - any value that appears in the
|
// (can be any search target value i.e device type, uuid value etc - any value that appears in the
|
||||||
// DiscoverdSsdpDevice.NotificationType property or that is used with the searchTarget parameter of the Search method).
|
// DiscoverdSsdpDevice.NotificationType property or that is used with the searchTarget parameter of the Search method).
|
||||||
//_DeviceLocator.NotificationFilter = "upnp:rootdevice";
|
//_DeviceLocator.NotificationFilter = "upnp:rootdevice";
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ using System.Reflection;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Emby.Drawing.Skia")]
|
[assembly: AssemblyTitle("Emby.Drawing.Skia")]
|
||||||
@ -19,7 +19,7 @@ using System.Runtime.InteropServices;
|
|||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
@ -103,7 +103,7 @@ namespace Emby.Drawing
|
|||||||
"crw",
|
"crw",
|
||||||
|
|
||||||
// Remove until supported
|
// Remove until supported
|
||||||
//"nef",
|
//"nef",
|
||||||
"orf",
|
"orf",
|
||||||
"pef",
|
"pef",
|
||||||
"arw",
|
"arw",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Emby.Drawing")]
|
[assembly: AssemblyTitle("Emby.Drawing")]
|
||||||
@ -13,8 +13,8 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
// to COM components. If you need to access a type in this assembly from
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ using System.Runtime.InteropServices;
|
|||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
@ -315,9 +315,9 @@ namespace IsoMounter
|
|||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
throw new ArgumentNullException(nameof(isoPath));
|
throw new ArgumentNullException(nameof(isoPath));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -397,9 +397,9 @@ namespace IsoMounter
|
|||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
throw new ArgumentNullException(nameof(mount));
|
throw new ArgumentNullException(nameof(mount));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetUID() == 0) {
|
if (GetUID() == 0) {
|
||||||
@ -444,7 +444,7 @@ namespace IsoMounter
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Internal Methods
|
#region Internal Methods
|
||||||
|
|
||||||
internal void OnUnmount(LinuxMount mount)
|
internal void OnUnmount(LinuxMount mount)
|
||||||
|
@ -48,7 +48,7 @@ namespace IsoMounter
|
|||||||
if (disposed) {
|
if (disposed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disposing) {
|
if (disposing) {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -29,7 +29,7 @@ namespace Emby.Naming.AudioBook
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The alternate versions.</value>
|
/// <value>The alternate versions.</value>
|
||||||
public List<AudioBookFileInfo> AlternateVersions { get; set; }
|
public List<AudioBookFileInfo> AlternateVersions { get; set; }
|
||||||
|
|
||||||
public AudioBookInfo()
|
public AudioBookInfo()
|
||||||
{
|
{
|
||||||
Files = new List<AudioBookFileInfo>();
|
Files = new List<AudioBookFileInfo>();
|
||||||
|
@ -46,7 +46,7 @@ namespace Emby.Naming.AudioBook
|
|||||||
|
|
||||||
var parsingResult = new AudioBookFilePathParser(_options)
|
var parsingResult = new AudioBookFilePathParser(_options)
|
||||||
.Parse(path, IsDirectory);
|
.Parse(path, IsDirectory);
|
||||||
|
|
||||||
return new AudioBookFileInfo
|
return new AudioBookFileInfo
|
||||||
{
|
{
|
||||||
Path = path,
|
Path = path,
|
||||||
|
@ -282,7 +282,7 @@ namespace Emby.Naming.Common
|
|||||||
new EpisodeExpression(@".*(\\|\/)(?<seriesname>((?[][ ._-]*[Ee]([0-9]+))[^\\\/])*)?[Ss](?<seasonnumber>[0-9]+)[][ ._-]*[Ee](?<epnumber>[0-9]+)([^\\/]*)$")
|
new EpisodeExpression(@".*(\\|\/)(?<seriesname>((?[][ ._-]*[Ee]([0-9]+))[^\\\/])*)?[Ss](?<seasonnumber>[0-9]+)[][ ._-]*[Ee](?<epnumber>[0-9]+)([^\\/]*)$")
|
||||||
{
|
{
|
||||||
IsNamed = true
|
IsNamed = true
|
||||||
},
|
},
|
||||||
// <!-- foo.ep01, foo.EP_01 -->
|
// <!-- foo.ep01, foo.EP_01 -->
|
||||||
new EpisodeExpression(@"[\._ -]()[Ee][Pp]_?([0-9]+)([^\\/]*)$"),
|
new EpisodeExpression(@"[\._ -]()[Ee][Pp]_?([0-9]+)([^\\/]*)$"),
|
||||||
new EpisodeExpression("([0-9]{4})[\\.-]([0-9]{2})[\\.-]([0-9]{2})", true)
|
new EpisodeExpression("([0-9]{4})[\\.-]([0-9]{2})[\\.-]([0-9]{2})", true)
|
||||||
|
@ -53,7 +53,7 @@ namespace Emby.Naming.TV
|
|||||||
|
|
||||||
var parsingResult = new EpisodePathParser(_options)
|
var parsingResult = new EpisodePathParser(_options)
|
||||||
.Parse(path, IsDirectory, isNamed, isOptimistic, supportsAbsoluteNumbers, fillExtendedInfo);
|
.Parse(path, IsDirectory, isNamed, isOptimistic, supportsAbsoluteNumbers, fillExtendedInfo);
|
||||||
|
|
||||||
return new EpisodeInfo
|
return new EpisodeInfo
|
||||||
{
|
{
|
||||||
Path = path,
|
Path = path,
|
||||||
|
@ -38,7 +38,7 @@ namespace Emby.Naming.Video
|
|||||||
}
|
}
|
||||||
catch (ArgumentException)
|
catch (ArgumentException)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = _options.CleanDateTimeRegexes.Select(i => Clean(name, i))
|
var result = _options.CleanDateTimeRegexes.Select(i => Clean(name, i))
|
||||||
|
@ -126,7 +126,7 @@ namespace Emby.Naming.Video
|
|||||||
}
|
}
|
||||||
stack.Files.Add(file2.FullName);
|
stack.Files.Add(file2.FullName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Sequel
|
// Sequel
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
@ -18,7 +18,7 @@ namespace Emby.Naming.Video
|
|||||||
{
|
{
|
||||||
var result = new StubResult();
|
var result = new StubResult();
|
||||||
var extension = Path.GetExtension(path) ?? string.Empty;
|
var extension = Path.GetExtension(path) ?? string.Empty;
|
||||||
|
|
||||||
if (_options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
|
if (_options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
result.IsStub = true;
|
result.IsStub = true;
|
||||||
|
@ -55,7 +55,7 @@ namespace Emby.Naming.Video
|
|||||||
/// Gets or sets the type of the stub.
|
/// Gets or sets the type of the stub.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type of the stub.</value>
|
/// <value>The type of the stub.</value>
|
||||||
public string StubType { get; set; }
|
public string StubType { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the type.
|
/// Gets or sets the type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -32,7 +32,7 @@ namespace Emby.Naming.Video
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The alternate versions.</value>
|
/// <value>The alternate versions.</value>
|
||||||
public List<VideoFileInfo> AlternateVersions { get; set; }
|
public List<VideoFileInfo> AlternateVersions { get; set; }
|
||||||
|
|
||||||
public VideoInfo()
|
public VideoInfo()
|
||||||
{
|
{
|
||||||
Files = new List<VideoFileInfo>();
|
Files = new List<VideoFileInfo>();
|
||||||
|
@ -55,9 +55,9 @@ namespace Emby.Naming.Video
|
|||||||
|
|
||||||
info.Year = info.Files.First().Year;
|
info.Year = info.Files.First().Year;
|
||||||
|
|
||||||
var extraBaseNames = new List<string>
|
var extraBaseNames = new List<string>
|
||||||
{
|
{
|
||||||
stack.Name,
|
stack.Name,
|
||||||
Path.GetFileNameWithoutExtension(stack.Files[0])
|
Path.GetFileNameWithoutExtension(stack.Files[0])
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Emby.Photos")]
|
[assembly: AssemblyTitle("Emby.Photos")]
|
||||||
@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
// to COM components. If you need to access a type in this assembly from
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
@ -25,10 +25,10 @@ using System.Runtime.InteropServices;
|
|||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
@ -1647,25 +1647,25 @@ namespace Emby.Server.Implementations
|
|||||||
// Gets all plugin assemblies by first reading all bytes of the .dll and calling Assembly.Load against that
|
// Gets all plugin assemblies by first reading all bytes of the .dll and calling Assembly.Load against that
|
||||||
// This will prevent the .dll file from getting locked, and allow us to replace it when needed
|
// This will prevent the .dll file from getting locked, and allow us to replace it when needed
|
||||||
|
|
||||||
// Include composable parts in the Api assembly
|
// Include composable parts in the Api assembly
|
||||||
list.Add(GetAssembly(typeof(ApiEntryPoint)));
|
list.Add(GetAssembly(typeof(ApiEntryPoint)));
|
||||||
|
|
||||||
// Include composable parts in the Dashboard assembly
|
// Include composable parts in the Dashboard assembly
|
||||||
list.Add(GetAssembly(typeof(DashboardService)));
|
list.Add(GetAssembly(typeof(DashboardService)));
|
||||||
|
|
||||||
// Include composable parts in the Model assembly
|
// Include composable parts in the Model assembly
|
||||||
list.Add(GetAssembly(typeof(SystemInfo)));
|
list.Add(GetAssembly(typeof(SystemInfo)));
|
||||||
|
|
||||||
// Include composable parts in the Common assembly
|
// Include composable parts in the Common assembly
|
||||||
list.Add(GetAssembly(typeof(IApplicationHost)));
|
list.Add(GetAssembly(typeof(IApplicationHost)));
|
||||||
|
|
||||||
// Include composable parts in the Controller assembly
|
// Include composable parts in the Controller assembly
|
||||||
list.Add(GetAssembly(typeof(IServerApplicationHost)));
|
list.Add(GetAssembly(typeof(IServerApplicationHost)));
|
||||||
|
|
||||||
// Include composable parts in the Providers assembly
|
// Include composable parts in the Providers assembly
|
||||||
list.Add(GetAssembly(typeof(ProviderUtils)));
|
list.Add(GetAssembly(typeof(ProviderUtils)));
|
||||||
|
|
||||||
// Include composable parts in the Photos assembly
|
// Include composable parts in the Photos assembly
|
||||||
list.Add(GetAssembly(typeof(PhotoProvider)));
|
list.Add(GetAssembly(typeof(PhotoProvider)));
|
||||||
|
|
||||||
// Emby.Server implementations
|
// Emby.Server implementations
|
||||||
@ -1674,16 +1674,16 @@ namespace Emby.Server.Implementations
|
|||||||
// MediaEncoding
|
// MediaEncoding
|
||||||
list.Add(GetAssembly(typeof(MediaBrowser.MediaEncoding.Encoder.MediaEncoder)));
|
list.Add(GetAssembly(typeof(MediaBrowser.MediaEncoding.Encoder.MediaEncoder)));
|
||||||
|
|
||||||
// Dlna
|
// Dlna
|
||||||
list.Add(GetAssembly(typeof(DlnaEntryPoint)));
|
list.Add(GetAssembly(typeof(DlnaEntryPoint)));
|
||||||
|
|
||||||
// Local metadata
|
// Local metadata
|
||||||
list.Add(GetAssembly(typeof(BoxSetXmlSaver)));
|
list.Add(GetAssembly(typeof(BoxSetXmlSaver)));
|
||||||
|
|
||||||
// Notifications
|
// Notifications
|
||||||
list.Add(GetAssembly(typeof(NotificationManager)));
|
list.Add(GetAssembly(typeof(NotificationManager)));
|
||||||
|
|
||||||
// Xbmc
|
// Xbmc
|
||||||
list.Add(GetAssembly(typeof(ArtistNfoProvider)));
|
list.Add(GetAssembly(typeof(ArtistNfoProvider)));
|
||||||
|
|
||||||
list.AddRange(GetAssembliesWithPartsInternal().Select(i => new Tuple<Assembly, string>(i, null)));
|
list.AddRange(GetAssembliesWithPartsInternal().Select(i => new Tuple<Assembly, string>(i, null)));
|
||||||
@ -2219,7 +2219,7 @@ namespace Emby.Server.Implementations
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This returns localhost in the case of no external dns, and the hostname if the
|
/// This returns localhost in the case of no external dns, and the hostname if the
|
||||||
/// dns is prefixed with a valid Uri prefix.
|
/// dns is prefixed with a valid Uri prefix.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="externalDns">The external dns prefix to get the hostname of.</param>
|
/// <param name="externalDns">The external dns prefix to get the hostname of.</param>
|
||||||
|
@ -41,7 +41,7 @@ namespace Emby.Server.Implementations.Browser
|
|||||||
}
|
}
|
||||||
catch (NotSupportedException)
|
catch (NotSupportedException)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
@ -902,7 +902,7 @@ namespace Emby.Server.Implementations.Channels
|
|||||||
where T : BaseItem, new()
|
where T : BaseItem, new()
|
||||||
{
|
{
|
||||||
var id = _libraryManager.GetNewItemId(GetIdToHash(idString, channelName), typeof(T));
|
var id = _libraryManager.GetNewItemId(GetIdToHash(idString, channelName), typeof(T));
|
||||||
|
|
||||||
T item = null;
|
T item = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -70,8 +70,8 @@ namespace Emby.Server.Implementations.Channels
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return new[] {
|
return new[] {
|
||||||
|
|
||||||
// Every so often
|
// Every so often
|
||||||
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
|
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
|
||||||
};
|
};
|
||||||
|
@ -4038,7 +4038,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
|
|
||||||
if (query.PersonIds.Length > 0)
|
if (query.PersonIds.Length > 0)
|
||||||
{
|
{
|
||||||
// TODO: Should this query with CleanName ?
|
// TODO: Should this query with CleanName ?
|
||||||
|
|
||||||
var clauses = new List<string>();
|
var clauses = new List<string>();
|
||||||
var index = 0;
|
var index = 0;
|
||||||
@ -5399,7 +5399,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||||||
|
|
||||||
var itemIdBlob = itemId.ToGuidBlob();
|
var itemIdBlob = itemId.ToGuidBlob();
|
||||||
|
|
||||||
// First delete
|
// First delete
|
||||||
deleteAncestorsStatement.Reset();
|
deleteAncestorsStatement.Reset();
|
||||||
deleteAncestorsStatement.TryBind("@ItemId", itemIdBlob);
|
deleteAncestorsStatement.TryBind("@ItemId", itemIdBlob);
|
||||||
deleteAncestorsStatement.MoveNext();
|
deleteAncestorsStatement.MoveNext();
|
||||||
@ -5927,7 +5927,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||||||
|
|
||||||
var guidBlob = itemId.ToGuidBlob();
|
var guidBlob = itemId.ToGuidBlob();
|
||||||
|
|
||||||
// First delete
|
// First delete
|
||||||
db.Execute("delete from ItemValues where ItemId=@Id", guidBlob);
|
db.Execute("delete from ItemValues where ItemId=@Id", guidBlob);
|
||||||
|
|
||||||
InsertItemValues(guidBlob, values, db);
|
InsertItemValues(guidBlob, values, db);
|
||||||
|
@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.Devices
|
|||||||
HasUser = true
|
HasUser = true
|
||||||
|
|
||||||
}).Items;
|
}).Items;
|
||||||
|
|
||||||
// TODO: DeviceQuery doesn't seem to be used from client. Not even Swagger.
|
// TODO: DeviceQuery doesn't seem to be used from client. Not even Swagger.
|
||||||
if (query.SupportsSync.HasValue)
|
if (query.SupportsSync.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -471,7 +471,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||||||
LibraryUpdateTimer.Dispose();
|
LibraryUpdateTimer.Dispose();
|
||||||
LibraryUpdateTimer = null;
|
LibraryUpdateTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_libraryManager.ItemAdded -= libraryManager_ItemAdded;
|
_libraryManager.ItemAdded -= libraryManager_ItemAdded;
|
||||||
_libraryManager.ItemUpdated -= libraryManager_ItemUpdated;
|
_libraryManager.ItemUpdated -= libraryManager_ItemUpdated;
|
||||||
_libraryManager.ItemRemoved -= libraryManager_ItemRemoved;
|
_libraryManager.ItemRemoved -= libraryManager_ItemRemoved;
|
||||||
|
@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.FFMpeg
|
|||||||
{
|
{
|
||||||
var encoderFilename = Path.GetFileName(info.EncoderPath);
|
var encoderFilename = Path.GetFileName(info.EncoderPath);
|
||||||
var probeFilename = Path.GetFileName(info.ProbePath);
|
var probeFilename = Path.GetFileName(info.ProbePath);
|
||||||
|
|
||||||
foreach (var directory in _fileSystem.GetDirectoryPaths(rootEncoderPath)
|
foreach (var directory in _fileSystem.GetDirectoryPaths(rootEncoderPath)
|
||||||
.ToList())
|
.ToList())
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string[] SkipLogExtensions = new string[]
|
private string[] SkipLogExtensions = new string[]
|
||||||
{
|
{
|
||||||
".js",
|
".js",
|
||||||
".html",
|
".html",
|
||||||
|
@ -103,7 +103,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies the request filters. Returns whether or not the request has been handled
|
/// Applies the request filters. Returns whether or not the request has been handled
|
||||||
/// and no more processing should be done.
|
/// and no more processing should be done.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
@ -265,7 +265,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the optimized result for the IRequestContext.
|
/// Returns the optimized result for the IRequestContext.
|
||||||
/// Does not use or store results in any cache.
|
/// Does not use or store results in any cache.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
|
@ -33,7 +33,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The web socket connecting.</value>
|
/// <value>The web socket connecting.</value>
|
||||||
Action<WebSocketConnectingEventArgs> WebSocketConnecting { get; set; }
|
Action<WebSocketConnectingEventArgs> WebSocketConnecting { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Starts this instance.
|
/// Starts this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -115,7 +115,7 @@ namespace Emby.Server.Implementations.HttpServer.Security
|
|||||||
{
|
{
|
||||||
info.Device = tokenInfo.DeviceName;
|
info.Device = tokenInfo.DeviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!string.Equals(info.Device, tokenInfo.DeviceName, StringComparison.OrdinalIgnoreCase))
|
else if (!string.Equals(info.Device, tokenInfo.DeviceName, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
if (allowTokenInfoUpdate)
|
if (allowTokenInfoUpdate)
|
||||||
|
@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.IO
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
// For now swallow and log.
|
// For now swallow and log.
|
||||||
// Research item: If an IOException occurs, the item may be in a disconnected state (media unavailable)
|
// Research item: If an IOException occurs, the item may be in a disconnected state (media unavailable)
|
||||||
// Should we remove it from it's parent?
|
// Should we remove it from it's parent?
|
||||||
Logger.LogError(ex, "Error refreshing {name}", item.Name);
|
Logger.LogError(ex, "Error refreshing {name}", item.Name);
|
||||||
|
@ -159,7 +159,7 @@ namespace Emby.Server.Implementations.IO
|
|||||||
var firstChar = filePath[0];
|
var firstChar = filePath[0];
|
||||||
if (firstChar == '/')
|
if (firstChar == '/')
|
||||||
{
|
{
|
||||||
// For this we don't really know.
|
// For this we don't really know.
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
if (firstChar == '\\') //relative path
|
if (firstChar == '\\') //relative path
|
||||||
|
@ -818,7 +818,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
public BaseItem FindByPath(string path, bool? isFolder)
|
public BaseItem FindByPath(string path, bool? isFolder)
|
||||||
{
|
{
|
||||||
// If this returns multiple items it could be tricky figuring out which one is correct.
|
// If this returns multiple items it could be tricky figuring out which one is correct.
|
||||||
// In most cases, the newest one will be and the others obsolete but not yet cleaned up
|
// In most cases, the newest one will be and the others obsolete but not yet cleaned up
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
@ -1699,7 +1699,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Try to resolve the path into a video
|
// Try to resolve the path into a video
|
||||||
video = ResolvePath(_fileSystem.GetFileSystemInfo(info.Path)) as Video;
|
video = ResolvePath(_fileSystem.GetFileSystemInfo(info.Path)) as Video;
|
||||||
|
|
||||||
if (video == null)
|
if (video == null)
|
||||||
|
@ -231,7 +231,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
|||||||
}
|
}
|
||||||
|
|
||||||
var firstMedia = resolvedItem.Files.First();
|
var firstMedia = resolvedItem.Files.First();
|
||||||
|
|
||||||
var libraryItem = new T
|
var libraryItem = new T
|
||||||
{
|
{
|
||||||
Path = firstMedia.Path,
|
Path = firstMedia.Path,
|
||||||
|
@ -42,7 +42,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
|||||||
{
|
{
|
||||||
// Behind special folder resolver
|
// Behind special folder resolver
|
||||||
return ResolverPriority.Second;
|
return ResolverPriority.Second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -41,7 +41,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
|||||||
{
|
{
|
||||||
// Behind special folder resolver
|
// Behind special folder resolver
|
||||||
return ResolverPriority.Second;
|
return ResolverPriority.Second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
where TVideoType : Video, new()
|
where TVideoType : Video, new()
|
||||||
{
|
{
|
||||||
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
|
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
|
||||||
|
|
||||||
// If the path is a file check for a matching extensions
|
// If the path is a file check for a matching extensions
|
||||||
var parser = new Emby.Naming.Video.VideoResolver(namingOptions);
|
var parser = new Emby.Naming.Video.VideoResolver(namingOptions);
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
|
|
||||||
if (video != null)
|
if (video != null)
|
||||||
{
|
{
|
||||||
video.Name = parseName ?
|
video.Name = parseName ?
|
||||||
videoInfo.Name :
|
videoInfo.Name :
|
||||||
Path.GetFileName(args.Path);
|
Path.GetFileName(args.Path);
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
};
|
};
|
||||||
|
|
||||||
SetVideoType(video, videoInfo);
|
SetVideoType(video, videoInfo);
|
||||||
|
|
||||||
video.Name = parseName ?
|
video.Name = parseName ?
|
||||||
videoInfo.Name :
|
videoInfo.Name :
|
||||||
Path.GetFileNameWithoutExtension(args.Path);
|
Path.GetFileNameWithoutExtension(args.Path);
|
||||||
@ -281,7 +281,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||||||
{
|
{
|
||||||
return string.Equals(name, "video_ts.ifo", StringComparison.OrdinalIgnoreCase);
|
return string.Equals(name, "video_ts.ifo", StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether [is blu ray directory] [the specified directory name].
|
/// Determines whether [is blu ray directory] [the specified directory name].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -8,14 +8,14 @@ using MediaBrowser.Model.Entities;
|
|||||||
namespace Emby.Server.Implementations.Library.Resolvers.Books
|
namespace Emby.Server.Implementations.Library.Resolvers.Books
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BookResolver : MediaBrowser.Controller.Resolvers.ItemResolver<Book>
|
public class BookResolver : MediaBrowser.Controller.Resolvers.ItemResolver<Book>
|
||||||
{
|
{
|
||||||
private readonly string[] _validExtensions = { ".pdf", ".epub", ".mobi", ".cbr", ".cbz", ".azw3" };
|
private readonly string[] _validExtensions = { ".pdf", ".epub", ".mobi", ".cbr", ".cbz", ".azw3" };
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args"></param>
|
/// <param name="args"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args"></param>
|
/// <param name="args"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
// Give plugins a chance to catch iso's first
|
// Give plugins a chance to catch iso's first
|
||||||
// Also since we have to loop through child files looking for videos,
|
// Also since we have to loop through child files looking for videos,
|
||||||
// see if we can avoid some of that by letting other resolvers claim folders first
|
// see if we can avoid some of that by letting other resolvers claim folders first
|
||||||
// Also run after series resolver
|
// Also run after series resolver
|
||||||
return ResolverPriority.Third;
|
return ResolverPriority.Third;
|
||||||
|
@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
}
|
}
|
||||||
|
|
||||||
var season = parent as Season;
|
var season = parent as Season;
|
||||||
// Just in case the user decided to nest episodes.
|
// Just in case the user decided to nest episodes.
|
||||||
// Not officially supported but in some cases we can handle it.
|
// Not officially supported but in some cases we can handle it.
|
||||||
if (season == null)
|
if (season == null)
|
||||||
{
|
{
|
||||||
@ -36,8 +36,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||||||
|
|
||||||
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
|
// If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
|
||||||
// Also handle flat tv folders
|
// Also handle flat tv folders
|
||||||
if (season != null ||
|
if (season != null ||
|
||||||
string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||
|
string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||
|
||||||
args.HasParent<Series>())
|
args.HasParent<Series>())
|
||||||
{
|
{
|
||||||
var episode = ResolveVideo<Episode>(args, false);
|
var episode = ResolveVideo<Episode>(args, false);
|
||||||
|
@ -282,7 +282,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
|
|
||||||
if (includeItemTypes.Length == 0)
|
if (includeItemTypes.Length == 0)
|
||||||
{
|
{
|
||||||
// Handle situations with the grouping setting, e.g. movies showing up in tv, etc.
|
// Handle situations with the grouping setting, e.g. movies showing up in tv, etc.
|
||||||
// Thanks to mixed content libraries included in the UserView
|
// Thanks to mixed content libraries included in the UserView
|
||||||
var hasCollectionType = parents.OfType<UserView>().ToArray();
|
var hasCollectionType = parents.OfType<UserView>().ToArray();
|
||||||
if (hasCollectionType.Length > 0)
|
if (hasCollectionType.Length > 0)
|
||||||
|
@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name);
|
_logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name);
|
||||||
|
|
||||||
_libraryManager.DeleteItem(item, new DeleteOptions
|
_libraryManager.DeleteItem(item, new DeleteOptions
|
||||||
|
@ -1055,7 +1055,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
{
|
{
|
||||||
_logger.LogInformation("Streaming Channel " + channelId);
|
_logger.LogInformation("Streaming Channel " + channelId);
|
||||||
|
|
||||||
var result = string.IsNullOrEmpty(streamId) ?
|
var result = string.IsNullOrEmpty(streamId) ?
|
||||||
null :
|
null :
|
||||||
currentLiveStreams.FirstOrDefault(i => string.Equals(i.OriginalStreamId, streamId, StringComparison.OrdinalIgnoreCase));
|
currentLiveStreams.FirstOrDefault(i => string.Equals(i.OriginalStreamId, streamId, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
@ -214,13 +214,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||||||
|
|
||||||
var outputParam = string.Empty;
|
var outputParam = string.Empty;
|
||||||
|
|
||||||
var commandLineArgs = string.Format("-i \"{0}\"{5} {2} -map_metadata -1 -threads 0 {3}{4}{6} -y \"{1}\"",
|
var commandLineArgs = string.Format("-i \"{0}\"{5} {2} -map_metadata -1 -threads 0 {3}{4}{6} -y \"{1}\"",
|
||||||
inputTempFile,
|
inputTempFile,
|
||||||
targetFile,
|
targetFile,
|
||||||
videoArgs,
|
videoArgs,
|
||||||
GetAudioArgs(mediaSource),
|
GetAudioArgs(mediaSource),
|
||||||
subtitleArgs,
|
subtitleArgs,
|
||||||
durationParam,
|
durationParam,
|
||||||
outputParam);
|
outputParam);
|
||||||
|
|
||||||
return inputModifier + " " + commandLineArgs;
|
return inputModifier + " " + commandLineArgs;
|
||||||
|
@ -1993,7 +1993,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||||||
Name = program.Name,
|
Name = program.Name,
|
||||||
OfficialRating = program.OfficialRating
|
OfficialRating = program.OfficialRating
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service == null)
|
if (service == null)
|
||||||
{
|
{
|
||||||
|
@ -48,8 +48,8 @@ namespace Emby.Server.Implementations.LiveTv
|
|||||||
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return new[] {
|
return new[] {
|
||||||
|
|
||||||
// Every so often
|
// Every so often
|
||||||
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
|
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
|
||||||
};
|
};
|
||||||
|
@ -275,7 +275,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||||||
for (int i = 0; i < model.TunerCount; ++i)
|
for (int i = 0; i < model.TunerCount; ++i)
|
||||||
{
|
{
|
||||||
var name = String.Format("Tuner {0}", i + 1);
|
var name = String.Format("Tuner {0}", i + 1);
|
||||||
var currentChannel = "none"; /// @todo Get current channel and map back to Station Id
|
var currentChannel = "none"; /// @todo Get current channel and map back to Station Id
|
||||||
var isAvailable = await manager.CheckTunerAvailability(ipInfo, i, cancellationToken).ConfigureAwait(false);
|
var isAvailable = await manager.CheckTunerAvailability(ipInfo, i, cancellationToken).ConfigureAwait(false);
|
||||||
LiveTvTunerStatus status = isAvailable ? LiveTvTunerStatus.Available : LiveTvTunerStatus.LiveTv;
|
LiveTvTunerStatus status = isAvailable ? LiveTvTunerStatus.Available : LiveTvTunerStatus.LiveTv;
|
||||||
tuners.Add(new LiveTvTunerInfo
|
tuners.Add(new LiveTvTunerInfo
|
||||||
|
@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Localization
|
|||||||
catch (ArgumentException)
|
catch (ArgumentException)
|
||||||
{
|
{
|
||||||
// will throw if input contains invalid unicode chars
|
// will throw if input contains invalid unicode chars
|
||||||
// https://mnaoumov.wordpress.com/2014/06/14/stripping-invalid-characters-from-utf-16-strings/
|
// https://mnaoumov.wordpress.com/2014/06/14/stripping-invalid-characters-from-utf-16-strings/
|
||||||
text = StripInvalidUnicodeCharacters(text);
|
text = StripInvalidUnicodeCharacters(text);
|
||||||
return Normalize(text, form, false);
|
return Normalize(text, form, false);
|
||||||
}
|
}
|
||||||
|
@ -122,28 +122,28 @@ namespace System.Net
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// Reverse a Positive BigInteger ONLY
|
/// Reverse a Positive BigInteger ONLY
|
||||||
/// Bitwise ~ operator
|
/// Bitwise ~ operator
|
||||||
///
|
///
|
||||||
/// Input : FF FF FF FF
|
/// Input : FF FF FF FF
|
||||||
/// Width : 4
|
/// Width : 4
|
||||||
/// Result : 00 00 00 00
|
/// Result : 00 00 00 00
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// Input : 00 00 00 00
|
/// Input : 00 00 00 00
|
||||||
/// Width : 4
|
/// Width : 4
|
||||||
/// Result : FF FF FF FF
|
/// Result : FF FF FF FF
|
||||||
///
|
///
|
||||||
/// Input : FF FF FF FF
|
/// Input : FF FF FF FF
|
||||||
/// Width : 8
|
/// Width : 8
|
||||||
/// Result : FF FF FF FF 00 00 00 00
|
/// Result : FF FF FF FF 00 00 00 00
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// Input : 00 00 00 00
|
/// Input : 00 00 00 00
|
||||||
/// Width : 8
|
/// Width : 8
|
||||||
/// Result : FF FF FF FF FF FF FF FF
|
/// Result : FF FF FF FF FF FF FF FF
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <param name="width"></param>
|
/// <param name="width"></param>
|
||||||
|
@ -3,7 +3,7 @@ using System.Reflection;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("Emby.Server.Implementations")]
|
[assembly: AssemblyTitle("Emby.Server.Implementations")]
|
||||||
@ -19,10 +19,10 @@ using System.Runtime.InteropServices;
|
|||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
@ -35,8 +35,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return new[]
|
return new[]
|
||||||
{
|
{
|
||||||
// Every so often
|
// Every so often
|
||||||
new TaskTriggerInfo
|
new TaskTriggerInfo
|
||||||
{
|
{
|
||||||
|
@ -36,8 +36,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||||||
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return new[] {
|
return new[] {
|
||||||
|
|
||||||
// Every so often
|
// Every so often
|
||||||
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(12).Ticks}
|
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(12).Ticks}
|
||||||
};
|
};
|
||||||
|
@ -42,8 +42,8 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return new[] {
|
return new[] {
|
||||||
|
|
||||||
// Every so often
|
// Every so often
|
||||||
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
|
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
|
||||||
};
|
};
|
||||||
|
@ -38,8 +38,8 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
|||||||
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
||||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||||
{
|
{
|
||||||
return new[] {
|
return new[] {
|
||||||
|
|
||||||
// Every so often
|
// Every so often
|
||||||
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
|
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
|
||||||
};
|
};
|
||||||
|
@ -171,7 +171,7 @@ namespace Emby.Server.Implementations.Security
|
|||||||
//build our array
|
//build our array
|
||||||
var lines = new List<string>
|
var lines = new List<string>
|
||||||
{
|
{
|
||||||
RegKey,
|
RegKey,
|
||||||
|
|
||||||
// Legacy key
|
// Legacy key
|
||||||
string.Empty
|
string.Empty
|
||||||
|
@ -21,7 +21,7 @@ namespace Emby.Server.Implementations.Services
|
|||||||
return deserializer(requestType, httpReq.InputStream);
|
return deserializer(requestType, httpReq.InputStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Task.FromResult(host.CreateInstance(requestType));
|
return Task.FromResult(host.CreateInstance(requestType));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RestPath FindMatchingRestPath(string httpMethod, string pathInfo, out string contentType)
|
public static RestPath FindMatchingRestPath(string httpMethod, string pathInfo, out string contentType)
|
||||||
|
@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.Services
|
|||||||
public int PathComponentsCount { get; set; }
|
public int PathComponentsCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The total number of segments after subparts have been exploded ('.')
|
/// The total number of segments after subparts have been exploded ('.')
|
||||||
/// e.g. /path/to/here.ext == 4
|
/// e.g. /path/to/here.ext == 4
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TotalComponentsCount { get; set; }
|
public int TotalComponentsCount { get; set; }
|
||||||
|
@ -5,7 +5,7 @@ namespace Emby.Server.Implementations.Services
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Donated by Ivan Korneliuk from his post:
|
/// Donated by Ivan Korneliuk from his post:
|
||||||
/// http://korneliuk.blogspot.com/2012/08/servicestack-reusing-dtos.html
|
/// http://korneliuk.blogspot.com/2012/08/servicestack-reusing-dtos.html
|
||||||
///
|
///
|
||||||
/// Modified to only allow using routes matching the supplied HTTP Verb
|
/// Modified to only allow using routes matching the supplied HTTP Verb
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class UrlExtensions
|
public static class UrlExtensions
|
||||||
|
@ -28,7 +28,7 @@ namespace Emby.Server.Implementations.Sorting
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user data repository.</value>
|
/// <value>The user data repository.</value>
|
||||||
public IUserDataManager UserDataRepository { get; set; }
|
public IUserDataManager UserDataRepository { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified x.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Sorting
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user data repository.</value>
|
/// <value>The user data repository.</value>
|
||||||
public IUserDataManager UserDataRepository { get; set; }
|
public IUserDataManager UserDataRepository { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the user manager.
|
/// Gets or sets the user manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -32,7 +32,7 @@ namespace Emby.Server.Implementations.Sorting
|
|||||||
{
|
{
|
||||||
return x.PremiereDate.Value;
|
return x.PremiereDate.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x.ProductionYear.HasValue)
|
if (x.ProductionYear.HasValue)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -18,7 +18,7 @@ namespace NLangDetect.Core.Extensions
|
|||||||
if (end < 0) throw new ArgumentOutOfRangeException("end", "Argument must not be negative.");
|
if (end < 0) throw new ArgumentOutOfRangeException("end", "Argument must not be negative.");
|
||||||
if (end > s.Length) throw new ArgumentOutOfRangeException("end", "Argument must not be greater than the input string's length.");
|
if (end > s.Length) throw new ArgumentOutOfRangeException("end", "Argument must not be greater than the input string's length.");
|
||||||
if (start > end) throw new ArgumentOutOfRangeException("start", "Argument must not be greater than the 'end' argument.");
|
if (start > end) throw new ArgumentOutOfRangeException("start", "Argument must not be greater than the 'end' argument.");
|
||||||
|
|
||||||
return s.Substring(start, end - start);
|
return s.Substring(start, end - start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
namespace Emby.Server.Implementations.TextEncoding
|
namespace Emby.Server.Implementations.TextEncoding
|
||||||
{
|
{
|
||||||
// Copyright 2015-2016 Jonathan Bennett <jon@autoitscript.com>
|
// Copyright 2015-2016 Jonathan Bennett <jon@autoitscript.com>
|
||||||
//
|
//
|
||||||
// https://www.autoitscript.com
|
// https://www.autoitscript.com
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@ -166,7 +166,7 @@
|
|||||||
return encoding;
|
return encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now try UTF16
|
// Now try UTF16
|
||||||
encoding = CheckUtf16NewlineChars(buffer, size);
|
encoding = CheckUtf16NewlineChars(buffer, size);
|
||||||
if (encoding != CharacterEncoding.None)
|
if (encoding != CharacterEncoding.None)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ using System.IO;
|
|||||||
namespace UniversalDetector
|
namespace UniversalDetector
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default implementation of charset detection interface.
|
/// Default implementation of charset detection interface.
|
||||||
/// The detector can be fed by a System.IO.Stream:
|
/// The detector can be fed by a System.IO.Stream:
|
||||||
/// <example>
|
/// <example>
|
||||||
/// <code>
|
/// <code>
|
||||||
@ -52,9 +52,9 @@ namespace UniversalDetector
|
|||||||
/// Console.WriteLine("{0}, {1}", cdet.Charset, cdet.Confidence);
|
/// Console.WriteLine("{0}, {1}", cdet.Charset, cdet.Confidence);
|
||||||
/// </code>
|
/// </code>
|
||||||
/// </example>
|
/// </example>
|
||||||
///
|
///
|
||||||
/// or by a byte a array:
|
/// or by a byte a array:
|
||||||
///
|
///
|
||||||
/// <example>
|
/// <example>
|
||||||
/// <code>
|
/// <code>
|
||||||
/// byte[] buff = new byte[1024];
|
/// byte[] buff = new byte[1024];
|
||||||
@ -64,23 +64,23 @@ namespace UniversalDetector
|
|||||||
/// cdet.DataEnd();
|
/// cdet.DataEnd();
|
||||||
/// Console.WriteLine("{0}, {1}", cdet.Charset, cdet.Confidence);
|
/// Console.WriteLine("{0}, {1}", cdet.Charset, cdet.Confidence);
|
||||||
/// </code>
|
/// </code>
|
||||||
/// </example>
|
/// </example>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CharsetDetector : Core.UniversalDetector, ICharsetDetector
|
public class CharsetDetector : Core.UniversalDetector, ICharsetDetector
|
||||||
{
|
{
|
||||||
private string charset;
|
private string charset;
|
||||||
|
|
||||||
private float confidence;
|
private float confidence;
|
||||||
|
|
||||||
//public event DetectorFinished Finished;
|
//public event DetectorFinished Finished;
|
||||||
|
|
||||||
public CharsetDetector() : base(FILTER_ALL)
|
public CharsetDetector() : base(FILTER_ALL)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Feed(Stream stream)
|
public void Feed(Stream stream)
|
||||||
{
|
{
|
||||||
byte[] buff = new byte[1024];
|
byte[] buff = new byte[1024];
|
||||||
int read;
|
int read;
|
||||||
while ((read = stream.Read(buff, 0, buff.Length)) > 0 && !done)
|
while ((read = stream.Read(buff, 0, buff.Length)) > 0 && !done)
|
||||||
@ -88,19 +88,19 @@ namespace UniversalDetector
|
|||||||
Feed(buff, 0, read);
|
Feed(buff, 0, read);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsDone()
|
public bool IsDone()
|
||||||
{
|
{
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
this.charset = null;
|
this.charset = null;
|
||||||
this.confidence = 0.0f;
|
this.confidence = 0.0f;
|
||||||
base.Reset();
|
base.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Charset {
|
public string Charset {
|
||||||
get { return charset; }
|
get { return charset; }
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ namespace UniversalDetector
|
|||||||
public float Confidence {
|
public float Confidence {
|
||||||
get { return confidence; }
|
get { return confidence; }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Report(string charset, float confidence)
|
protected override void Report(string charset, float confidence)
|
||||||
{
|
{
|
||||||
this.charset = charset;
|
this.charset = charset;
|
||||||
@ -118,7 +118,7 @@ namespace UniversalDetector
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//public delegate void DetectorFinished(string charset, float confidence);
|
//public delegate void DetectorFinished(string charset, float confidence);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,12 @@ namespace UniversalDetector.Core
|
|||||||
private CodingStateMachine codingSM;
|
private CodingStateMachine codingSM;
|
||||||
private BIG5DistributionAnalyser distributionAnalyser;
|
private BIG5DistributionAnalyser distributionAnalyser;
|
||||||
private byte[] lastChar = new byte[2];
|
private byte[] lastChar = new byte[2];
|
||||||
|
|
||||||
public Big5Prober()
|
public Big5Prober()
|
||||||
{
|
{
|
||||||
this.codingSM = new CodingStateMachine(new BIG5SMModel());
|
this.codingSM = new CodingStateMachine(new BIG5SMModel());
|
||||||
this.distributionAnalyser = new BIG5DistributionAnalyser();
|
this.distributionAnalyser = new BIG5DistributionAnalyser();
|
||||||
this.Reset();
|
this.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ProbingState HandleData(byte[] buf, int offset, int len)
|
public override ProbingState HandleData(byte[] buf, int offset, int len)
|
||||||
@ -73,7 +73,7 @@ namespace UniversalDetector.Core
|
|||||||
lastChar[1] = buf[offset];
|
lastChar[1] = buf[offset];
|
||||||
distributionAnalyser.HandleOneChar(lastChar, 0, charLen);
|
distributionAnalyser.HandleOneChar(lastChar, 0, charLen);
|
||||||
} else {
|
} else {
|
||||||
distributionAnalyser.HandleOneChar(buf, i-1, charLen);
|
distributionAnalyser.HandleOneChar(buf, i-1, charLen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,23 +84,23 @@ namespace UniversalDetector.Core
|
|||||||
state = ProbingState.FoundIt;
|
state = ProbingState.FoundIt;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
codingSM.Reset();
|
codingSM.Reset();
|
||||||
state = ProbingState.Detecting;
|
state = ProbingState.Detecting;
|
||||||
distributionAnalyser.Reset();
|
distributionAnalyser.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetCharsetName()
|
public override string GetCharsetName()
|
||||||
{
|
{
|
||||||
return "Big-5";
|
return "Big-5";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override float GetConfidence()
|
public override float GetConfidence()
|
||||||
{
|
{
|
||||||
return distributionAnalyser.GetConfidence();
|
return distributionAnalyser.GetConfidence();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,15 +43,15 @@ namespace UniversalDetector.Core
|
|||||||
public static int INDEX_SHIFT_4BITS = 3;
|
public static int INDEX_SHIFT_4BITS = 3;
|
||||||
public static int INDEX_SHIFT_8BITS = 2;
|
public static int INDEX_SHIFT_8BITS = 2;
|
||||||
public static int INDEX_SHIFT_16BITS = 1;
|
public static int INDEX_SHIFT_16BITS = 1;
|
||||||
|
|
||||||
public static int SHIFT_MASK_4BITS = 7;
|
public static int SHIFT_MASK_4BITS = 7;
|
||||||
public static int SHIFT_MASK_8BITS = 3;
|
public static int SHIFT_MASK_8BITS = 3;
|
||||||
public static int SHIFT_MASK_16BITS = 1;
|
public static int SHIFT_MASK_16BITS = 1;
|
||||||
|
|
||||||
public static int BIT_SHIFT_4BITS = 2;
|
public static int BIT_SHIFT_4BITS = 2;
|
||||||
public static int BIT_SHIFT_8BITS = 3;
|
public static int BIT_SHIFT_8BITS = 3;
|
||||||
public static int BIT_SHIFT_16BITS = 4;
|
public static int BIT_SHIFT_16BITS = 4;
|
||||||
|
|
||||||
public static int UNIT_MASK_4BITS = 0x0000000F;
|
public static int UNIT_MASK_4BITS = 0x0000000F;
|
||||||
public static int UNIT_MASK_8BITS = 0x000000FF;
|
public static int UNIT_MASK_8BITS = 0x000000FF;
|
||||||
public static int UNIT_MASK_16BITS = 0x0000FFFF;
|
public static int UNIT_MASK_16BITS = 0x0000FFFF;
|
||||||
@ -61,7 +61,7 @@ namespace UniversalDetector.Core
|
|||||||
private int bitShift;
|
private int bitShift;
|
||||||
private int unitMask;
|
private int unitMask;
|
||||||
private int[] data;
|
private int[] data;
|
||||||
|
|
||||||
public BitPackage(int indexShift, int shiftMask,
|
public BitPackage(int indexShift, int shiftMask,
|
||||||
int bitShift, int unitMask, int[] data)
|
int bitShift, int unitMask, int[] data)
|
||||||
{
|
{
|
||||||
@ -71,27 +71,27 @@ namespace UniversalDetector.Core
|
|||||||
this.unitMask = unitMask;
|
this.unitMask = unitMask;
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int Pack16bits(int a, int b)
|
public static int Pack16bits(int a, int b)
|
||||||
{
|
{
|
||||||
return ((b << 16) | a);
|
return ((b << 16) | a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int Pack8bits(int a, int b, int c, int d)
|
public static int Pack8bits(int a, int b, int c, int d)
|
||||||
{
|
{
|
||||||
return Pack16bits((b << 8) | a, (d << 8) | c);
|
return Pack16bits((b << 8) | a, (d << 8) | c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int Pack4bits(int a, int b, int c, int d,
|
public static int Pack4bits(int a, int b, int c, int d,
|
||||||
int e, int f, int g, int h)
|
int e, int f, int g, int h)
|
||||||
{
|
{
|
||||||
return Pack8bits((b << 4) | a, (d << 4) | c,
|
return Pack8bits((b << 4) | a, (d << 4) | c,
|
||||||
(f << 4) | e, (h << 4) | g);
|
(f << 4) | e, (h << 4) | g);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Unpack(int i)
|
public int Unpack(int i)
|
||||||
{
|
{
|
||||||
return (data[i >> indexShift] >>
|
return (data[i >> indexShift] >>
|
||||||
((i & shiftMask) << bitShift)) & unitMask;
|
((i & shiftMask) << bitShift)) & unitMask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Shy Shalom <shooshX@gmail.com>
|
* Shy Shalom <shooshX@gmail.com>
|
||||||
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
|
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
@ -40,10 +40,10 @@ using System.IO;
|
|||||||
|
|
||||||
namespace UniversalDetector.Core
|
namespace UniversalDetector.Core
|
||||||
{
|
{
|
||||||
public enum ProbingState {
|
public enum ProbingState {
|
||||||
Detecting = 0, // no sure answer yet, but caller can ask for confidence
|
Detecting = 0, // no sure answer yet, but caller can ask for confidence
|
||||||
FoundIt = 1, // positive answer
|
FoundIt = 1, // positive answer
|
||||||
NotMe = 2 // negative answer
|
NotMe = 2 // negative answer
|
||||||
};
|
};
|
||||||
|
|
||||||
public abstract class CharsetProber
|
public abstract class CharsetProber
|
||||||
@ -51,16 +51,16 @@ namespace UniversalDetector.Core
|
|||||||
protected const float SHORTCUT_THRESHOLD = 0.95F;
|
protected const float SHORTCUT_THRESHOLD = 0.95F;
|
||||||
|
|
||||||
protected ProbingState state;
|
protected ProbingState state;
|
||||||
|
|
||||||
// ASCII codes
|
// ASCII codes
|
||||||
private const byte SPACE = 0x20;
|
private const byte SPACE = 0x20;
|
||||||
private const byte CAPITAL_A = 0x41;
|
private const byte CAPITAL_A = 0x41;
|
||||||
private const byte CAPITAL_Z = 0x5A;
|
private const byte CAPITAL_Z = 0x5A;
|
||||||
private const byte SMALL_A = 0x61;
|
private const byte SMALL_A = 0x61;
|
||||||
private const byte SMALL_Z = 0x7A;
|
private const byte SMALL_Z = 0x7A;
|
||||||
private const byte LESS_THAN = 0x3C;
|
private const byte LESS_THAN = 0x3C;
|
||||||
private const byte GREATER_THAN = 0x3E;
|
private const byte GREATER_THAN = 0x3E;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Feed data to the prober
|
/// Feed data to the prober
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -71,44 +71,44 @@ namespace UniversalDetector.Core
|
|||||||
/// A <see cref="ProbingState"/>
|
/// A <see cref="ProbingState"/>
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public abstract ProbingState HandleData(byte[] buf, int offset, int len);
|
public abstract ProbingState HandleData(byte[] buf, int offset, int len);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset prober state
|
/// Reset prober state
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Reset();
|
public abstract void Reset();
|
||||||
|
|
||||||
public abstract string GetCharsetName();
|
public abstract string GetCharsetName();
|
||||||
|
|
||||||
public abstract float GetConfidence();
|
public abstract float GetConfidence();
|
||||||
|
|
||||||
public virtual ProbingState GetState()
|
public virtual ProbingState GetState()
|
||||||
{
|
{
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetOption()
|
public virtual void SetOption()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void DumpStatus()
|
public virtual void DumpStatus()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Helper functions used in the Latin1 and Group probers
|
// Helper functions used in the Latin1 and Group probers
|
||||||
//
|
//
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>filtered buffer</returns>
|
/// <returns>filtered buffer</returns>
|
||||||
protected static byte[] FilterWithoutEnglishLetters(byte[] buf, int offset, int len)
|
protected static byte[] FilterWithoutEnglishLetters(byte[] buf, int offset, int len)
|
||||||
{
|
{
|
||||||
byte[] result = null;
|
byte[] result = null;
|
||||||
|
|
||||||
using (MemoryStream ms = new MemoryStream(buf.Length)) {
|
using (MemoryStream ms = new MemoryStream(buf.Length)) {
|
||||||
|
|
||||||
bool meetMSB = false;
|
bool meetMSB = false;
|
||||||
int max = offset + len;
|
int max = offset + len;
|
||||||
int prev = offset;
|
int prev = offset;
|
||||||
@ -140,8 +140,8 @@ namespace UniversalDetector.Core
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Do filtering to reduce load to probers (Remove ASCII symbols,
|
/// Do filtering to reduce load to probers (Remove ASCII symbols,
|
||||||
/// collapse spaces). This filter applies to all scripts which contain
|
/// collapse spaces). This filter applies to all scripts which contain
|
||||||
/// both English characters and upper ASCII characters.
|
/// both English characters and upper ASCII characters.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>a filtered copy of the input buffer</returns>
|
/// <returns>a filtered copy of the input buffer</returns>
|
||||||
@ -150,16 +150,16 @@ namespace UniversalDetector.Core
|
|||||||
byte[] result = null;
|
byte[] result = null;
|
||||||
|
|
||||||
using (MemoryStream ms = new MemoryStream(buf.Length)) {
|
using (MemoryStream ms = new MemoryStream(buf.Length)) {
|
||||||
|
|
||||||
bool inTag = false;
|
bool inTag = false;
|
||||||
int max = offset + len;
|
int max = offset + len;
|
||||||
int prev = offset;
|
int prev = offset;
|
||||||
int cur = offset;
|
int cur = offset;
|
||||||
|
|
||||||
while (cur < max) {
|
while (cur < max) {
|
||||||
|
|
||||||
byte b = buf[cur];
|
byte b = buf[cur];
|
||||||
|
|
||||||
if (b == GREATER_THAN)
|
if (b == GREATER_THAN)
|
||||||
inTag = false;
|
inTag = false;
|
||||||
else if (b == LESS_THAN)
|
else if (b == LESS_THAN)
|
||||||
@ -177,7 +177,7 @@ namespace UniversalDetector.Core
|
|||||||
cur++;
|
cur++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the current segment contains more than just a symbol
|
// If the current segment contains more than just a symbol
|
||||||
// and it is not inside a tag then keep it.
|
// and it is not inside a tag then keep it.
|
||||||
if (!inTag && cur > prev)
|
if (!inTag && cur > prev)
|
||||||
ms.Write(buf, prev, cur - prev);
|
ms.Write(buf, prev, cur - prev);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
|
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
@ -40,47 +40,47 @@ namespace UniversalDetector.Core
|
|||||||
public static class Charsets
|
public static class Charsets
|
||||||
{
|
{
|
||||||
public const string ASCII = "ASCII";
|
public const string ASCII = "ASCII";
|
||||||
|
|
||||||
public const string UTF8 = "UTF-8";
|
public const string UTF8 = "UTF-8";
|
||||||
|
|
||||||
public const string UTF16_LE = "UTF-16LE";
|
public const string UTF16_LE = "UTF-16LE";
|
||||||
|
|
||||||
public const string UTF16_BE = "UTF-16BE";
|
public const string UTF16_BE = "UTF-16BE";
|
||||||
|
|
||||||
public const string UTF32_BE = "UTF-32BE";
|
public const string UTF32_BE = "UTF-32BE";
|
||||||
|
|
||||||
public const string UTF32_LE = "UTF-32LE";
|
public const string UTF32_LE = "UTF-32LE";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unusual BOM (3412 order)
|
/// Unusual BOM (3412 order)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string UCS4_3412 = "X-ISO-10646-UCS-4-3412";
|
public const string UCS4_3412 = "X-ISO-10646-UCS-4-3412";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unusual BOM (2413 order)
|
/// Unusual BOM (2413 order)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string UCS4_2413 = "X-ISO-10646-UCS-4-2413";
|
public const string UCS4_2413 = "X-ISO-10646-UCS-4-2413";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cyrillic (based on bulgarian and russian data)
|
/// Cyrillic (based on bulgarian and russian data)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string WIN1251 = "windows-1251";
|
public const string WIN1251 = "windows-1251";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Latin-1, almost identical to ISO-8859-1
|
/// Latin-1, almost identical to ISO-8859-1
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string WIN1252 = "windows-1252";
|
public const string WIN1252 = "windows-1252";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Greek
|
/// Greek
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string WIN1253 = "windows-1253";
|
public const string WIN1253 = "windows-1253";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logical hebrew (includes ISO-8859-8-I and most of x-mac-hebrew)
|
/// Logical hebrew (includes ISO-8859-8-I and most of x-mac-hebrew)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string WIN1255 = "windows-1255";
|
public const string WIN1255 = "windows-1255";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Traditional chinese
|
/// Traditional chinese
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -89,7 +89,7 @@ namespace UniversalDetector.Core
|
|||||||
public const string EUCKR = "EUC-KR";
|
public const string EUCKR = "EUC-KR";
|
||||||
|
|
||||||
public const string EUCJP = "EUC-JP";
|
public const string EUCJP = "EUC-JP";
|
||||||
|
|
||||||
public const string EUCTW = "EUC-TW";
|
public const string EUCTW = "EUC-TW";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -98,11 +98,11 @@ namespace UniversalDetector.Core
|
|||||||
public const string GB18030 = "gb18030";
|
public const string GB18030 = "gb18030";
|
||||||
|
|
||||||
public const string ISO2022_JP = "ISO-2022-JP";
|
public const string ISO2022_JP = "ISO-2022-JP";
|
||||||
|
|
||||||
public const string ISO2022_CN = "ISO-2022-CN";
|
public const string ISO2022_CN = "ISO-2022-CN";
|
||||||
|
|
||||||
public const string ISO2022_KR = "ISO-2022-KR";
|
public const string ISO2022_KR = "ISO-2022-KR";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Simplified chinese
|
/// Simplified chinese
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -111,15 +111,15 @@ namespace UniversalDetector.Core
|
|||||||
public const string SHIFT_JIS = "Shift-JIS";
|
public const string SHIFT_JIS = "Shift-JIS";
|
||||||
|
|
||||||
public const string MAC_CYRILLIC = "x-mac-cyrillic";
|
public const string MAC_CYRILLIC = "x-mac-cyrillic";
|
||||||
|
|
||||||
public const string KOI8R = "KOI8-R";
|
public const string KOI8R = "KOI8-R";
|
||||||
|
|
||||||
public const string IBM855 = "IBM855";
|
public const string IBM855 = "IBM855";
|
||||||
|
|
||||||
public const string IBM866 = "IBM866";
|
public const string IBM866 = "IBM866";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// East-Europe. Disabled because too similar to windows-1252
|
/// East-Europe. Disabled because too similar to windows-1252
|
||||||
/// (latin-1). Should use tri-grams models to discriminate between
|
/// (latin-1). Should use tri-grams models to discriminate between
|
||||||
/// these two charsets.
|
/// these two charsets.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -141,9 +141,9 @@ namespace UniversalDetector.Core
|
|||||||
public const string ISO8859_8 = "ISO-8859-8";
|
public const string ISO8859_8 = "ISO-8859-8";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Thai. This recognizer is not enabled yet.
|
/// Thai. This recognizer is not enabled yet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string TIS620 = "TIS620";
|
public const string TIS620 = "TIS620";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
* Shy Shalom <shooshX@gmail.com>
|
* Shy Shalom <shooshX@gmail.com>
|
||||||
* Kohei TAKETA <k-tak@void.in> (Java port)
|
* Kohei TAKETA <k-tak@void.in> (Java port)
|
||||||
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
|
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
@ -48,8 +48,8 @@ namespace UniversalDetector.Core
|
|||||||
private SMModel model;
|
private SMModel model;
|
||||||
private int currentCharLen;
|
private int currentCharLen;
|
||||||
private int currentBytePos;
|
private int currentBytePos;
|
||||||
|
|
||||||
public CodingStateMachine(SMModel model)
|
public CodingStateMachine(SMModel model)
|
||||||
{
|
{
|
||||||
this.currentState = SMModel.START;
|
this.currentState = SMModel.START;
|
||||||
this.model = model;
|
this.model = model;
|
||||||
@ -57,34 +57,34 @@ namespace UniversalDetector.Core
|
|||||||
|
|
||||||
public int NextState(byte b)
|
public int NextState(byte b)
|
||||||
{
|
{
|
||||||
// for each byte we get its class, if it is first byte,
|
// for each byte we get its class, if it is first byte,
|
||||||
// we also get byte length
|
// we also get byte length
|
||||||
int byteCls = model.GetClass(b);
|
int byteCls = model.GetClass(b);
|
||||||
if (currentState == SMModel.START) {
|
if (currentState == SMModel.START) {
|
||||||
currentBytePos = 0;
|
currentBytePos = 0;
|
||||||
currentCharLen = model.charLenTable[byteCls];
|
currentCharLen = model.charLenTable[byteCls];
|
||||||
}
|
}
|
||||||
|
|
||||||
// from byte's class and stateTable, we get its next state
|
// from byte's class and stateTable, we get its next state
|
||||||
currentState = model.stateTable.Unpack(
|
currentState = model.stateTable.Unpack(
|
||||||
currentState * model.ClassFactor + byteCls);
|
currentState * model.ClassFactor + byteCls);
|
||||||
currentBytePos++;
|
currentBytePos++;
|
||||||
return currentState;
|
return currentState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
currentState = SMModel.START;
|
currentState = SMModel.START;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CurrentCharLen
|
public int CurrentCharLen
|
||||||
{
|
{
|
||||||
get { return currentCharLen; }
|
get { return currentCharLen; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ModelName
|
public string ModelName
|
||||||
{
|
{
|
||||||
get { return model.Name; }
|
get { return model.Name; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,25 +43,25 @@ namespace UniversalDetector.Core
|
|||||||
private EUCJPContextAnalyser contextAnalyser;
|
private EUCJPContextAnalyser contextAnalyser;
|
||||||
private EUCJPDistributionAnalyser distributionAnalyser;
|
private EUCJPDistributionAnalyser distributionAnalyser;
|
||||||
private byte[] lastChar = new byte[2];
|
private byte[] lastChar = new byte[2];
|
||||||
|
|
||||||
public EUCJPProber()
|
public EUCJPProber()
|
||||||
{
|
{
|
||||||
codingSM = new CodingStateMachine(new EUCJPSMModel());
|
codingSM = new CodingStateMachine(new EUCJPSMModel());
|
||||||
distributionAnalyser = new EUCJPDistributionAnalyser();
|
distributionAnalyser = new EUCJPDistributionAnalyser();
|
||||||
contextAnalyser = new EUCJPContextAnalyser();
|
contextAnalyser = new EUCJPContextAnalyser();
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetCharsetName()
|
public override string GetCharsetName()
|
||||||
{
|
{
|
||||||
return "EUC-JP";
|
return "EUC-JP";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ProbingState HandleData(byte[] buf, int offset, int len)
|
public override ProbingState HandleData(byte[] buf, int offset, int len)
|
||||||
{
|
{
|
||||||
int codingState;
|
int codingState;
|
||||||
int max = offset + len;
|
int max = offset + len;
|
||||||
|
|
||||||
for (int i = offset; i < max; i++) {
|
for (int i = offset; i < max; i++) {
|
||||||
codingState = codingSM.NextState(buf[i]);
|
codingState = codingSM.NextState(buf[i]);
|
||||||
if (codingState == SMModel.ERROR) {
|
if (codingState == SMModel.ERROR) {
|
||||||
@ -83,7 +83,7 @@ namespace UniversalDetector.Core
|
|||||||
distributionAnalyser.HandleOneChar(buf, i-1, charLen);
|
distributionAnalyser.HandleOneChar(buf, i-1, charLen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastChar[0] = buf[max-1];
|
lastChar[0] = buf[max-1];
|
||||||
if (state == ProbingState.Detecting)
|
if (state == ProbingState.Detecting)
|
||||||
if (contextAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
|
if (contextAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
|
||||||
@ -93,18 +93,18 @@ namespace UniversalDetector.Core
|
|||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
codingSM.Reset();
|
codingSM.Reset();
|
||||||
state = ProbingState.Detecting;
|
state = ProbingState.Detecting;
|
||||||
contextAnalyser.Reset();
|
contextAnalyser.Reset();
|
||||||
distributionAnalyser.Reset();
|
distributionAnalyser.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override float GetConfidence()
|
public override float GetConfidence()
|
||||||
{
|
{
|
||||||
float contxtCf = contextAnalyser.GetConfidence();
|
float contxtCf = contextAnalyser.GetConfidence();
|
||||||
float distribCf = distributionAnalyser.GetConfidence();
|
float distribCf = distributionAnalyser.GetConfidence();
|
||||||
return (contxtCf > distribCf ? contxtCf : distribCf);
|
return (contxtCf > distribCf ? contxtCf : distribCf);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,15 +46,15 @@ namespace UniversalDetector.Core
|
|||||||
public EUCKRProber()
|
public EUCKRProber()
|
||||||
{
|
{
|
||||||
codingSM = new CodingStateMachine(new EUCKRSMModel());
|
codingSM = new CodingStateMachine(new EUCKRSMModel());
|
||||||
distributionAnalyser = new EUCKRDistributionAnalyser();
|
distributionAnalyser = new EUCKRDistributionAnalyser();
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetCharsetName()
|
public override string GetCharsetName()
|
||||||
{
|
{
|
||||||
return "EUC-KR";
|
return "EUC-KR";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ProbingState HandleData(byte[] buf, int offset, int len)
|
public override ProbingState HandleData(byte[] buf, int offset, int len)
|
||||||
{
|
{
|
||||||
int codingState;
|
int codingState;
|
||||||
@ -81,12 +81,12 @@ namespace UniversalDetector.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastChar[0] = buf[max-1];
|
lastChar[0] = buf[max-1];
|
||||||
|
|
||||||
if (state == ProbingState.Detecting)
|
if (state == ProbingState.Detecting)
|
||||||
if (distributionAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
|
if (distributionAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
|
||||||
state = ProbingState.FoundIt;
|
state = ProbingState.FoundIt;
|
||||||
return state;
|
return state;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override float GetConfidence()
|
public override float GetConfidence()
|
||||||
@ -96,7 +96,7 @@ namespace UniversalDetector.Core
|
|||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
codingSM.Reset();
|
codingSM.Reset();
|
||||||
state = ProbingState.Detecting;
|
state = ProbingState.Detecting;
|
||||||
distributionAnalyser.Reset();
|
distributionAnalyser.Reset();
|
||||||
//mContextAnalyser.Reset();
|
//mContextAnalyser.Reset();
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Shy Shalom <shooshX@gmail.com>
|
* Shy Shalom <shooshX@gmail.com>
|
||||||
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
|
* Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
@ -50,7 +50,7 @@ namespace UniversalDetector.Core
|
|||||||
this.distributionAnalyser = new EUCTWDistributionAnalyser();
|
this.distributionAnalyser = new EUCTWDistributionAnalyser();
|
||||||
this.Reset();
|
this.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ProbingState HandleData(byte[] buf, int offset, int len)
|
public override ProbingState HandleData(byte[] buf, int offset, int len)
|
||||||
{
|
{
|
||||||
int codingState;
|
int codingState;
|
||||||
@ -77,21 +77,21 @@ namespace UniversalDetector.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastChar[0] = buf[max-1];
|
lastChar[0] = buf[max-1];
|
||||||
|
|
||||||
if (state == ProbingState.Detecting)
|
if (state == ProbingState.Detecting)
|
||||||
if (distributionAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
|
if (distributionAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
|
||||||
state = ProbingState.FoundIt;
|
state = ProbingState.FoundIt;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetCharsetName()
|
public override string GetCharsetName()
|
||||||
{
|
{
|
||||||
return "x-euc-tw";
|
return "x-euc-tw";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
codingSM.Reset();
|
codingSM.Reset();
|
||||||
state = ProbingState.Detecting;
|
state = ProbingState.Detecting;
|
||||||
distributionAnalyser.Reset();
|
distributionAnalyser.Reset();
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ namespace UniversalDetector.Core
|
|||||||
{
|
{
|
||||||
return distributionAnalyser.GetConfidence();
|
return distributionAnalyser.GetConfidence();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user