mirror of
https://github.com/Crunchy-DL/Crunchy-Downloader.git
synced 2026-01-11 20:10:26 +00:00
Fix - Playback error probably only temporarily
Fix - Dub/Sub sorting reset on restart
This commit is contained in:
parent
28c452d537
commit
5cda547e22
6 changed files with 56 additions and 24 deletions
|
|
@ -199,11 +199,15 @@ public class CrunchyrollManager{
|
|||
CfgManager.DisableLogMode();
|
||||
}
|
||||
|
||||
var token = await GetBase64EncodedTokenAsync();
|
||||
|
||||
if (!string.IsNullOrEmpty(token)){
|
||||
ApiUrls.authBasicMob = "Basic " + token;
|
||||
}
|
||||
CrunOptions.StreamEndpoint = "tv/android_tv";
|
||||
CrunOptions.StreamEndpointSecondary = "";
|
||||
CfgManager.WriteCrSettings();
|
||||
|
||||
// var token = await GetBase64EncodedTokenAsync();
|
||||
//
|
||||
// if (!string.IsNullOrEmpty(token)){
|
||||
// ApiUrls.authBasicMob = "Basic " + token;
|
||||
// }
|
||||
|
||||
var jsonFiles = Directory.Exists(CfgManager.PathENCODING_PRESETS_DIR) ? Directory.GetFiles(CfgManager.PathENCODING_PRESETS_DIR, "*.json") :[];
|
||||
|
||||
|
|
@ -1995,12 +1999,12 @@ public class CrunchyrollManager{
|
|||
|
||||
if (matchingSubs.Count > 0){
|
||||
isDuplicate = true;
|
||||
if (!options.SubsDownloadDuplicate || matchingSubs.Any(a => a.RelatedVideoDownloadMedia?.Lang == videoDownloadMedia.Lang)){
|
||||
if (options is not{ KeepDubsSeperate: true, DlVideoOnce: false } || !options.SubsDownloadDuplicate || matchingSubs.Any(a => a.RelatedVideoDownloadMedia?.Lang == videoDownloadMedia.Lang)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
sxData.File = Languages.SubsFile(fileName, index + "", langItem, isDuplicate ? videoDownloadMedia.Lang.CrLocale : "", isCc, options.CcTag, isSigns, subsItem.format,
|
||||
sxData.File = Languages.SubsFile(fileName, index + "", langItem, (isDuplicate || options is{ KeepDubsSeperate: true, DlVideoOnce: false }) ? videoDownloadMedia.Lang.CrLocale : "", isCc, options.CcTag, isSigns, subsItem.format,
|
||||
!(data.DownloadSubs.Count == 1 && !data.DownloadSubs.Contains("all")));
|
||||
sxData.Path = Path.Combine(fileDir, sxData.File);
|
||||
|
||||
|
|
@ -2281,6 +2285,7 @@ public class CrunchyrollManager{
|
|||
|
||||
private async Task<(bool IsOk, string ResponseContent, string error)> SendPlaybackRequestAsync(string endpoint){
|
||||
var request = HttpClientReq.CreateRequestMessage(endpoint, HttpMethod.Get, true, false, null);
|
||||
request.Headers.UserAgent.ParseAdd("ANDROIDTV/3.42.1_22267 Android/16");
|
||||
return await HttpClientReq.Instance.SendHttpRequest(request);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -222,7 +222,8 @@ public partial class CrunchyrollSettingsViewModel : ViewModelBase{
|
|||
new(){ Content = "android/phone" },
|
||||
new(){ Content = "android/tablet" },
|
||||
new(){ Content = "tv/samsung" },
|
||||
new(){ Content = "tv/vidaa" }
|
||||
new(){ Content = "tv/vidaa" },
|
||||
new(){ Content = "tv/android_tv" },
|
||||
];
|
||||
|
||||
public ObservableCollection<ComboBoxItem> StreamEndpointsSecondary{ get; } =[
|
||||
|
|
@ -238,7 +239,8 @@ public partial class CrunchyrollSettingsViewModel : ViewModelBase{
|
|||
new(){ Content = "android/phone" },
|
||||
new(){ Content = "android/tablet" },
|
||||
new(){ Content = "tv/samsung" },
|
||||
new(){ Content = "tv/vidaa" }
|
||||
new(){ Content = "tv/vidaa" },
|
||||
new(){ Content = "tv/android_tv" },
|
||||
];
|
||||
|
||||
public ObservableCollection<StringItemWithDisplayName> FFmpegHWAccel{ get; } =[];
|
||||
|
|
@ -321,15 +323,21 @@ public partial class CrunchyrollSettingsViewModel : ViewModelBase{
|
|||
SelectedFFmpegHWAccel = hwAccellFlag ?? FFmpegHWAccel[0];
|
||||
|
||||
|
||||
var softSubLang = SubLangList.Where(a => options.DlSubs.Contains(a.Content)).ToList();
|
||||
|
||||
var softSubLang = SubLangList
|
||||
.Where(a => options.DlSubs.Contains(a.Content))
|
||||
.OrderBy(a => options.DlSubs.IndexOf(a.Content))
|
||||
.ToList();
|
||||
|
||||
SelectedSubLang.Clear();
|
||||
foreach (var listBoxItem in softSubLang){
|
||||
SelectedSubLang.Add(listBoxItem);
|
||||
}
|
||||
|
||||
var dubLang = DubLangList.Where(a => options.DubLang.Contains(a.Content)).ToList();
|
||||
|
||||
var dubLang = DubLangList
|
||||
.Where(a => options.DubLang.Contains(a.Content))
|
||||
.OrderBy(a => options.DubLang.IndexOf(a.Content))
|
||||
.ToList();
|
||||
|
||||
SelectedDubLang.Clear();
|
||||
foreach (var listBoxItem in dubLang){
|
||||
SelectedDubLang.Add(listBoxItem);
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@
|
|||
</controls:SettingsExpanderItem>
|
||||
|
||||
|
||||
<controls:SettingsExpanderItem Content="Stream Endpoint ">
|
||||
<controls:SettingsExpanderItem Content="Stream Endpoint " IsEnabled="False">
|
||||
<controls:SettingsExpanderItem.Footer>
|
||||
<ComboBox HorizontalContentAlignment="Center" MinWidth="210" MaxDropDownHeight="400"
|
||||
ItemsSource="{Binding StreamEndpoints}"
|
||||
|
|
@ -240,7 +240,7 @@
|
|||
</controls:SettingsExpanderItem.Footer>
|
||||
</controls:SettingsExpanderItem>
|
||||
|
||||
<controls:SettingsExpanderItem Content="Stream Endpoint Secondary">
|
||||
<controls:SettingsExpanderItem Content="Stream Endpoint Secondary" IsEnabled="False" IsVisible="False">
|
||||
<controls:SettingsExpanderItem.Footer>
|
||||
<ComboBox HorizontalContentAlignment="Center" MinWidth="210" MaxDropDownHeight="400"
|
||||
ItemsSource="{Binding StreamEndpointsSecondary}"
|
||||
|
|
|
|||
|
|
@ -83,9 +83,9 @@ public class HttpClientReq{
|
|||
// client.DefaultRequestHeaders.UserAgent.ParseAdd("Crunchyroll/1.9.0 Nintendo Switch/18.1.0.0 UE4/4.27");
|
||||
// client.DefaultRequestHeaders.UserAgent.ParseAdd("Crunchyroll/3.60.0 Android/9 okhttp/4.12.0");
|
||||
|
||||
client.DefaultRequestHeaders.Accept.ParseAdd("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
client.DefaultRequestHeaders.Accept.ParseAdd("*/*");
|
||||
client.DefaultRequestHeaders.AcceptEncoding.ParseAdd("gzip, deflate, br");
|
||||
client.DefaultRequestHeaders.AcceptLanguage.ParseAdd("en-US,en;q=0.5");
|
||||
// client.DefaultRequestHeaders.AcceptLanguage.ParseAdd("en-US,en;q=0.5");
|
||||
client.DefaultRequestHeaders.Connection.ParseAdd("keep-alive");
|
||||
}
|
||||
|
||||
|
|
@ -277,8 +277,9 @@ public static class ApiUrls{
|
|||
//https://lic.drmtoday.com/license-proxy-widevine/cenc/
|
||||
//https://lic.staging.drmtoday.com/license-proxy-widevine/cenc/
|
||||
|
||||
public static string authBasicMob = "Basic eHVuaWh2ZWRidDNtYmlzdWhldnQ6MWtJUzVkeVR2akUwX3JxYUEzWWVBaDBiVVhVbXhXMTE=";
|
||||
// public static string authBasicMob = "Basic djV3YnNsdGJueG5oeXk3cDN4ZmI6cFdKWkZMaHVTM0I2NFhPbk81bWVlWXpiTlBtZWsyRVU=";
|
||||
public static string authBasicMob = "Basic Ym1icmt4eXgzZDd1NmpzZnlsYTQ6QUlONEQ1VkVfY3Awd1Z6Zk5vUDBZcUhVcllGcDloU2c=";
|
||||
|
||||
public static readonly string MobileUserAgent = "Crunchyroll/3.81.8 Android/15 okhttp/4.12.0";
|
||||
public static readonly string MobileUserAgent = "Crunchyroll/3.81.6 Android/16";
|
||||
public static readonly string FirefoxUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0";
|
||||
}
|
||||
14
CRD/Utils/UI/UiEmptyToDefaultConverter.cs
Normal file
14
CRD/Utils/UI/UiEmptyToDefaultConverter.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
|
||||
namespace CRD.Utils.UI;
|
||||
|
||||
public class UiEmptyToDefaultConverter: IValueConverter{
|
||||
public object? Convert(object? value, System.Type targetType, object? parameter, CultureInfo culture){
|
||||
var s = value as string;
|
||||
var fallback = parameter as string ?? string.Empty;
|
||||
return string.IsNullOrEmpty(s) ? fallback : s!;
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, System.Type targetType, object? parameter, CultureInfo culture) => value!;
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
x:Class="CRD.Views.SeriesPageView">
|
||||
|
||||
<UserControl.Resources>
|
||||
<ui:UiListToStringConverter x:Key="UiListToStringConverter" />
|
||||
<ui:UiEmptyToDefaultConverter x:Key="EmptyToDefault" />
|
||||
<ui:UiListHasElementsConverter x:Key="UiListHasElementsConverter" />
|
||||
<ui:UiEnumToBoolConverter x:Key="EnumToBoolConverter" />
|
||||
</UserControl.Resources>
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Command="{Binding UpdateData}" Margin="0 0 5 10">Refresh Series</Button>
|
||||
|
||||
|
||||
<Button Margin="0 0 5 10" FontStyle="Italic"
|
||||
IsVisible="{Binding ShowFeaturedMusicButton}"
|
||||
VerticalAlignment="Center"
|
||||
|
|
@ -151,14 +151,16 @@
|
|||
<controls:SymbolIcon Symbol="Audio" FontSize="18" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
|
||||
<ToggleButton IsChecked="{Binding EditMode}" Margin="0 0 5 10">Edit</ToggleButton>
|
||||
|
||||
<Button Margin="0 0 5 10" FontStyle="Italic"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding OpenFolderDialogAsync}">
|
||||
<ToolTip.Tip>
|
||||
<TextBlock Text="{Binding SelectedSeries.SeriesDownloadPath}" FontSize="15" />
|
||||
<TextBlock Text="{Binding SelectedSeries.SeriesDownloadPath,
|
||||
Converter={StaticResource EmptyToDefault},
|
||||
ConverterParameter='No series path set'}" FontSize="15" />
|
||||
</ToolTip.Tip>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<controls:SymbolIcon Symbol="Folder" FontSize="18" />
|
||||
|
|
@ -636,7 +638,9 @@
|
|||
Command="{Binding $parent[UserControl].((vm:SeriesPageViewModel)DataContext).OpenFolderDialogAsync}"
|
||||
CommandParameter="{Binding .}">
|
||||
<ToolTip.Tip>
|
||||
<TextBlock Text="{Binding SeasonDownloadPath}" FontSize="15" />
|
||||
<TextBlock Text="{Binding SeasonDownloadPath,
|
||||
Converter={StaticResource EmptyToDefault},
|
||||
ConverterParameter='No season path set'}" FontSize="15" />
|
||||
</ToolTip.Tip>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<controls:SymbolIcon Symbol="Folder" FontSize="18" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue