Skip to content

Commit

Permalink
Merge pull request #835 from ywmoyue/dev
Browse files Browse the repository at this point in the history
4.7.4 fix
  • Loading branch information
ywmoyue authored Sep 30, 2024
2 parents 99c5a9d + c3d75ce commit a8ed48e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/BiliLite.UWP/Controls/Player.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public double BufferCache
}

public static readonly DependencyProperty BufferCacheProperty =
DependencyProperty.Register("BufferCache", typeof(double), typeof(Player), new PropertyMetadata(1));
DependencyProperty.Register("BufferCache", typeof(double), typeof(Player), new PropertyMetadata(1d));

/// <summary>
/// 播放速度
Expand Down
3 changes: 1 addition & 2 deletions src/BiliLite.UWP/Controls/PlayerControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ private void SetSoundQuality()
BottomSoundQuality.SelectionChanged -= BottomSoundQuality_SelectionChanged;
BottomSoundQuality.SelectedItem = playUrlInfo.CurrentAudioQuality;
BottomSoundQuality.SelectionChanged += BottomSoundQuality_SelectionChanged;
ChangeQuality(current_quality_info, playUrlInfo.CurrentAudioQuality).RunWithoutAwait();
// ChangeQuality(current_quality_info, playUrlInfo.CurrentAudioQuality).RunWithoutAwait();
}

private void SetQuality()
Expand Down Expand Up @@ -1584,7 +1584,6 @@ private async Task<PlayerOpenResult> ChangeQualityPlayVideo(BiliPlayUrlInfo qual

if (!result.result)
{

result = await Player.PlayerDashUseNative(quality.DashInfo, quality.UserAgent, quality.Referer, positon: _postion);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/BiliLite.UWP/Pages/DownloadPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private async void btnEpisodesDelete_Click(object sender, RoutedEventArgs e)
var folder = await StorageFolder.GetFolderFromPathAsync(item.FilePath);
await folder.DeleteAsync(StorageDeleteOption.PermanentDelete);
data.Epsidoes.Remove(item);
m_downloadService.RemoveDbSubItem(item.CID);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -238,6 +239,7 @@ private async void btnMenuDetele_Click(object sender, RoutedEventArgs e)
var folder = await StorageFolder.GetFolderFromPathAsync(data.Path);
await folder.DeleteAsync(StorageDeleteOption.PermanentDelete);
m_viewModel.DownloadedViewModels.Remove(data);
m_downloadService.RemoveDbItem(data.ID);
}
catch (Exception ex)
{
Expand Down
22 changes: 22 additions & 0 deletions src/BiliLite.UWP/Services/DownloadService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ private async void DeleteItem(DownloadingItemViewModel data)
m_loadDownloadingCts[data.EpisodeID].Cancel();
var folder = await StorageFolder.GetFolderFromPathAsync(data.Path);
await folder.DeleteAsync(StorageDeleteOption.PermanentDelete);
RemoveDbSubItem(data.EpisodeID);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -270,6 +271,7 @@ private async void DeleteAll()
m_loadDownloadingCts[item.EpisodeID].Cancel();
var folder = await StorageFolder.GetFolderFromPathAsync(item.Path);
await folder.DeleteAsync(StorageDeleteOption.PermanentDelete);
RemoveDbSubItem(item.EpisodeID);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -396,6 +398,26 @@ public int CheckExist(string id, bool isSeason = false)
return 0;
}

public void RemoveDbItem(string id)
{
var entity = m_biliLiteDbContext.DownloadedItems
.Include(x => x.Epsidoes)
.FirstOrDefault(x => x.ID == id);
if (entity == null) return;
m_biliLiteDbContext.DownloadedSubItems.RemoveRange(entity.Epsidoes);
m_biliLiteDbContext.DownloadedItems.Remove(entity);
m_biliLiteDbContext.SaveChanges();
}

public void RemoveDbSubItem(string id)
{
var entity = m_biliLiteDbContext.DownloadedSubItems
.FirstOrDefault(x => x.CID == id);
if (entity == null) return;
m_biliLiteDbContext.DownloadedSubItems.Remove(entity);
m_biliLiteDbContext.SaveChanges();
}

public void RefreshDownloaded()
{
if (m_downloadPageViewModel.LoadingDownloaded) return;
Expand Down

0 comments on commit a8ed48e

Please sign in to comment.