update translations

This commit is contained in:
Luke Pulverenti
2014-09-08 21:15:31 -04:00
parent 09bffa1b56
commit a2dc5e090b
38 changed files with 238 additions and 3008 deletions

View File

@@ -227,11 +227,13 @@ namespace MediaBrowser.ServerApplication
/// </summary>
/// <param name="applicationPaths">The application paths.</param>
/// <param name="logManager">The log manager.</param>
/// <param name="supportsRunningAsService">if set to <c>true</c> [supports running as service].</param>
/// <param name="isRunningAsService">if set to <c>true</c> [is running as service].</param>
public ApplicationHost(ServerApplicationPaths applicationPaths, ILogManager logManager, bool isRunningAsService)
public ApplicationHost(ServerApplicationPaths applicationPaths, ILogManager logManager, bool supportsRunningAsService, bool isRunningAsService)
: base(applicationPaths, logManager)
{
_isRunningAsService = isRunningAsService;
SupportsRunningAsService = supportsRunningAsService;
}
private readonly bool _isRunningAsService;
@@ -240,6 +242,8 @@ namespace MediaBrowser.ServerApplication
get { return _isRunningAsService; }
}
public bool SupportsRunningAsService { get; private set; }
/// <summary>
/// Gets the name.
/// </summary>
@@ -936,6 +940,7 @@ namespace MediaBrowser.ServerApplication
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
IsRunningAsService = IsRunningAsService,
SupportsRunningAsService = SupportsRunningAsService,
ServerName = FriendlyName,
LocalAddress = GetLocalIpAddress()
};

View File

@@ -1,127 +0,0 @@
namespace MediaBrowser.ServerApplication
{
partial class LibraryViewer
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LibraryViewer));
this.treeView1 = new System.Windows.Forms.TreeView();
this.txtJson = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.selectUser = new System.Windows.Forms.ComboBox();
this.lblType = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// treeView1
//
this.treeView1.Dock = System.Windows.Forms.DockStyle.Left;
this.treeView1.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.treeView1.Location = new System.Drawing.Point(0, 0);
this.treeView1.Name = "treeView1";
this.treeView1.Size = new System.Drawing.Size(260, 517);
this.treeView1.TabIndex = 0;
//
// txtJson
//
this.txtJson.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtJson.Font = new System.Drawing.Font("Consolas", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtJson.Location = new System.Drawing.Point(260, 0);
this.txtJson.Multiline = true;
this.txtJson.Name = "txtJson";
this.txtJson.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtJson.Size = new System.Drawing.Size(524, 517);
this.txtJson.TabIndex = 1;
//
// panel1
//
this.panel1.Controls.Add(this.selectUser);
this.panel1.Controls.Add(this.lblType);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(784, 44);
this.panel1.TabIndex = 2;
//
// selectUser
//
this.selectUser.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.selectUser.FormattingEnabled = true;
this.selectUser.Location = new System.Drawing.Point(12, 12);
this.selectUser.Name = "selectUser";
this.selectUser.Size = new System.Drawing.Size(121, 21);
this.selectUser.TabIndex = 2;
//
// lblType
//
this.lblType.AutoSize = true;
this.lblType.Location = new System.Drawing.Point(260, 15);
this.lblType.Name = "lblType";
this.lblType.Size = new System.Drawing.Size(0, 13);
this.lblType.TabIndex = 1;
//
// panel2
//
this.panel2.Controls.Add(this.txtJson);
this.panel2.Controls.Add(this.treeView1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 44);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(784, 517);
this.panel2.TabIndex = 3;
//
// LibraryViewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(784, 561);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "LibraryViewer";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Library Explorer";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TreeView treeView1;
private System.Windows.Forms.TextBox txtJson;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.ComboBox selectUser;
private System.Windows.Forms.Label lblType;
private System.Windows.Forms.Panel panel2;
}
}

View File

@@ -1,244 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Library;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SortOrder = MediaBrowser.Model.Entities.SortOrder;
namespace MediaBrowser.ServerApplication
{
public partial class LibraryViewer : Form
{
private readonly IJsonSerializer _jsonSerializer;
private readonly ILibraryManager _libraryManager;
private readonly IUserViewManager _userViewManager;
private User _currentUser;
public LibraryViewer(IJsonSerializer jsonSerializer, IUserManager userManager, ILibraryManager libraryManager, IUserViewManager userViewManager)
{
InitializeComponent();
_jsonSerializer = jsonSerializer;
_libraryManager = libraryManager;
_userViewManager = userViewManager;
foreach (var user in userManager.Users)
selectUser.Items.Add(user);
selectUser.Items.Insert(0, new User { Name = "Physical" });
selectUser.SelectedIndex = 0;
selectUser.SelectedIndexChanged += selectUser_SelectedIndexChanged;
treeView1.AfterSelect += treeView1_AfterSelect;
}
void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (e.Node != null)
{
var item = (BaseItem)e.Node.Tag;
lblType.Text = item.GetType().Name;
var json = FormatJson(_jsonSerializer.SerializeToString(item));
var hasMediaSources = item as IHasMediaSources;
if (hasMediaSources != null)
{
var sources = hasMediaSources.GetMediaSources(false).ToList();
json += "\n\nMedia Sources:\n\n" + FormatJson(_jsonSerializer.SerializeToString(sources));
}
txtJson.Text = json;
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
selectUser_SelectedIndexChanged(null, null);
}
void selectUser_SelectedIndexChanged(object sender, EventArgs e)
{
_currentUser = selectUser.SelectedItem as User;
if (_currentUser != null)
LoadTree();
}
private IEnumerable<BaseItem> GetItems(Folder parent, User user)
{
if (parent == null)
{
var task = _userViewManager.GetUserViews(new UserViewQuery
{
UserId = user.Id.ToString("N")
}, CancellationToken.None);
task.RunSynchronously();
return task.Result;
}
else
{
var task = parent.GetUserItems(new UserItemsQuery
{
User = user,
SortBy = new[] { ItemSortBy.SortName }
});
task.RunSynchronously();
return task.Result.Items;
}
}
private void LoadTree()
{
treeView1.Nodes.Clear();
var isPhysical = _currentUser.Name == "Physical";
IEnumerable<BaseItem> children = isPhysical ? new[] { _libraryManager.RootFolder } : GetItems(null, _currentUser);
foreach (var folder in children.OfType<Folder>())
{
var currentFolder = folder;
var node = new TreeNode { Tag = currentFolder };
var subChildren = isPhysical ? currentFolder.Children.OrderBy(i => i.SortName) : GetItems(currentFolder, _currentUser);
AddChildren(node, subChildren, _currentUser, isPhysical);
node.Text = currentFolder.Name + " (" +
node.Nodes.Count + ")";
treeView1.Nodes.Add(node);
}
}
/// <summary>
/// Adds the children.
/// </summary>
/// <param name="parent">The parent.</param>
/// <param name="children">The children.</param>
/// <param name="user">The user.</param>
private void AddChildren(TreeNode parent, IEnumerable<BaseItem> children, User user, bool isPhysical)
{
foreach (var item in children)
{
var node = new TreeNode { Tag = item };
var subFolder = item as Folder;
if (subFolder != null)
{
var subChildren = isPhysical ? subFolder.Children.OrderBy(i => i.SortName) : GetItems(subFolder, _currentUser);
AddChildren(node, subChildren, user, isPhysical);
node.Text = item.Name + " (" + node.Nodes.Count + ")";
}
else
{
node.Text = item.Name;
}
parent.Nodes.Add(node);
}
}
/// <summary>
/// The INDEN t_ STRING
/// </summary>
private const string INDENT_STRING = " ";
/// <summary>
/// Formats the json.
/// </summary>
/// <param name="str">The STR.</param>
/// <returns>System.String.</returns>
private static string FormatJson(string str)
{
var indent = 0;
var quoted = false;
var sb = new StringBuilder();
for (var i = 0; i < str.Length; i++)
{
var ch = str[i];
switch (ch)
{
case '{':
case '[':
sb.Append(ch);
if (!quoted)
{
sb.AppendLine();
Enumerable.Range(0, ++indent).ForEach(item => sb.Append(INDENT_STRING));
}
break;
case '}':
case ']':
if (!quoted)
{
sb.AppendLine();
Enumerable.Range(0, --indent).ForEach(item => sb.Append(INDENT_STRING));
}
sb.Append(ch);
break;
case '"':
sb.Append(ch);
bool escaped = false;
var index = i;
while (index > 0 && str[--index] == '\\')
escaped = !escaped;
if (!escaped)
quoted = !quoted;
break;
case ',':
sb.Append(ch);
if (!quoted)
{
sb.AppendLine();
Enumerable.Range(0, indent).ForEach(item => sb.Append(INDENT_STRING));
}
break;
case ':':
sb.Append(ch);
if (!quoted)
sb.Append(" ");
break;
default:
sb.Append(ch);
break;
}
}
return sb.ToString();
}
}
/// <summary>
/// Class Extensions
/// </summary>
static class Extensions
{
/// <summary>
/// Fors the each.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="ie">The ie.</param>
/// <param name="action">The action.</param>
public static void ForEach<T>(this IEnumerable<T> ie, Action<T> action)
{
foreach (var i in ie)
{
action(i);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -207,7 +207,7 @@ namespace MediaBrowser.ServerApplication
/// <param name="runService">if set to <c>true</c> [run service].</param>
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, bool runService)
{
_appHost = new ApplicationHost(appPaths, logManager, runService);
_appHost = new ApplicationHost(appPaths, logManager, true, runService);
var initProgress = new Progress<double>();

View File

@@ -105,12 +105,6 @@
<Compile Include="FFMpeg\FFMpegInfo.cs" />
<Compile Include="IO\FileSystemFactory.cs" />
<Compile Include="IO\NativeFileSystem.cs" />
<Compile Include="LibraryViewer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LibraryViewer.Designer.cs">
<DependentUpon>LibraryViewer.cs</DependentUpon>
</Compile>
<Compile Include="Logging\LogForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -155,9 +149,6 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LibraryViewer.resx">
<DependentUpon>LibraryViewer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Logging\LogForm.resx">
<DependentUpon>LogForm.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -23,7 +23,6 @@ namespace MediaBrowser.ServerApplication
private System.Windows.Forms.ToolStripMenuItem cmdBrowse;
private System.Windows.Forms.ToolStripMenuItem cmdConfigure;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem cmdLibraryExplorer;
private System.Windows.Forms.ToolStripMenuItem cmdRestart;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem cmdLogWindow;
@@ -84,7 +83,6 @@ namespace MediaBrowser.ServerApplication
cmdLogWindow = new System.Windows.Forms.ToolStripMenuItem();
toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
cmdRestart = new System.Windows.Forms.ToolStripMenuItem();
cmdLibraryExplorer = new System.Windows.Forms.ToolStripMenuItem();
toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
cmdConfigure = new System.Windows.Forms.ToolStripMenuItem();
cmdBrowse = new System.Windows.Forms.ToolStripMenuItem();
@@ -106,7 +104,6 @@ namespace MediaBrowser.ServerApplication
cmdBrowse,
cmdConfigure,
toolStripSeparator2,
cmdLibraryExplorer,
cmdRestart,
toolStripSeparator1,
cmdApiDocs,
@@ -144,11 +141,6 @@ namespace MediaBrowser.ServerApplication
cmdRestart.Name = "cmdRestart";
cmdRestart.Size = new System.Drawing.Size(208, 22);
//
// cmdLibraryExplorer
//
cmdLibraryExplorer.Name = "cmdLibraryExplorer";
cmdLibraryExplorer.Size = new System.Drawing.Size(208, 22);
//
// toolStripSeparator2
//
toolStripSeparator2.Name = "toolStripSeparator2";
@@ -188,7 +180,6 @@ namespace MediaBrowser.ServerApplication
cmdConfigure.Click += cmdConfigure_Click;
cmdCommunity.Click += cmdCommunity_Click;
cmdBrowse.Click += cmdBrowse_Click;
cmdLibraryExplorer.Click += cmdLibraryExplorer_Click;
cmdSwagger.Click += cmdSwagger_Click;
cmdGtihub.Click += cmdGtihub_Click;
@@ -218,7 +209,6 @@ namespace MediaBrowser.ServerApplication
cmdApiDocs.Text = _localization.GetLocalizedString("LabelViewApiDocumentation");
cmdBrowse.Text = _localization.GetLocalizedString("LabelBrowseLibrary");
cmdConfigure.Text = _localization.GetLocalizedString("LabelConfigureMediaBrowser");
cmdLibraryExplorer.Text = _localization.GetLocalizedString("LabelOpenLibraryViewer");
cmdRestart.Text = _localization.GetLocalizedString("LabelRestartServer");
cmdLogWindow.Text = _localization.GetLocalizedString("LabelShowLogWindow");
}
@@ -316,11 +306,6 @@ namespace MediaBrowser.ServerApplication
LoadLogWindow(sender, e);
}
void cmdLibraryExplorer_Click(object sender, EventArgs e)
{
new LibraryViewer(_jsonSerializer, _userManager, _libraryManager, _userViewManager).Show();
}
void cmdRestart_Click(object sender, EventArgs e)
{
_appHost.Restart();