Add - Calendar language is now saved

Chg - Subtitles don't get the index number and language added to the file name if only one subtitle is downloaded

Fix - When setting folders in the file name folders were created in the application folder
This commit is contained in:
Elwador 2024-06-21 21:35:51 +02:00
parent 1669561203
commit 5e7c67d72c
5 changed files with 13 additions and 6 deletions

View File

@ -1381,7 +1381,8 @@ public class Crunchyroll{
sxData.Language = langItem;
var isSigns = langItem.Code == audDub && !subsItem.isCC;
var isCc = subsItem.isCC;
sxData.File = Languages.SubsFile(fileName, index + "", langItem, isCc, options.CcTag, isSigns, subsItem.format);
sxData.File = Languages.SubsFile(fileName, index + "", langItem, isCc, options.CcTag, isSigns, subsItem.format, !(options.DlSubs.Count == 1 && !options.DlSubs.Contains("all")));
sxData.Path = Path.Combine(fileDir, sxData.File);
Helpers.EnsureDirectoriesExist(sxData.Path);
@ -1462,7 +1463,7 @@ public class Crunchyroll{
tsFile = Path.Combine(fileDir, outFile);
}
Helpers.EnsureDirectoriesExist(outFile);
Helpers.EnsureDirectoriesExist(tsFile);
M3U8Json videoJson = new M3U8Json{
Segments = chosenVideoSegments.segments.Cast<dynamic>().ToList()

View File

@ -45,7 +45,7 @@ public class HttpClientReq{
client = new HttpClient(handler);
// client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0");
client.DefaultRequestHeaders.UserAgent.ParseAdd("Crunchyroll/1.8.0 Nintendo Switch/12.3.12.0 UE4/4.27");
client.DefaultRequestHeaders.UserAgent.ParseAdd("Crunchyroll/1.9.0 Nintendo Switch/18.1.0.0 UE4/4.27");
}

View File

@ -110,7 +110,7 @@ public class CrDownloadOptions{
[YamlMember(Alias = "accent_color", ApplyNamingConventions = false)]
public string? AccentColor{ get; set; }
[YamlIgnore]
[YamlMember(Alias = "calendar_language", ApplyNamingConventions = false)]
public string? SelectedCalendarLanguage{ get; set; }
[YamlMember(Alias = "history", ApplyNamingConventions = false)]

View File

@ -48,10 +48,14 @@ public class Languages{
return FindLang(str);
}
public static string SubsFile(string fnOutput, string subsIndex, LanguageItem langItem, bool isCC, string ccTag, bool? isSigns = false, string? format = "ass"){
public static string SubsFile(string fnOutput, string subsIndex, LanguageItem langItem, bool isCC, string ccTag , bool? isSigns = false, string? format = "ass", bool addIndexAndLangCode = true){
subsIndex = (int.Parse(subsIndex) + 1).ToString().PadLeft(2, '0');
string fileName = $"{fnOutput}.{subsIndex}.{langItem.Code}";
string fileName = $"{fnOutput}";
if (addIndexAndLangCode){
fileName += $".{subsIndex}.{langItem.Code}";
}
//removed .{langItem.language} from file name at end
if (isCC){

View File

@ -5,6 +5,7 @@ using Avalonia.Controls;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CRD.Downloader;
using CRD.Utils;
using CRD.Utils.Structs;
using DynamicData;
@ -136,6 +137,7 @@ public partial class CalendarPageViewModel : ViewModelBase{
if (value?.Content != null){
Crunchyroll.Instance.CrunOptions.SelectedCalendarLanguage = value.Content.ToString();
Refresh();
CfgManager.WriteSettingsToFile();
}
}
}