Add - Added forced display option to default subs
Fix - Grace period of third party subscription not detected
This commit is contained in:
parent
c1bb11c9fd
commit
5fc2d207e9
|
@ -114,10 +114,11 @@ public class CrAuth{
|
||||||
crunInstance.Profile.Subscription = subsc;
|
crunInstance.Profile.Subscription = subsc;
|
||||||
if ( subsc is{ SubscriptionProducts:{ Count: 0 }, ThirdPartySubscriptionProducts.Count: > 0 }){
|
if ( subsc is{ SubscriptionProducts:{ Count: 0 }, ThirdPartySubscriptionProducts.Count: > 0 }){
|
||||||
var thirdPartySub = subsc.ThirdPartySubscriptionProducts.First();
|
var thirdPartySub = subsc.ThirdPartySubscriptionProducts.First();
|
||||||
var remaining = thirdPartySub.ExpirationDate - DateTime.UtcNow;
|
var expiration = thirdPartySub.InGrace ? thirdPartySub.InGraceExpirationDate : thirdPartySub.ExpirationDate;
|
||||||
|
var remaining = expiration - DateTime.UtcNow;
|
||||||
crunInstance.Profile.HasPremium = remaining > TimeSpan.Zero;
|
crunInstance.Profile.HasPremium = remaining > TimeSpan.Zero;
|
||||||
crunInstance.Profile.Subscription.IsActive = remaining > TimeSpan.Zero;
|
crunInstance.Profile.Subscription.IsActive = remaining > TimeSpan.Zero;
|
||||||
crunInstance.Profile.Subscription.NextRenewalDate = thirdPartySub.ExpirationDate;
|
crunInstance.Profile.Subscription.NextRenewalDate = expiration;
|
||||||
} else if(subsc is{ SubscriptionProducts:{ Count: 0 }, NonrecurringSubscriptionProducts.Count: > 0 }){
|
} else if(subsc is{ SubscriptionProducts:{ Count: 0 }, NonrecurringSubscriptionProducts.Count: > 0 }){
|
||||||
var nonRecurringSub = subsc.NonrecurringSubscriptionProducts.First();
|
var nonRecurringSub = subsc.NonrecurringSubscriptionProducts.First();
|
||||||
var remaining = nonRecurringSub.EndDate - DateTime.UtcNow;
|
var remaining = nonRecurringSub.EndDate - DateTime.UtcNow;
|
||||||
|
|
|
@ -194,6 +194,9 @@ public class Merger{
|
||||||
|
|
||||||
if (options.Defaults.Sub.Code == subObj.Language.Code && CrunchyrollManager.Instance.CrunOptions.DefaultSubSigns == subObj.Signs && subObj.ClosedCaption == false){
|
if (options.Defaults.Sub.Code == subObj.Language.Code && CrunchyrollManager.Instance.CrunOptions.DefaultSubSigns == subObj.Signs && subObj.ClosedCaption == false){
|
||||||
args.Add("--default-track 0");
|
args.Add("--default-track 0");
|
||||||
|
if (CrunchyrollManager.Instance.CrunOptions.DefaultSubForcedDisplay){
|
||||||
|
args.Add("--forced-track 0:yes");
|
||||||
|
}
|
||||||
} else{
|
} else{
|
||||||
args.Add("--default-track 0:0");
|
args.Add("--default-track 0:0");
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,9 @@ public class CrDownloadOptions{
|
||||||
[YamlMember(Alias = "mux_default_sub_signs", ApplyNamingConventions = false)]
|
[YamlMember(Alias = "mux_default_sub_signs", ApplyNamingConventions = false)]
|
||||||
public bool DefaultSubSigns{ get; set; }
|
public bool DefaultSubSigns{ get; set; }
|
||||||
|
|
||||||
|
[YamlMember(Alias = "mux_default_sub_forced_display", ApplyNamingConventions = false)]
|
||||||
|
public bool DefaultSubForcedDisplay{ get; set; }
|
||||||
|
|
||||||
[YamlMember(Alias = "mux_default_dub", ApplyNamingConventions = false)]
|
[YamlMember(Alias = "mux_default_dub", ApplyNamingConventions = false)]
|
||||||
public string DefaultAudio{ get; set; }
|
public string DefaultAudio{ get; set; }
|
||||||
|
|
||||||
|
|
|
@ -91,4 +91,7 @@ public class ThirdPartySubscriptionProduct{
|
||||||
[JsonProperty("expiration_date")]
|
[JsonProperty("expiration_date")]
|
||||||
public DateTime ExpirationDate{ get; set; }
|
public DateTime ExpirationDate{ get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("in_grace_expiration_date")]
|
||||||
|
public DateTime InGraceExpirationDate{ get; set; }
|
||||||
|
|
||||||
}
|
}
|
|
@ -60,6 +60,9 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool _defaultSubSigns;
|
private bool _defaultSubSigns;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool _defaultSubForcedDisplay;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool _includeEpisodeDescription;
|
private bool _includeEpisodeDescription;
|
||||||
|
|
||||||
|
@ -382,6 +385,7 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
AddScaledBorderAndShadow = options.SubsAddScaledBorder is ScaledBorderAndShadowSelection.ScaledBorderAndShadowNo or ScaledBorderAndShadowSelection.ScaledBorderAndShadowYes;
|
AddScaledBorderAndShadow = options.SubsAddScaledBorder is ScaledBorderAndShadowSelection.ScaledBorderAndShadowNo or ScaledBorderAndShadowSelection.ScaledBorderAndShadowYes;
|
||||||
SelectedScaledBorderAndShadow = GetScaledBorderAndShadowFromOptions(options);
|
SelectedScaledBorderAndShadow = GetScaledBorderAndShadowFromOptions(options);
|
||||||
|
|
||||||
|
DefaultSubForcedDisplay = options.DefaultSubForcedDisplay;
|
||||||
DefaultSubSigns = options.DefaultSubSigns;
|
DefaultSubSigns = options.DefaultSubSigns;
|
||||||
HistoryAddSpecials = options.HistoryAddSpecials;
|
HistoryAddSpecials = options.HistoryAddSpecials;
|
||||||
DownloadSpeed = options.DownloadSpeedLimit;
|
DownloadSpeed = options.DownloadSpeedLimit;
|
||||||
|
@ -450,6 +454,7 @@ public partial class SettingsPageViewModel : ViewModelBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
CrunchyrollManager.Instance.CrunOptions.DefaultSubSigns = DefaultSubSigns;
|
CrunchyrollManager.Instance.CrunOptions.DefaultSubSigns = DefaultSubSigns;
|
||||||
|
CrunchyrollManager.Instance.CrunOptions.DefaultSubForcedDisplay = DefaultSubForcedDisplay;
|
||||||
CrunchyrollManager.Instance.CrunOptions.IncludeVideoDescription = IncludeEpisodeDescription;
|
CrunchyrollManager.Instance.CrunOptions.IncludeVideoDescription = IncludeEpisodeDescription;
|
||||||
CrunchyrollManager.Instance.CrunOptions.HistoryAddSpecials = HistoryAddSpecials;
|
CrunchyrollManager.Instance.CrunOptions.HistoryAddSpecials = HistoryAddSpecials;
|
||||||
CrunchyrollManager.Instance.CrunOptions.VideoTitle = FileTitle;
|
CrunchyrollManager.Instance.CrunOptions.VideoTitle = FileTitle;
|
||||||
|
|
|
@ -309,10 +309,14 @@
|
||||||
|
|
||||||
<controls:SettingsExpanderItem Content="Default Subtitle ">
|
<controls:SettingsExpanderItem Content="Default Subtitle ">
|
||||||
<controls:SettingsExpanderItem.Footer>
|
<controls:SettingsExpanderItem.Footer>
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
<ComboBox HorizontalContentAlignment="Center" MinWidth="210" MaxDropDownHeight="400"
|
<ComboBox HorizontalContentAlignment="Center" MinWidth="210" MaxDropDownHeight="400"
|
||||||
ItemsSource="{Binding DefaultSubLangList}"
|
ItemsSource="{Binding DefaultSubLangList}"
|
||||||
SelectedItem="{Binding SelectedDefaultSubLang}">
|
SelectedItem="{Binding SelectedDefaultSubLang}">
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
<CheckBox Content="Forced Display" IsChecked="{Binding DefaultSubForcedDisplay}"> </CheckBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
</controls:SettingsExpanderItem.Footer>
|
</controls:SettingsExpanderItem.Footer>
|
||||||
</controls:SettingsExpanderItem>
|
</controls:SettingsExpanderItem>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue