From 3509a401c8e3d91854b4fda4e4d7700b0aacefa5 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 17 Sep 2014 21:26:23 -0400 Subject: [PATCH] add subtitle profiles to dlna profile editor --- .../Playback/BaseStreamingService.cs | 6 -- .../Localization/JavaScript/javascript.json | 62 ++++++++++++++++++- .../Localization/Server/server.json | 16 ++++- .../FFMpeg/FFMpegDownloadInfo.cs | 43 +++++++------ .../FFMpeg/FFMpegDownloader.cs | 18 +++++- .../MediaBrowser.WebDashboard.csproj | 6 -- 6 files changed, 115 insertions(+), 36 deletions(-) diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index f1b84875d1..98b4132f17 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -925,11 +925,6 @@ namespace MediaBrowser.Api.Playback /// ffmpeg was not found at + MediaEncoder.EncoderPath protected async Task StartFfMpeg(StreamState state, string outputPath, CancellationTokenSource cancellationTokenSource) { - if (!File.Exists(MediaEncoder.EncoderPath)) - { - throw new InvalidOperationException("ffmpeg was not found at " + MediaEncoder.EncoderPath); - } - Directory.CreateDirectory(Path.GetDirectoryName(outputPath)); await AcquireResources(state, cancellationTokenSource).ConfigureAwait(false); @@ -955,7 +950,6 @@ namespace MediaBrowser.Api.Playback RedirectStandardInput = true, FileName = MediaEncoder.EncoderPath, - WorkingDirectory = Path.GetDirectoryName(MediaEncoder.EncoderPath), Arguments = commandLineArgs, WindowStyle = ProcessWindowStyle.Hidden, diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json index 3961ddd4fa..0f7ef7ec96 100644 --- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json +++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json @@ -508,5 +508,65 @@ "ValueStudios": "Studios: {0}", "ValueSpecialEpisodeName": "Special - {0}", "LabelLimit": "Limit:", - "ValueLinks": "Links: {0}" + "ValueLinks": "Links: {0}", + "HeaderPeople": "People", + "HeaderCastAndCrew": "Cast & Crew", + "ValueArtist": "Artist: {0}", + "ValueArtists": "Artists: {0}", + "HeaderTags": "Tags", + "MediaInfoCameraMake": "Camera make", + "MediaInfoCameraModel": "Camera model", + "MediaInfoAltitude": "Altitude", + "MediaInfoAperture": "Aperture", + "MediaInfoExposureTime": "Exposure time", + "MediaInfoFocalLength": "Focal length", + "MediaInfoOrientation": "Orientation", + "MediaInfoIsoSpeedRating": "Iso speed rating", + "MediaInfoLatitude": "Latitude", + "MediaInfoLongitude": "Longitude", + "MediaInfoShutterSpeed": "Shutter speed", + "MediaInfoSoftware": "Software", + "HeaderIfYouLikeCheckTheseOut": "If you like {0}, check these out...", + "HeaderPlotKeywords": "Plot Keywords", + "HeaderMovies": "Movies", + "HeaderSeries": "Series", + "HeaderAlbums": "Albums", + "HeaderGames": "Games", + "HeaderBooks": "Books", + "HeaderEpisodes": "Episodes", + "HeaderSeasons": "Seasons", + "HeaderTracks": "Tracks", + "HeaderItems": "Items", + "HeaderOtherItems": "Other Items", + "ButtonFullReview": "Full review", + "ValueAsRole": "as {0}", + "ValueGuestStar": "Guest star", + "MediaInfoSize": "Size", + "MediaInfoPath": "Path", + "MediaInfoFormat": "Format", + "MediaInfoContainer": "Container", + "MediaInfoDefault": "Default", + "MediaInfoForced": "Forced", + "MediaInfoExternal": "External", + "MediaInfoTimestamp": "Timestamp", + "MediaInfoPixelFormat": "Pixel format", + "MediaInfoBitDepth": "Bit Depth", + "MediaInfoSampleRate": "Sample rate", + "MediaInfoBitrate": "Bitrate", + "MediaInfoChannels": "Channels", + "MediaInfoLayout": "Layout", + "MediaInfoLanguage": "Language", + "MediaInfoCodec": "Codec", + "MediaInfoProfile": "Profile", + "MediaInfoLevel": "Level", + "MediaInfoAspectRatio": "Aspect ratio", + "MediaInfoResolution": "Resolution", + "MediaInfoAnamorphic": "Anamorphic", + "MediaInfoInterlaced": "Interlaced", + "MediaInfoFramerate": "Framerate", + "MediaInfoStreamTypeAudio": "Audio", + "MediaInfoStreamTypeData": "Data", + "MediaInfoStreamTypeVideo": "Video", + "MediaInfoStreamTypeSubtitle": "Subtitle", + "MediaInfoStreamTypeEmbeddedImage": "Embedded Image" } diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 28feeef06a..da7e412931 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -1166,5 +1166,17 @@ "LabelConnectUserNameHelp": "Connect this user to a Media Browser account to enable easy sign-in access from any app without having to know the server ip address.", "ButtonLearnMoreAboutMediaBrowserConnect": "Learn more about Media Browser Connect", "LabelExternalPlayers": "External players:", - "LabelExternalPlayersHelp": "Display buttons to play content in external players. This is only available on devices that support url schemes, generally Android and iOS. With external players there is generally no support for remote control or resuming." -} + "LabelExternalPlayersHelp": "Display buttons to play content in external players. This is only available on devices that support url schemes, generally Android and iOS. With external players there is generally no support for remote control or resuming.", + "HeaderSubtitleProfile": "Subtitle Profile", + "HeaderSubtitleProfiles": "Subtitle Profiles", + "HeaderSubtitleProfilesHelp": "Subtitle profiles describe the subtitle formats supported by the device.", + "LabelFormat": "Format:", + "LabelMethod": "Method:", + "LabelDidlMode": "Didl mode:", + "OptionCaptionInfoExSamsung": "CaptionInfoEx (Samsung)", + "OptionResElement": "res element", + "OptionEmbedSubtitles": "Embed within container", + "OptionExternallyDownloaded": "External download", + "OptionHlsSegmentedSubtitles": "Hls segmented subtitles", + "LabelSubtitleFormatHelp": "Example: srt" +} \ No newline at end of file diff --git a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs index 541251c2b2..dc20653d74 100644 --- a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs +++ b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloadInfo.cs @@ -16,16 +16,14 @@ namespace MediaBrowser.ServerApplication.FFMpeg // OS X builds: http://ffmpegmac.net/ // OS X x64: http://www.evermeet.cx/ffmpeg/ - public static string Version = ffmpegOsType("Version"); + public static string Version = getFfmpegValue("Version"); - public static string[] FfMpegUrls = GetDownloadUrls(); + public static string FFMpegFilename = getFfmpegValue("FFMpegFilename"); + public static string FFProbeFilename = getFfmpegValue("FFProbeFilename"); - public static string FFMpegFilename = ffmpegOsType("FFMpegFilename"); - public static string FFProbeFilename = ffmpegOsType("FFProbeFilename"); + public static string ArchiveType = getFfmpegValue("ArchiveType"); - public static string ArchiveType = ffmpegOsType("ArchiveType"); - - private static string ffmpegOsType(string arg) + private static string getFfmpegValue(string arg) { OperatingSystem os = Environment.OSVersion; PlatformID pid = os.Platform; @@ -61,7 +59,6 @@ namespace MediaBrowser.ServerApplication.FFMpeg case "ArchiveType": return "gz"; } - break; } if (PlatformDetection.IsX86) { @@ -76,10 +73,9 @@ namespace MediaBrowser.ServerApplication.FFMpeg case "ArchiveType": return "gz"; } - break; } } - if (PlatformDetection.IsLinux) + else if (PlatformDetection.IsLinux) { if (PlatformDetection.IsX86) { @@ -94,8 +90,8 @@ namespace MediaBrowser.ServerApplication.FFMpeg case "ArchiveType": return "gz"; } - break; } + else if (PlatformDetection.IsX86_64) { // Linux on x86 or x86_64 @@ -110,16 +106,28 @@ namespace MediaBrowser.ServerApplication.FFMpeg case "ArchiveType": return "gz"; } - break; } } - // Unsupported Unix platform - return ""; + + break; + } + + switch (arg) + { + case "Version": + return "path"; + case "FFMpegFilename": + return "ffmpeg"; + case "FFProbeFilename": + return "ffprobe"; + case "ArchiveType": + return ""; + default: + return string.Empty; } - return ""; } - private static string[] GetDownloadUrls() + public static string[] GetDownloadUrls() { var pid = Environment.OSVersion.Platform; @@ -210,8 +218,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg var sysName = uname.sysname ?? string.Empty; IsMac = string.Equals(sysName, "Darwin", StringComparison.OrdinalIgnoreCase); - IsLinux = string.Equals(sysName, "Linux", StringComparison.OrdinalIgnoreCase) || - sysName.EndsWith("BSD", StringComparison.OrdinalIgnoreCase); + IsLinux = string.Equals(sysName, "Linux", StringComparison.OrdinalIgnoreCase); var archX86 = new Regex("(i|I)[3-6]86"); IsX86 = archX86.IsMatch(uname.machine); diff --git a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs index a026f9a497..59c2940e66 100644 --- a/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs +++ b/MediaBrowser.ServerApplication/FFMpeg/FFMpegDownloader.cs @@ -55,14 +55,26 @@ namespace MediaBrowser.ServerApplication.FFMpeg }; } + var version = FFMpegDownloadInfo.Version; + + if (string.Equals(version, "path", StringComparison.OrdinalIgnoreCase)) + { + return new FFMpegInfo + { + ProbePath = FFMpegDownloadInfo.FFProbeFilename, + EncoderPath = FFMpegDownloadInfo.FFMpegFilename, + Version = version + }; + } + var rootEncoderPath = Path.Combine(_appPaths.ProgramDataPath, "ffmpeg"); - var versionedDirectoryPath = Path.Combine(rootEncoderPath, FFMpegDownloadInfo.Version); + var versionedDirectoryPath = Path.Combine(rootEncoderPath, version); var info = new FFMpegInfo { ProbePath = Path.Combine(versionedDirectoryPath, FFMpegDownloadInfo.FFProbeFilename), EncoderPath = Path.Combine(versionedDirectoryPath, FFMpegDownloadInfo.FFMpegFilename), - Version = FFMpegDownloadInfo.Version + Version = version }; Directory.CreateDirectory(versionedDirectoryPath); @@ -166,7 +178,7 @@ namespace MediaBrowser.ServerApplication.FFMpeg private async Task DownloadFFMpeg(string directory, IProgress progress) { - foreach (var url in FFMpegDownloadInfo.FfMpegUrls) + foreach (var url in FFMpegDownloadInfo.GetDownloadUrls()) { progress.Report(0); diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index fdbd1d352d..e7f5f35726 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -2104,12 +2104,6 @@ - - PreserveNewest - - - PreserveNewest - PreserveNewest