EditorConfig: Using utf-8-bom instead of utf-8

This commit is contained in:
Zoe Roux 2021-09-04 11:25:27 +02:00
parent aec2a8f51a
commit b93f69cb22
3 changed files with 35 additions and 12 deletions

View File

@ -1,7 +1,7 @@
root = true root = true
[*] [*]
charset = utf-8 charset = utf-8-bom
end_of_line = lf end_of_line = lf
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true

View File

@ -13,10 +13,30 @@ namespace Kyoo.Abstractions.Models
/// </summary> /// </summary>
public enum StreamType public enum StreamType
{ {
/// <summary>
/// The type of the stream is not known.
/// </summary>
Unknown = 0, Unknown = 0,
/// <summary>
/// The stream is a video.
/// </summary>
Video = 1, Video = 1,
/// <summary>
/// The stream is an audio.
/// </summary>
Audio = 2, Audio = 2,
/// <summary>
/// The stream is a subtitle.
/// </summary>
Subtitle = 3, Subtitle = 3,
/// <summary>
/// The stream is an attachement (a font, an image or something else).
/// Only fonts are handled by kyoo but they are not saved to the database.
/// </summary>
Attachment = 4 Attachment = 4
} }
@ -36,8 +56,9 @@ namespace Kyoo.Abstractions.Models
string type = Type.ToString().ToLower(); string type = Type.ToString().ToLower();
string index = TrackIndex != 0 ? $"-{TrackIndex}" : string.Empty; string index = TrackIndex != 0 ? $"-{TrackIndex}" : string.Empty;
string episode = EpisodeSlug ?? Episode?.Slug ?? EpisodeID.ToString(); string episode = EpisodeSlug ?? Episode?.Slug ?? EpisodeID.ToString();
return $"{episode}.{Language ?? "und"}{index}{(IsForced ? ".forced" : "")}.{type}"; return $"{episode}.{Language ?? "und"}{index}{(IsForced ? ".forced" : string.Empty)}.{type}";
} }
[UsedImplicitly] private set [UsedImplicitly] private set
{ {
if (value == null) if (value == null)
@ -81,7 +102,6 @@ namespace Kyoo.Abstractions.Models
/// </summary> /// </summary>
public string Codec { get; set; } public string Codec { get; set; }
/// <summary> /// <summary>
/// Is this stream the default one of it's type? /// Is this stream the default one of it's type?
/// </summary> /// </summary>
@ -111,6 +131,7 @@ namespace Kyoo.Abstractions.Models
/// The ID of the episode that uses this track. /// The ID of the episode that uses this track.
/// </summary> /// </summary>
[SerializeIgnore] public int EpisodeID { get; set; } [SerializeIgnore] public int EpisodeID { get; set; }
/// <summary> /// <summary>
/// The episode that uses this track. /// The episode that uses this track.
/// </summary> /// </summary>
@ -145,7 +166,7 @@ namespace Kyoo.Abstractions.Models
} }
} }
//Converting mkv track language to c# system language tag. // Converting mkv track language to c# system language tag.
private static string GetLanguage(string mkvLanguage) private static string GetLanguage(string mkvLanguage)
{ {
// TODO delete this and have a real way to get the language string from the ISO-639-2. // TODO delete this and have a real way to get the language string from the ISO-639-2.
@ -162,9 +183,8 @@ namespace Kyoo.Abstractions.Models
/// </summary> /// </summary>
/// <param name="baseSlug">The slug to edit</param> /// <param name="baseSlug">The slug to edit</param>
/// <param name="type">The new type of this </param> /// <param name="type">The new type of this </param>
/// <returns></returns> /// <returns>The completed slug.</returns>
public static string BuildSlug(string baseSlug, public static string BuildSlug(string baseSlug, StreamType type)
StreamType type)
{ {
return baseSlug.EndsWith($".{type}", StringComparison.InvariantCultureIgnoreCase) return baseSlug.EndsWith($".{type}", StringComparison.InvariantCultureIgnoreCase)
? baseSlug ? baseSlug

View File

@ -155,16 +155,19 @@ namespace Kyoo.Core
.AddCommandLine(args) .AddCommandLine(args)
.Build(); .Build();
string path = parsed.GetValue<string>("datadir") string path = parsed.GetValue<string>("datadir");
?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Kyoo"); path ??= Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Kyoo");
path = Path.GetFullPath(path);
if (!Directory.Exists(path)) if (!Directory.Exists(path))
Directory.CreateDirectory(path); Directory.CreateDirectory(path);
Environment.CurrentDirectory = path; Environment.CurrentDirectory = path;
if (!File.Exists(GetConfigFile())) if (!File.Exists(GetConfigFile()))
{
File.Copy(Path.Join(AppDomain.CurrentDomain.BaseDirectory, GetConfigFile()), File.Copy(Path.Join(AppDomain.CurrentDomain.BaseDirectory, GetConfigFile()),
GetConfigFile()); GetConfigFile());
}
return path; return path;
} }