diff --git a/CRD/CRD.csproj b/CRD/CRD.csproj
new file mode 100644
index 0000000..7128825
--- /dev/null
+++ b/CRD/CRD.csproj
@@ -0,0 +1,51 @@
+
+
+ WinExe
+ net8.0
+ enable
+ true
+ app.manifest
+ true
+ en
+ Assets\app_icon.ico
+ 1.5.2.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ContentDialogInputLoginView.axaml
+ Code
+
+
+ ContentDialogInputLoginView.axaml
+ Code
+
+
+
+
+
diff --git a/CRD/Utils/Structs/CrDownloadOptions.cs b/CRD/Utils/Structs/CrDownloadOptions.cs
index 02119a6..271e3d0 100644
--- a/CRD/Utils/Structs/CrDownloadOptions.cs
+++ b/CRD/Utils/Structs/CrDownloadOptions.cs
@@ -140,6 +140,9 @@ public class CrDownloadOptions{
[YamlMember(Alias = "calendar_hide_dubs", ApplyNamingConventions = false)]
public bool CalendarHideDubs{ get; set; }
+
+ [YamlMember(Alias = "calendar_filter_by_air_date", ApplyNamingConventions = false)]
+ public bool CalendarFilterByAirDate{ get; set; }
[YamlMember(Alias = "history", ApplyNamingConventions = false)]
public bool History{ get; set; }
diff --git a/CRD/ViewModels/CalendarPageViewModel.cs b/CRD/ViewModels/CalendarPageViewModel.cs
index f7b1fee..886019c 100644
--- a/CRD/ViewModels/CalendarPageViewModel.cs
+++ b/CRD/ViewModels/CalendarPageViewModel.cs
@@ -16,23 +16,25 @@ public partial class CalendarPageViewModel : ViewModelBase{
public ObservableCollection CalendarDays{ get; set; }
-
[ObservableProperty]
private bool _showLoading;
[ObservableProperty]
private bool _customCalendar;
-
+
+ [ObservableProperty]
+ private bool _filterByAirDate;
+
[ObservableProperty]
private bool _hideDubs;
public ObservableCollection CalendarDubFilter{ get; } = new(){
new ComboBoxItem(){ Content = "none" },
};
-
+
[ObservableProperty]
private ComboBoxItem? _currentCalendarDubFilter;
-
+
public ObservableCollection CalendarLanguage{ get; } = new(){
new ComboBoxItem(){ Content = "en-us" },
new ComboBoxItem(){ Content = "es" },
@@ -46,27 +48,28 @@ public partial class CalendarPageViewModel : ViewModelBase{
new ComboBoxItem(){ Content = "ru" },
new ComboBoxItem(){ Content = "hi" },
};
-
+
[ObservableProperty]
private ComboBoxItem? _currentCalendarLanguage;
private CalendarWeek? currentWeek;
private bool loading = true;
-
+
public CalendarPageViewModel(){
CalendarDays = new ObservableCollection();
-
+
foreach (var languageItem in Languages.languages){
CalendarDubFilter.Add(new ComboBoxItem{ Content = languageItem.CrLocale });
}
-
+
CustomCalendar = Crunchyroll.Instance.CrunOptions.CustomCalendar;
HideDubs = Crunchyroll.Instance.CrunOptions.CalendarHideDubs;
-
+ HideDubs = Crunchyroll.Instance.CrunOptions.CalendarFilterByAirDate;
+
ComboBoxItem? dubfilter = CalendarDubFilter.FirstOrDefault(a => a.Content != null && (string)a.Content == Crunchyroll.Instance.CrunOptions.CalendarDubFilter) ?? null;
CurrentCalendarDubFilter = dubfilter ?? CalendarDubFilter[0];
-
+
CurrentCalendarLanguage = CalendarLanguage.FirstOrDefault(a => a.Content != null && (string)a.Content == Crunchyroll.Instance.CrunOptions.SelectedCalendarLanguage) ?? CalendarLanguage[0];
loading = false;
LoadCalendar(GetThisWeeksMondayDate(), false);
@@ -95,12 +98,11 @@ public partial class CalendarPageViewModel : ViewModelBase{
}
public async void LoadCalendar(string mondayDate, bool forceUpdate){
-
if (CustomCalendar){
BuildCustomCalendar();
return;
}
-
+
ShowLoading = true;
CalendarWeek week = await Crunchyroll.Instance.GetCalendarForDate(mondayDate, forceUpdate);
if (currentWeek != null && currentWeek == week){
@@ -113,7 +115,7 @@ public partial class CalendarPageViewModel : ViewModelBase{
CalendarDays.AddRange(week.CalendarDays);
RaisePropertyChanged(nameof(CalendarDays));
ShowLoading = false;
-
+
foreach (var calendarDay in CalendarDays){
var episodesCopy = new List(calendarDay.CalendarEpisodes);
foreach (var calendarDayCalendarEpisode in episodesCopy){
@@ -121,6 +123,7 @@ public partial class CalendarPageViewModel : ViewModelBase{
calendarDay.CalendarEpisodes.Remove(calendarDayCalendarEpisode);
continue;
}
+
if (calendarDayCalendarEpisode.ImageBitmap == null){
calendarDayCalendarEpisode.LoadImage();
}
@@ -141,16 +144,15 @@ public partial class CalendarPageViewModel : ViewModelBase{
[RelayCommand]
public void Refresh(){
-
if (loading){
return;
}
-
+
if (CustomCalendar){
BuildCustomCalendar();
return;
}
-
+
string mondayDate;
if (currentWeek is{ FirstDayOfWeekString: not null }){
@@ -167,7 +169,7 @@ public partial class CalendarPageViewModel : ViewModelBase{
if (loading){
return;
}
-
+
string mondayDate;
if (currentWeek is{ FirstDayOfWeek: not null }){
@@ -184,7 +186,7 @@ public partial class CalendarPageViewModel : ViewModelBase{
if (loading){
return;
}
-
+
string mondayDate;
if (currentWeek is{ FirstDayOfWeek: not null }){
@@ -201,7 +203,7 @@ public partial class CalendarPageViewModel : ViewModelBase{
if (loading){
return;
}
-
+
if (value?.Content != null){
Crunchyroll.Instance.CrunOptions.SelectedCalendarLanguage = value.Content.ToString();
Refresh();
@@ -213,13 +215,13 @@ public partial class CalendarPageViewModel : ViewModelBase{
if (loading){
return;
}
-
+
if (CustomCalendar){
BuildCustomCalendar();
} else{
LoadCalendar(GetThisWeeksMondayDate(), true);
}
-
+
Crunchyroll.Instance.CrunOptions.CustomCalendar = value;
CfgManager.WriteSettingsToFile();
}
@@ -228,10 +230,19 @@ public partial class CalendarPageViewModel : ViewModelBase{
if (loading){
return;
}
-
+
Crunchyroll.Instance.CrunOptions.CalendarHideDubs = value;
CfgManager.WriteSettingsToFile();
}
+
+ partial void OnFilterByAirDateChanged(bool value){
+ if (loading){
+ return;
+ }
+
+ Crunchyroll.Instance.CrunOptions.CalendarFilterByAirDate = value;
+ CfgManager.WriteSettingsToFile();
+ }
partial void OnCurrentCalendarDubFilterChanged(ComboBoxItem? value){
if (loading){
@@ -242,13 +253,12 @@ public partial class CalendarPageViewModel : ViewModelBase{
Crunchyroll.Instance.CrunOptions.CalendarDubFilter = value?.Content + "";
CfgManager.WriteSettingsToFile();
}
-
}
private async void BuildCustomCalendar(){
ShowLoading = true;
- var newEpisodesBase = await Crunchyroll.Instance.CrEpisode.GetNewEpisodes(Crunchyroll.Instance.CrunOptions.HistoryLang,200);
+ var newEpisodesBase = await Crunchyroll.Instance.CrEpisode.GetNewEpisodes(Crunchyroll.Instance.CrunOptions.HistoryLang, 200);
CalendarWeek week = new CalendarWeek();
week.CalendarDays = new List();
@@ -271,8 +281,8 @@ public partial class CalendarPageViewModel : ViewModelBase{
var newEpisodes = newEpisodesBase.Data;
foreach (var crBrowseEpisode in newEpisodes){
- var episodeAirDate = crBrowseEpisode.EpisodeMetadata.EpisodeAirDate;
-
+ var targetDate = FilterByAirDate ? crBrowseEpisode.EpisodeMetadata.EpisodeAirDate : crBrowseEpisode.LastPublic;
+
if (HideDubs && crBrowseEpisode.EpisodeMetadata.SeasonTitle != null && crBrowseEpisode.EpisodeMetadata.SeasonTitle.EndsWith("Dub)")){
continue;
}
@@ -284,13 +294,15 @@ public partial class CalendarPageViewModel : ViewModelBase{
}
}
- var calendarDay = week.CalendarDays.FirstOrDefault(day => day.DateTime != null && day.DateTime.Value.Date == episodeAirDate.Date);
-
+ var calendarDay = (from day in week.CalendarDays
+ where day.DateTime.HasValue && day.DateTime.Value.Date == targetDate.Date
+ select day).FirstOrDefault();
+
if (calendarDay != null){
CalendarEpisode calEpisode = new CalendarEpisode();
- calEpisode.DateTime = episodeAirDate;
- calEpisode.HasPassed = DateTime.Now > episodeAirDate;
+ calEpisode.DateTime = targetDate;
+ calEpisode.HasPassed = DateTime.Now > targetDate;
calEpisode.EpisodeName = crBrowseEpisode.Title;
calEpisode.SeriesUrl = "https://www.crunchyroll.com/series/" + crBrowseEpisode.EpisodeMetadata.SeriesId;
calEpisode.EpisodeUrl = $"https://www.crunchyroll.com/de/watch/{crBrowseEpisode.Id}/";
diff --git a/CRD/Views/CalendarPageView.axaml b/CRD/Views/CalendarPageView.axaml
index e1fe8f4..e93d104 100644
--- a/CRD/Views/CalendarPageView.axaml
+++ b/CRD/Views/CalendarPageView.axaml
@@ -90,16 +90,21 @@
-
-
-
-
+
+
+
+
+
+
+
+