Fix - Hotfix for Filter by Air date overwriting Hide Dubs
Fix - Crash when opening calendar for the first time
This commit is contained in:
parent
6b44dbf28c
commit
53158b261d
|
@ -51,6 +51,7 @@ public class Crunchyroll{
|
||||||
#region Calendar Variables
|
#region Calendar Variables
|
||||||
|
|
||||||
private Dictionary<string, CalendarWeek> calendar = new();
|
private Dictionary<string, CalendarWeek> calendar = new();
|
||||||
|
|
||||||
private Dictionary<string, string> calendarLanguage = new(){
|
private Dictionary<string, string> calendarLanguage = new(){
|
||||||
{ "en-us", "https://www.crunchyroll.com/simulcastcalendar" },
|
{ "en-us", "https://www.crunchyroll.com/simulcastcalendar" },
|
||||||
{ "es", "https://www.crunchyroll.com/es/simulcastcalendar" },
|
{ "es", "https://www.crunchyroll.com/es/simulcastcalendar" },
|
||||||
|
@ -158,7 +159,7 @@ public class Crunchyroll{
|
||||||
CrunOptions.SimultaneousDownloads = 2;
|
CrunOptions.SimultaneousDownloads = 2;
|
||||||
CrunOptions.AccentColor = Colors.SlateBlue.ToString();
|
CrunOptions.AccentColor = Colors.SlateBlue.ToString();
|
||||||
CrunOptions.Theme = "System";
|
CrunOptions.Theme = "System";
|
||||||
CrunOptions.SelectedCalendarLanguage = "default";
|
CrunOptions.SelectedCalendarLanguage = "en-us";
|
||||||
CrunOptions.CalendarDubFilter = "none";
|
CrunOptions.CalendarDubFilter = "none";
|
||||||
CrunOptions.DlVideoOnce = true;
|
CrunOptions.DlVideoOnce = true;
|
||||||
CrunOptions.StreamEndpoint = "web/firefox";
|
CrunOptions.StreamEndpoint = "web/firefox";
|
||||||
|
@ -190,9 +191,6 @@ public class Crunchyroll{
|
||||||
|
|
||||||
RefreshSonarr();
|
RefreshSonarr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void RefreshSonarr(){
|
public async void RefreshSonarr(){
|
||||||
|
@ -244,7 +242,10 @@ public class Crunchyroll{
|
||||||
return forDate;
|
return forDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
var request = HttpClientReq.CreateRequestMessage($"{calendarLanguage[CrunOptions.SelectedCalendarLanguage ?? "de"]}?filter=premium&date={weeksMondayDate}", HttpMethod.Get, false, false, null);
|
var request = calendarLanguage.ContainsKey(CrunOptions.SelectedCalendarLanguage ?? "de")
|
||||||
|
? HttpClientReq.CreateRequestMessage($"{calendarLanguage[CrunOptions.SelectedCalendarLanguage ?? "de"]}?filter=premium&date={weeksMondayDate}", HttpMethod.Get, false, false, null)
|
||||||
|
: HttpClientReq.CreateRequestMessage($"{calendarLanguage["en-us"]}?filter=premium&date={weeksMondayDate}", HttpMethod.Get, false, false, null);
|
||||||
|
|
||||||
|
|
||||||
request.Headers.Accept.ParseAdd("text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8");
|
request.Headers.Accept.ParseAdd("text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8");
|
||||||
request.Headers.AcceptEncoding.ParseAdd("gzip, deflate, br");
|
request.Headers.AcceptEncoding.ParseAdd("gzip, deflate, br");
|
||||||
|
@ -1220,6 +1221,7 @@ public class Crunchyroll{
|
||||||
} catch (IOException ex){
|
} catch (IOException ex){
|
||||||
Console.WriteLine($"An error occurred: {ex.Message}");
|
Console.WriteLine($"An error occurred: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DownloadResponse{
|
return new DownloadResponse{
|
||||||
Data = files,
|
Data = files,
|
||||||
Error = dlFailed,
|
Error = dlFailed,
|
||||||
|
@ -1283,6 +1285,7 @@ public class Crunchyroll{
|
||||||
} catch (IOException ex){
|
} catch (IOException ex){
|
||||||
Console.WriteLine($"An error occurred: {ex.Message}");
|
Console.WriteLine($"An error occurred: {ex.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new DownloadResponse{
|
return new DownloadResponse{
|
||||||
Data = files,
|
Data = files,
|
||||||
Error = dlFailed,
|
Error = dlFailed,
|
||||||
|
|
|
@ -65,7 +65,7 @@ public partial class CalendarPageViewModel : ViewModelBase{
|
||||||
|
|
||||||
CustomCalendar = Crunchyroll.Instance.CrunOptions.CustomCalendar;
|
CustomCalendar = Crunchyroll.Instance.CrunOptions.CustomCalendar;
|
||||||
HideDubs = Crunchyroll.Instance.CrunOptions.CalendarHideDubs;
|
HideDubs = Crunchyroll.Instance.CrunOptions.CalendarHideDubs;
|
||||||
HideDubs = Crunchyroll.Instance.CrunOptions.CalendarFilterByAirDate;
|
FilterByAirDate = Crunchyroll.Instance.CrunOptions.CalendarFilterByAirDate;
|
||||||
|
|
||||||
ComboBoxItem? dubfilter = CalendarDubFilter.FirstOrDefault(a => a.Content != null && (string)a.Content == Crunchyroll.Instance.CrunOptions.CalendarDubFilter) ?? null;
|
ComboBoxItem? dubfilter = CalendarDubFilter.FirstOrDefault(a => a.Content != null && (string)a.Content == Crunchyroll.Instance.CrunOptions.CalendarDubFilter) ?? null;
|
||||||
CurrentCalendarDubFilter = dubfilter ?? CalendarDubFilter[0];
|
CurrentCalendarDubFilter = dubfilter ?? CalendarDubFilter[0];
|
||||||
|
|
Loading…
Reference in New Issue