From a080eab54e4593fc58721ffedb131231fbcae334 Mon Sep 17 00:00:00 2001 From: tor4kichi Date: Tue, 27 Feb 2024 11:47:24 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E3=82=A4=E3=83=99=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=83=8F=E3=83=B3=E3=83=89=E3=83=A9=E3=83=BC=E3=81=AE=E5=A4=9A?= =?UTF-8?q?=E9=87=8D=E7=99=BB=E9=8C=B2=E3=82=92=E9=98=B2=E6=AD=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Hohoema.Core/Helpers/ShareHelper.cs | 1 + Hohoema.Core/Models/Playlist/HohoemaPlaylistPlayer.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/Hohoema.Core/Helpers/ShareHelper.cs b/Hohoema.Core/Helpers/ShareHelper.cs index ca5510fd..a4d06275 100644 --- a/Hohoema.Core/Helpers/ShareHelper.cs +++ b/Hohoema.Core/Helpers/ShareHelper.cs @@ -153,6 +153,7 @@ public static void Share(string title, string content) _ShareText = content; _ShareTitleText = title; DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView(); + dataTransferManager.DataRequested -= DataTransferManager_DataRequested; dataTransferManager.DataRequested += DataTransferManager_DataRequested; DataTransferManager.ShowShareUI(); diff --git a/Hohoema.Core/Models/Playlist/HohoemaPlaylistPlayer.cs b/Hohoema.Core/Models/Playlist/HohoemaPlaylistPlayer.cs index 300d7295..a8796b8b 100644 --- a/Hohoema.Core/Models/Playlist/HohoemaPlaylistPlayer.cs +++ b/Hohoema.Core/Models/Playlist/HohoemaPlaylistPlayer.cs @@ -765,6 +765,7 @@ private async Task UpdatePlayingMediaAsync(IVideoContent item, TimeSpan? s // メディア再生成功時のメッセージを飛ばす _ = _messenger.Send(new PlaybackStartedMessage(new(this, CurrentPlaylistId, item.VideoId, videoSession.Quality, _mediaPlayer.PlaybackSession))); + _mediaPlayer.PlaybackSession.PlaybackStateChanged -= PlaybackSession_PlaybackStateChanged; _mediaPlayer.PlaybackSession.PlaybackStateChanged += PlaybackSession_PlaybackStateChanged; _mediaPlayer.CommandManager.IsEnabled = false; From d32ae23544630bc982752b9def53a94353ac8167 Mon Sep 17 00:00:00 2001 From: tor4kichi Date: Mon, 5 Aug 2024 20:54:31 +0900 Subject: [PATCH 2/3] =?UTF-8?q?#968=20=E5=B8=B0=E3=81=A3=E3=81=A6=E3=81=8D?= =?UTF-8?q?=E3=81=9F=E3=83=8B=E3=82=B3=E3=83=8B=E3=82=B3=E3=81=AE=E5=8B=95?= =?UTF-8?q?=E7=94=BB=E7=94=9F=E6=88=90API=E3=81=AB=E5=AF=BE=E5=BF=9C?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Hohoema.Core/Hohoema.Core.csproj | 3 +- .../Niconico/Video/NicoVideoProvider.cs | 16 +- .../Player/Video/Comment/CommentClient.cs | 10 +- .../Player/Video/NicoVideoSessionProvider.cs | 124 ++++----- .../DmcVideoStreamingSession.cs | 249 ------------------ .../DomandStreamingSession.cs | 17 +- .../Models/Playlist/HohoemaPlaylistPlayer.cs | 7 +- .../VideoCache/VideoCacheDownloadOperation.cs | 16 +- .../Models/VideoCache/VideoCacheManager.cs | 16 +- Hohoema/Package.appxmanifest | 2 +- .../Player/Videos/VideoEndedRecommendation.cs | 1 + .../Video/VideoInfomationPageViewModel.cs | 4 +- .../Views.Player/VideoPlayerPageViewModel.cs | 4 +- .../Views/PrimaryWindowCoreLayoutViewModel.cs | 6 +- 14 files changed, 110 insertions(+), 365 deletions(-) delete mode 100644 Hohoema.Core/Models/Player/Video/VideoStreamingSession/DmcVideoStreamingSession.cs diff --git a/Hohoema.Core/Hohoema.Core.csproj b/Hohoema.Core/Hohoema.Core.csproj index 3b8567fa..1ef992ce 100644 --- a/Hohoema.Core/Hohoema.Core.csproj +++ b/Hohoema.Core/Hohoema.Core.csproj @@ -270,7 +270,6 @@ - @@ -378,7 +377,7 @@ 2.7.2 - 0.5.5 + 0.6.2 7.12.0 diff --git a/Hohoema.Core/Models/Niconico/Video/NicoVideoProvider.cs b/Hohoema.Core/Models/Niconico/Video/NicoVideoProvider.cs index bde5a851..01447ec8 100644 --- a/Hohoema.Core/Models/Niconico/Video/NicoVideoProvider.cs +++ b/Hohoema.Core/Models/Niconico/Video/NicoVideoProvider.cs @@ -329,24 +329,24 @@ public async ValueTask ResolveVideoOwnerAsync(VideoId videoId, C })); } - public async Task GetWatchPageResponseAsync(VideoId videoId, bool noHisotry = false) + public async Task GetWatchPageResponseAsync(VideoId videoId, bool noHisotry = false) { if (_niconicoSession.ServiceStatus.IsOutOfService()) { return null; } - WatchPageResponse data = await _niconicoSession.ToolkitContext.Video.VideoWatch.GetInitialWatchDataAsync(videoId, !noHisotry, !noHisotry); - if (data.WatchApiResponse?.WatchApiData is not null and var watchData) + var data = await _niconicoSession.ToolkitContext.Video.VideoWatch.GetWatchDataAsync(videoId); + if (data.Data.Response is not null and var watchData) { _ = UpdateCache(videoId, info => { - WatchApiVideo video = watchData.Video; + var video = watchData.Video; info.VideoAliasId = videoId; info.Title = video.Title; info.Length = TimeSpan.FromSeconds(video.Duration); - info.PostedAt = video.RegisteredAt.DateTime; - info.ThumbnailUrl = video.Thumbnail.Url.OriginalString; + info.PostedAt = video.RegisteredAt; + info.ThumbnailUrl = video.Thumbnail.Url; info.Description = video.Description; if (watchData.Owner is not null and var userOwner) @@ -354,7 +354,7 @@ public async Task GetWatchPageResponseAsync(VideoId videoId, info.Owner = new NicoVideoOwner() { ScreenName = userOwner.Nickname, - IconUrl = userOwner.IconUrl.OriginalString, + IconUrl = userOwner.IconUrl, OwnerId = userOwner.Id.ToString(), UserType = OwnerType.User }; @@ -370,7 +370,7 @@ public async Task GetWatchPageResponseAsync(VideoId videoId, }; } - return (watchData.Video.IsDeleted, default); + return (watchData.Video.IsDeleted.Value, default); }); } diff --git a/Hohoema.Core/Models/Player/Video/Comment/CommentClient.cs b/Hohoema.Core/Models/Player/Video/Comment/CommentClient.cs index 70d930e3..2cc71e7d 100644 --- a/Hohoema.Core/Models/Player/Video/Comment/CommentClient.cs +++ b/Hohoema.Core/Models/Player/Video/Comment/CommentClient.cs @@ -34,7 +34,7 @@ public CommentClient(NiconicoSession niconicoSession, string rawVideoid) public string RawVideoId { get; } public string VideoOwnerId => _watchApiData!.Owner.Id.ToString(); - internal DmcWatchApiData? _watchApiData { get; set; } + internal NicoVideoWatchApiResponse.Response? _watchApiData { get; set; } private readonly NiconicoSession _niconicoSession; @@ -48,7 +48,7 @@ public async Task SubmitComment(string comment, TimeSpan posi Guard.IsNotNull(_watchApiData); VideoId videoId = _watchApiData.Video.Id; - NiconicoToolkit.Video.Watch.Thread mainThread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Main); + NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse.Thread mainThread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Main); string threadId = mainThread.Id.ToString(); bool isPostCompleted = false; @@ -86,7 +86,7 @@ public bool IsAllowAnnonimityComment { if (_watchApiData == null) { return false; } - return _watchApiData.Channel == null && _watchApiData.Community == null; + return _watchApiData.Channel == null; } } @@ -154,7 +154,7 @@ private async Task GetPostKeyLatestAsync(string threadForkLabel, Cancell if (threadForkLabel == ThreadTargetForkConstants.Main) { Guard.IsNotNull(_watchApiData); - NiconicoToolkit.Video.Watch.Thread thread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Main); + NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse.Thread thread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Main); ThreadPostKeyResponse res = await _nvCommentApi.GetPostKeyAsync(thread.Id.ToString(), ct); Guard.IsTrue(res.IsSuccess); @@ -163,7 +163,7 @@ private async Task GetPostKeyLatestAsync(string threadForkLabel, Cancell else if (threadForkLabel == ThreadTargetForkConstants.Easy) { Guard.IsNotNull(_watchApiData); - NiconicoToolkit.Video.Watch.Thread thread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Easy); + NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse.Thread thread = _watchApiData.Comment.Threads.First(x => x.ForkLabel == ThreadTargetForkConstants.Easy); ThreadEasyPostKeyResponse res = await _nvCommentApi.GetEasyPostKeyAsync(thread.Id.ToString(), ct); Guard.IsTrue(res.IsSuccess); diff --git a/Hohoema.Core/Models/Player/Video/NicoVideoSessionProvider.cs b/Hohoema.Core/Models/Player/Video/NicoVideoSessionProvider.cs index 2f2c4dde..2bcc7f24 100644 --- a/Hohoema.Core/Models/Player/Video/NicoVideoSessionProvider.cs +++ b/Hohoema.Core/Models/Player/Video/NicoVideoSessionProvider.cs @@ -12,6 +12,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using Windows.Foundation; +using static NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse; namespace Hohoema.Models.Player.Video; @@ -43,41 +44,41 @@ public interface INicoVideoDetails : IVideoDetail public class DmcVideoDetails : INicoVideoDetails { - private readonly DmcWatchApiData _dmcWatchRes; + private readonly Response _res; - internal DmcVideoDetails(DmcWatchApiData dmcWatchData) + internal DmcVideoDetails(Response dmcWatchData) { - _dmcWatchRes = dmcWatchData; - Tags = _dmcWatchRes.Tag.Items.Select(x => new NicoVideoTag(x.Name)).ToArray(); + _res = dmcWatchData; + Tags = _res.Tag.Items.Select(x => new NicoVideoTag(x.Name)).ToArray(); } - public VideoId VideoId => _dmcWatchRes.Video.Id; + public VideoId VideoId => _res.Video.Id; - public string Title => _dmcWatchRes.Video.Title; + public string Title => _res.Video.Title; public NicoVideoTag[] Tags { get; } - public string ThumbnailUrl => _dmcWatchRes.Video.Thumbnail.LargeUrl?.OriginalString ?? _dmcWatchRes.Video.Thumbnail.MiddleUrl?.OriginalString ?? _dmcWatchRes.Video.Thumbnail.Url?.OriginalString; + public string ThumbnailUrl => _res.Video.Thumbnail.LargeUrl ?? _res.Video.Thumbnail.MiddleUrl ?? _res.Video.Thumbnail.Url; - public TimeSpan VideoLength => TimeSpan.FromSeconds(_dmcWatchRes.Video.Duration); + public TimeSpan VideoLength => TimeSpan.FromSeconds(_res.Video.Duration); - public DateTime SubmitDate => _dmcWatchRes.Video.RegisteredAt.DateTime; + public DateTime SubmitDate => _res.Video.RegisteredAt; - public int ViewCount => _dmcWatchRes.Video.Count.View; + public int ViewCount => _res.Video.Count.View; - public int CommentCount => _dmcWatchRes.Video.Count.Comment; + public int CommentCount => _res.Video.Count.Comment; - public int MylistCount => _dmcWatchRes.Video.Count.Mylist; + public int MylistCount => _res.Video.Count.Mylist; - public string ProviderId => _dmcWatchRes.Owner?.Id.ToString() ?? _dmcWatchRes.Channel?.Id; - public string ProviderName => _dmcWatchRes.Owner?.Nickname ?? _dmcWatchRes.Channel?.Name; + public string ProviderId => _res.Owner?.Id.ToString() ?? _res.Channel?.Id; + public string ProviderName => _res.Owner?.Nickname ?? _res.Channel?.Name; - public string OwnerIconUrl => _dmcWatchRes.Owner?.IconUrl.OriginalString ?? _dmcWatchRes.Channel?.Thumbnail.Url.OriginalString; + public string OwnerIconUrl => _res.Owner?.IconUrl ?? _res.Channel?.Thumbnail.Url.OriginalString; - public bool IsChannelOwnedVideo => _dmcWatchRes.Channel != null; + public bool IsChannelOwnedVideo => _res.Channel != null; - public string DescriptionHtml => _dmcWatchRes.Video.Description; + public string DescriptionHtml => _res.Video.Description; public double LoudnessCorrectionValue { @@ -85,13 +86,13 @@ public double LoudnessCorrectionValue { try { - if (_dmcWatchRes.Media.Delivery != null) + if (_res.Media.Delivery != null) { - return _dmcWatchRes.Media.Delivery.Movie.Audios[0].Metadata.LoudnessCollection[0].Value; + return _res.Media.Delivery.Movie.Audios[0].LoudnessCollection[0].Value.Value; } - else if (_dmcWatchRes.Media.Domand != null) + else if (_res.Media.Domand != null) { - return _dmcWatchRes.Media.Domand.Audios.FirstOrDefault(x => x.IsAvailable ?? false)?.LoudnessCollection[0].Value ?? 1; + return _res.Media.Domand.Audios.FirstOrDefault(x => x.IsAvailable ?? false)?.LoudnessCollection[0].Value ?? 1; } } catch { } @@ -101,14 +102,14 @@ public double LoudnessCorrectionValue } - public bool IsSeriesVideo => _dmcWatchRes?.Series != null; - public WatchApiSeries Series => _dmcWatchRes?.Series; + public bool IsSeriesVideo => _res?.Series != null; + public WatchApiSeries Series => _res?.Series; - public bool IsLikedVideo => _dmcWatchRes.Video.Viewer?.Like.IsLiked ?? false; + public bool IsLikedVideo => _res.Video.Viewer?.Like.IsLiked ?? false; string IVideoDetail.Description => DescriptionHtml; - bool IVideoDetail.IsDeleted => _dmcWatchRes.Video.IsDeleted; + bool IVideoDetail.IsDeleted => _res.Video.IsDeleted.Value; VideoPermission IVideoDetail.Permission => throw new NotSupportedException(); @@ -117,7 +118,7 @@ public double LoudnessCorrectionValue DateTime IVideoContent.PostedAt => SubmitDate; - OwnerType IVideoContentProvider.ProviderType => _dmcWatchRes.Channel != null ? OwnerType.Channel : OwnerType.User; + OwnerType IVideoContentProvider.ProviderType => _res.Channel != null ? OwnerType.Channel : OwnerType.User; string IVideoDetail.ProviderIconUrl => OwnerIconUrl; @@ -147,7 +148,7 @@ public class PreparePlayVideoResult : INiconicoVideoSessionProvider, INiconicoCo public ImmutableArray AvailableQualities { get; } private readonly NicoVideoSessionOwnershipManager _ownershipManager; - private readonly DmcWatchApiData _dmcWatchData; + private readonly Response _dmcWatchData; private readonly bool _isForceDmc; private readonly NiconicoSession _niconicoSession; @@ -165,7 +166,7 @@ public PreparePlayVideoResult(VideoId contentId, NiconicoSession niconicoSession IsSuccess = false; } - public PreparePlayVideoResult(VideoId contentId, NiconicoSession niconicoSession, PreparePlayVideoFailedReason failedReason, DmcWatchApiData dmcWatchData = null) + public PreparePlayVideoResult(VideoId contentId, NiconicoSession niconicoSession, PreparePlayVideoFailedReason failedReason, Response dmcWatchData = null) : this(contentId, niconicoSession) { AvailableQualities = ImmutableArray.Empty; @@ -174,7 +175,7 @@ public PreparePlayVideoResult(VideoId contentId, NiconicoSession niconicoSession _dmcWatchData = dmcWatchData; } - public PreparePlayVideoResult(VideoId contentId, NiconicoSession niconicoSession, NicoVideoSessionOwnershipManager ownershipManager, DmcWatchApiData dmcWatchData, bool isForceDmc) + public PreparePlayVideoResult(VideoId contentId, NiconicoSession niconicoSession, NicoVideoSessionOwnershipManager ownershipManager, Response dmcWatchData, bool isForceDmc) : this(contentId, niconicoSession) { _ownershipManager = ownershipManager; @@ -185,7 +186,7 @@ public PreparePlayVideoResult(VideoId contentId, NiconicoSession niconicoSession if (_isForceDmc && _dmcWatchData?.Media.Delivery is not null) { AvailableQualities = _dmcWatchData.Media.Delivery.Movie.Videos - .Select(x => new NicoVideoQualityEntity(x.IsAvailable, QualityIdToNicoVideoQuality(x.Id), x.Id, (int)x.Metadata.Bitrate, (int)x.Metadata.Resolution.Width, (int)x.Metadata.Resolution.Height) { Label = x.Metadata.Label }) + .Select(x => new NicoVideoQualityEntity(x.IsAvailable.Value, QualityIdToNicoVideoQuality(x.Id), x.Id, (int)x.BitRate.Value, (int)x.Width, (int)x.Height) { Label = x.Label }) .ToImmutableArray(); } else if (_dmcWatchData?.Media.Domand is { } domand) @@ -197,7 +198,7 @@ public PreparePlayVideoResult(VideoId contentId, NiconicoSession niconicoSession else if (_dmcWatchData?.Media.Delivery is { } delivery) { AvailableQualities = delivery.Movie.Videos - .Select(x => new NicoVideoQualityEntity(x.IsAvailable, QualityIdToNicoVideoQuality(x.Id), x.Id, (int)x.Metadata.Bitrate, (int)x.Metadata.Resolution.Width, (int)x.Metadata.Resolution.Height) { Label = x.Metadata.Label }) + .Select(x => new NicoVideoQualityEntity(x.IsAvailable.Value, QualityIdToNicoVideoQuality(x.Id), x.Id, (int)x.BitRate.Value, (int)x.Width, (int)x.Height) { Label = x.Label }) .ToImmutableArray(); } else @@ -246,25 +247,14 @@ public bool CanPlayQuality(string qualityId) } } else if (_dmcWatchData.Media.Delivery is not null and var delivery) - { - NicoVideoSessionOwnershipManager.VideoSessionOwnership ownership = await _ownershipManager.TryRentVideoSessionOwnershipAsync(_dmcWatchData.Video.Id, !IsForCacheDownload); - if (ownership != null) - { - streamingSession = new DmcVideoStreamingSession(qualityEntity.QualityId, _dmcWatchData, _niconicoSession, ownership); - } - - } - else if (_dmcWatchData.Media.DeliveryLegacy != null) { - throw new NotSupportedException("DmcWatchResponse.Media.DeliveryLegacy is not supported"); - /* - var ownership = await _ownershipManager.TryRentVideoSessionOwnershipAsync(_dmcWatchData.DmcWatchResponse.Video.Id, !IsForCacheDownload); - if (ownership != null) - { - streamingSession = new SmileVideoStreamingSession( - new Uri(_dmcWatchData.DmcWatchResponse.Video.SmileInfo.Url), _niconicoSession, ownership); - } - */ + throw new NotSupportedException("DmcWatchResponse.Media.Delivery is not supported"); + //NicoVideoSessionOwnershipManager.VideoSessionOwnership ownership = await _ownershipManager.TryRentVideoSessionOwnershipAsync(_dmcWatchData.Video.Id, !IsForCacheDownload); + //if (ownership != null) + //{ + // streamingSession = new DmcVideoStreamingSession(qualityEntity.QualityId, _dmcWatchData, _niconicoSession, ownership); + //} + } else { @@ -289,10 +279,10 @@ public Task> CreateCommentSessionAsync() return _dmcWatchData != null ? CreateCommentSession(ContentId, _dmcWatchData) : throw new NotSupportedException(); } - private Task> CreateCommentSession(string contentId, DmcWatchApiData watchData) + private Task> CreateCommentSession(string contentId, Response watchData) { CommentClient commentClient = new(_niconicoSession, contentId); - DmcWatchApiData dmcRes = watchData; + Response dmcRes = watchData; //commentClient.CommentServerInfo = new CommentServerInfo() //{ // ServerUrl = dmcRes.Comment.Threads[0].Server.OriginalString, @@ -513,34 +503,34 @@ public async Task PreparePlayVideoAsync(VideoId rawVideo try { - WatchPageResponse dmcRes = await _nicoVideoProvider.GetWatchPageResponseAsync(rawVideoId, noHistory); - if (dmcRes.WatchApiResponse is null) + var dmcRes = await _nicoVideoProvider.GetWatchPageResponseAsync(rawVideoId, noHistory); + if (dmcRes.Data.Response.Video is null) { throw new NotSupportedException("視聴不可:視聴ページの取得または解析に失敗"); } - else if (dmcRes.WatchApiResponse.WatchApiData.Video.IsDeleted) + else if (dmcRes.Data.Response.Video.IsDeleted.Value) { - return new PreparePlayVideoResult(rawVideoId, _niconicoSession, PreparePlayVideoFailedReason.Deleted, dmcRes.WatchApiResponse.WatchApiData); + return new PreparePlayVideoResult(rawVideoId, _niconicoSession, PreparePlayVideoFailedReason.Deleted, dmcRes.Data.Response); } - else if (dmcRes.WatchApiResponse.WatchApiData.Media.Delivery == null && dmcRes.WatchApiResponse.WatchApiData.Media.Domand == null) + else if (dmcRes.Data.Response.Media.Domand == null) { - Preview preview = dmcRes.WatchApiResponse.WatchApiData.Payment.Preview; - if (preview.Premium.IsEnabled) + Preview preview = dmcRes.Data.Response.Payment.Preview; + if (preview.Premium.IsEnabled.Value) { - return new PreparePlayVideoResult(rawVideoId, _niconicoSession, PreparePlayVideoFailedReason.NotPlayPermit_RequirePremiumMember, dmcRes.WatchApiResponse.WatchApiData); + return new PreparePlayVideoResult(rawVideoId, _niconicoSession, PreparePlayVideoFailedReason.NotPlayPermit_RequirePremiumMember, dmcRes.Data.Response); } else { - return preview.Ppv.IsEnabled - ? new PreparePlayVideoResult(rawVideoId, _niconicoSession, PreparePlayVideoFailedReason.NotPlayPermit_RequirePay, dmcRes.WatchApiResponse.WatchApiData) - : preview.Admission.IsEnabled - ? new PreparePlayVideoResult(rawVideoId, _niconicoSession, PreparePlayVideoFailedReason.NotPlayPermit_RequireChannelMember, dmcRes.WatchApiResponse.WatchApiData) + return preview.Ppv.IsEnabled.Value + ? new PreparePlayVideoResult(rawVideoId, _niconicoSession, PreparePlayVideoFailedReason.NotPlayPermit_RequirePay, dmcRes.Data.Response) + : preview.Admission.IsEnabled.Value + ? new PreparePlayVideoResult(rawVideoId, _niconicoSession, PreparePlayVideoFailedReason.NotPlayPermit_RequireChannelMember, dmcRes.Data.Response) : throw new NotSupportedException("視聴不可:不明な理由で視聴不可"); } } - return new PreparePlayVideoResult(rawVideoId, _niconicoSession, _nicoVideoSessionOwnershipManager, dmcRes.WatchApiResponse.WatchApiData, _playerSettings.ForceUsingDmcVideoOrigin) + return new PreparePlayVideoResult(rawVideoId, _niconicoSession, _nicoVideoSessionOwnershipManager, dmcRes.Data.Response, _playerSettings.ForceUsingDmcVideoOrigin) { IsForCacheDownload = noHistory }; @@ -670,7 +660,7 @@ public class NiconicoContent public static class DmcWatchSessionExtension { - public static NicoVideoQuality ToNicoVideoQuality(this DmcWatchApiData dmcWatchData, string qualityId) + public static NicoVideoQuality ToNicoVideoQuality(this Response dmcWatchData, string qualityId) { if (dmcWatchData.Media.Domand is { } domand && domand.Videos.FirstOrDefault(x => x.Id == qualityId) is { } videoQuality @@ -687,10 +677,10 @@ public static NicoVideoQuality ToNicoVideoQuality(this DmcWatchApiData dmcWatchD }; } - VideoContent dmcVideoContent = dmcWatchData?.Media.Delivery.Movie.Videos.FirstOrDefault(x => x.Id == qualityId); + NicoVideoWatchApiResponse.Video dmcVideoContent = dmcWatchData?.Media.Delivery.Movie.Videos.FirstOrDefault(x => x.Id == qualityId); if (dmcVideoContent != null) { - VideoContent[] qualities = dmcWatchData.Media.Delivery.Movie.Videos; + NicoVideoWatchApiResponse.Video[] qualities = dmcWatchData.Media.Delivery.Movie.Videos; int index = Array.IndexOf(qualities, dmcVideoContent); // DmcInfo.Quality の要素数は動画によって1~5個まで様々である diff --git a/Hohoema.Core/Models/Player/Video/VideoStreamingSession/DmcVideoStreamingSession.cs b/Hohoema.Core/Models/Player/Video/VideoStreamingSession/DmcVideoStreamingSession.cs deleted file mode 100644 index d1d729a2..00000000 --- a/Hohoema.Core/Models/Player/Video/VideoStreamingSession/DmcVideoStreamingSession.cs +++ /dev/null @@ -1,249 +0,0 @@ -#nullable enable -using CommunityToolkit.Diagnostics; -using Hohoema.Models.Niconico.Video; -using NiconicoToolkit.Video.Watch; -using NiconicoToolkit.Video.Watch.Dmc; -using System; -using System.Diagnostics; -using System.Linq; -using System.Net; -using System.Threading; -using System.Threading.Tasks; -using Windows.Media.Core; -using Windows.Media.Streaming.Adaptive; -using NiconicoSession = Hohoema.Models.Niconico.NiconicoSession; - -namespace Hohoema.Models.Player.Video; - -public class DmcVideoStreamingSession : VideoStreamingSession, IVideoStreamingDownloadSession -{ - // Note: 再生中のハートビート管理を含めた管理 - // MediaSourceをMediaPlayerに設定する役割 - - private DmcWatchApiData _dmcWatchData; - private readonly bool _forCacheDownload; - private DmcSessionResponse _dmcSessionResponse; - - private Timer _DmcSessionHeartbeatTimer; - - private int _HeartbeatCount = 0; - private bool IsFirstHeartbeat => _HeartbeatCount == 0; - - public VideoContent VideoContent { get; private set; } - - public override string QualityId { get; protected set; } - public override NicoVideoQuality Quality { get; protected set; } - - - - public DmcVideoStreamingSession(string qualityId, DmcWatchApiData res, NiconicoSession niconicoSession, NicoVideoSessionOwnershipManager.VideoSessionOwnership videoSessionOwnership, bool forCacheDownload = false) - : base(niconicoSession, videoSessionOwnership) - { - _dmcWatchData = res; - _forCacheDownload = forCacheDownload; - -#if DEBUG - Debug.WriteLine($"Id/Bitrate/Resolution/Available"); - foreach (VideoContent q in _dmcWatchData.Media.Delivery.Movie.Videos) - { - Debug.WriteLine($"{q.Id}/{q.Metadata.Bitrate}/{q.IsAvailable}/{q.Metadata.Resolution}"); - } -#endif - - SetQuality(qualityId); - } - - public string[] GetAllQualities() - { - return _dmcWatchData.Media.Delivery.Movie.Videos.Select(x => x.Id).ToArray(); - } - - private string GetQualityId(NicoVideoQuality quality) - { - return _dmcWatchData.Media.Delivery.Movie.Videos.Select(x => (VideoContent: x, Quality: _dmcWatchData.ToNicoVideoQuality(x.Id))) - .First(x => x.Quality == quality).VideoContent.Id; - } - - public void SetQuality(NicoVideoQuality quality) - { - SetQuality(GetQualityId(quality)); - } - - public void SetQuality(string qualityId) - { - QualityId = qualityId; - Quality = _dmcWatchData.ToNicoVideoQuality(qualityId); - - VideoContent = _dmcWatchData.Media.Delivery.Movie.Videos.FirstOrDefault(x => x.Id == qualityId); - - if (VideoContent != null) - { - Debug.WriteLine($"{VideoContent.Id}/{VideoContent.Metadata.Bitrate}/{VideoContent.IsAvailable}/w={VideoContent.Metadata.Resolution.Width} h={VideoContent.Metadata.Resolution.Height}"); - } - } - - private async Task GetDmcSessionAsync() - { - if (_dmcWatchData?.Media == null) { return null; } - - if (VideoContent == null) - { - return null; - } - - try - { - // 直前に同一動画を見ていた場合には、動画ページに再アクセスする - if (_dmcSessionResponse != null) - { - // 画質変更時 - var clearPreviousSession = _dmcSessionResponse; - _dmcSessionResponse = null; - var res = await NiconicoSession.ToolkitContext.Video.VideoWatch.GetDmcWatchJsonAsync(_dmcWatchData.Client.WatchId, NiconicoSession.IsLoggedIn, _dmcWatchData.Client.WatchTrackId); - Guard.IsTrue(res.IsSuccess); - _dmcWatchData = res.Data; - - await NiconicoSession.ToolkitContext.Video.VideoWatch.DmcSessionExitHeartbeatAsync(_dmcWatchData, clearPreviousSession); - - bool watchResult = await NiconicoSession.ToolkitContext.Video.VideoWatch.SendOfficialHlsWatchAsync(_dmcWatchData.Client.WatchId, _dmcWatchData.Client.WatchTrackId); - Debug.WriteLine($"watchresult: {watchResult}"); - _dmcSessionResponse = await NiconicoSession.ToolkitContext.Video.VideoWatch.GetDmcSessionResponseAsync(_dmcWatchData, VideoContent, null, hlsMode: true); - } - else - { - await NiconicoSession.ToolkitContext.Video.VideoWatch.SendOfficialHlsWatchAsync(_dmcWatchData.Video.Id, _dmcWatchData.Media.Delivery.TrackingId); - _dmcSessionResponse = await NiconicoSession.ToolkitContext.Video.VideoWatch.GetDmcSessionResponseAsync(_dmcWatchData, VideoContent, null, hlsMode: true); - } - - - if (_dmcSessionResponse == null) { return null; } - } - catch - { - return null; - } - - return _dmcSessionResponse; - } - - protected override async Task GetPlyaingVideoMediaSource() - { - if (!NiconicoSession.ToolkitContext.HttpClient.DefaultRequestHeaders.ContainsKey("Origin")) - { - NiconicoSession.ToolkitContext.HttpClient.DefaultRequestHeaders.Add("Origin", "https://www.nicovideo.jp"); - } - - NiconicoSession.ToolkitContext.HttpClient.DefaultRequestHeaders.Referer = new Uri($"https://www.nicovideo.jp/watch/{_dmcWatchData.Video.Id}"); - - - DmcSessionResponse session = await GetDmcSessionAsync(); - - if (session == null) - { - if (_dmcWatchData.Media.DeliveryLegacy != null) - { - throw new NotSupportedException("DmcWatchResponse.Media.DeliveryLegacy not supported"); - } - else - { - throw new Infra.HohoemaException(); - } - } - - Uri uri = session?.Data.Session.ContentUri; - Debug.WriteLine(uri.OriginalString); - if (session.Data.Session.Protocol.Parameters.HttpParameters.Parameters.HttpOutputDownloadParameters != null) - { - return MediaSource.CreateFromUri(uri); - } - else if (session.Data.Session.Protocol.Parameters.HttpParameters.Parameters.HlsParameters != null) - { - AdaptiveMediaSourceCreationResult amsResult = await AdaptiveMediaSource.CreateFromUriAsync(uri, NiconicoSession.ToolkitContext.HttpClient); - if (amsResult.Status == AdaptiveMediaSourceCreationStatus.Success) - { - return MediaSource.CreateFromAdaptiveMediaSource(amsResult.MediaSource); - } - else - { - throw amsResult.ExtendedError; - } - } - - throw new NotSupportedException(""); - } - - public async Task GetDownloadUrlAndSetupDownloadSession() - { - DmcSessionResponse session = await GetDmcSessionAsync(); - Uri videoUri = session?.Data.Session.ContentUri; - - if (videoUri != null) - { - OnStartStreaming(); - - return videoUri; - } - else - { - return null; - } - } - - protected override void OnStartStreaming() - { - if (_dmcWatchData != null && _dmcSessionResponse != null) - { - Debug.WriteLine($"{_dmcWatchData.Video.Title} のハートビートを開始しました"); - - _DmcSessionHeartbeatTimer?.Dispose(); - _DmcSessionHeartbeatTimer = new Timer(_DmcSessionHeartbeatTimer_Tick, this, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30)); - } - } - - private async void _DmcSessionHeartbeatTimer_Tick(object state) - { - Debug.WriteLine($"{_dmcWatchData.Video.Title} のハートビート {_HeartbeatCount + 1}回目"); - - DmcVideoStreamingSession _this = (DmcVideoStreamingSession)state; - - if (_this.IsFirstHeartbeat) - { - await _this.NiconicoSession.ToolkitContext.Video.VideoWatch.DmcSessionFirstHeartbeatAsync(_dmcWatchData, _dmcSessionResponse); - Debug.WriteLine($"{_this._dmcWatchData.Video.Title} の初回ハートビート実行"); - await Task.Delay(2); - } - else - { - try - { - await _this.NiconicoSession.ToolkitContext.Video.VideoWatch.DmcSessionHeartbeatAsync(_this._dmcWatchData, _dmcSessionResponse); - Debug.WriteLine($"{_this._dmcWatchData.Video.Title} のハートビート実行"); - } - catch - { - _this.OnStopStreaming(); - } - } - - _this._HeartbeatCount++; - } - - protected override async void OnStopStreaming() - { - if (_DmcSessionHeartbeatTimer != null) - { - _DmcSessionHeartbeatTimer.Dispose(); - _DmcSessionHeartbeatTimer = null; - Debug.WriteLine($"{_dmcWatchData.Video.Title} のハートビートを終了しました"); - } - - try - { - if (_dmcSessionResponse != null) - { - await NiconicoSession.ToolkitContext.Video.VideoWatch.DmcSessionLeaveAsync(_dmcWatchData, _dmcSessionResponse); - } - } - catch { } - } -} diff --git a/Hohoema.Core/Models/Player/Video/VideoStreamingSession/DomandStreamingSession.cs b/Hohoema.Core/Models/Player/Video/VideoStreamingSession/DomandStreamingSession.cs index 7ea52d58..81e385b1 100644 --- a/Hohoema.Core/Models/Player/Video/VideoStreamingSession/DomandStreamingSession.cs +++ b/Hohoema.Core/Models/Player/Video/VideoStreamingSession/DomandStreamingSession.cs @@ -12,17 +12,18 @@ using NiconicoToolkit.Video.Watch.Domand; using Windows.Media.Core; using Windows.Media.Streaming.Adaptive; +using static NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse; namespace Hohoema.Models.Player.Video; public sealed class DomandStreamingSession : VideoStreamingSession { private readonly NiconicoContext _context; - private readonly DmcWatchApiData _watchApiData; - private readonly MediaDomand _domand; + private readonly Response _watchApiData; + private readonly Domand _domand; public DomandStreamingSession( - DmcWatchApiData watchApiData, - MediaDomand domand, + Response watchApiData, + Domand domand, NiconicoSession niconicoSession, NicoVideoSessionOwnershipManager.VideoSessionOwnership videoSessionOwnership) : base(niconicoSession, videoSessionOwnership) @@ -40,11 +41,11 @@ public DomandStreamingSession( public override string QualityId { get; protected set; } public override NicoVideoQuality Quality { get; protected set; } - public DomandAudio AudioQuality { get; set; } - public DomandVideo VideoQuality { get; set; } + public NicoVideoWatchApiResponse.Audio AudioQuality { get; set; } + public NicoVideoWatchApiResponse.Video VideoQuality { get; set; } - public List GetVideoQualities() => _watchApiData.Media.Domand.Videos; - public List GetAudioQualities() => _watchApiData.Media.Domand.Audios; + public List GetVideoQualities() => _watchApiData.Media.Domand.Videos; + public List GetAudioQualities() => _watchApiData.Media.Domand.Audios; public void SetQuality(NicoVideoQuality quality) { diff --git a/Hohoema.Core/Models/Playlist/HohoemaPlaylistPlayer.cs b/Hohoema.Core/Models/Playlist/HohoemaPlaylistPlayer.cs index a8796b8b..67f4b2f9 100644 --- a/Hohoema.Core/Models/Playlist/HohoemaPlaylistPlayer.cs +++ b/Hohoema.Core/Models/Playlist/HohoemaPlaylistPlayer.cs @@ -1,4 +1,5 @@ #nullable enable +using AngleSharp.Attributes; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Messaging; using CommunityToolkit.Mvvm.Messaging.Messages; @@ -541,15 +542,13 @@ public async Task ChangeQualityAsync(NicoVideoQualityEntity qualityEntity) TimeSpan? currentPosition = GetCurrentPlaybackPosition(); IStreamingSession videoSession; - if (_videoSessionDisposable is not DmcVideoStreamingSession dmcSession) + if (_videoSessionDisposable is DomandStreamingSession dommandSession) { videoSession = await CurrentPlayingSession.VideoSessionProvider.CreateVideoSessionAsync(qualityEntity); } else { - dmcSession.StopPlayback(); - dmcSession.SetQuality(qualityEntity.QualityId); - videoSession = dmcSession; + throw new NotSupportedException("Not supported video playback quality on not DomandStreamingSession."); } if (qualityEntity.IsAvailable is false) diff --git a/Hohoema.Core/Models/VideoCache/VideoCacheDownloadOperation.cs b/Hohoema.Core/Models/VideoCache/VideoCacheDownloadOperation.cs index 6e796297..3e0af582 100644 --- a/Hohoema.Core/Models/VideoCache/VideoCacheDownloadOperation.cs +++ b/Hohoema.Core/Models/VideoCache/VideoCacheDownloadOperation.cs @@ -25,7 +25,7 @@ public class VideoCacheDownloadOperation : IDisposable, IVideoCacheDownloadOpera public VideoCacheItem VideoCacheItem { get; } private readonly VideoCacheManager _videoCacheManager; - private readonly DmcVideoStreamingSession _dmcVideoStreamingSession; + private readonly object _dmcVideoStreamingSession; private readonly IVideoCacheDownloadOperationOutput _videoCacheDownloadOperationOutput; private CancellationTokenSource _cancellationTokenSource; private CancellationTokenSource _pauseCancellationTokenSource; @@ -37,8 +37,10 @@ public class VideoCacheDownloadOperation : IDisposable, IVideoCacheDownloadOpera public event EventHandler Progress; public event EventHandler Completed; - internal VideoCacheDownloadOperation(VideoCacheManager videoCacheManager, VideoCacheItem videoCacheItem, DmcVideoStreamingSession dmcVideoStreamingSession, IVideoCacheDownloadOperationOutput videoCacheDownloadOperationOutput) + internal VideoCacheDownloadOperation(VideoCacheManager videoCacheManager, VideoCacheItem videoCacheItem, object dmcVideoStreamingSession, IVideoCacheDownloadOperationOutput videoCacheDownloadOperationOutput) { + throw new NotSupportedException(); + _videoCacheManager = videoCacheManager; VideoCacheItem = videoCacheItem; _dmcVideoStreamingSession = dmcVideoStreamingSession; @@ -55,8 +57,8 @@ public async Task DownloadAsync() IRandomAccessStream downloadStream = null; try { - Uri uri = await _dmcVideoStreamingSession.GetDownloadUrlAndSetupDownloadSession(); - downloadStream = await HttpRandomAccessStream.CreateAsync(_dmcVideoStreamingSession.NiconicoSession.ToolkitContext.HttpClient, uri); + //Uri uri = await _dmcVideoStreamingSession.GetDownloadUrlAndSetupDownloadSession(); + //downloadStream = await HttpRandomAccessStream.CreateAsync(_dmcVideoStreamingSession.NiconicoSession.ToolkitContext.HttpClient, uri); } catch { @@ -72,7 +74,7 @@ public async Task DownloadAsync() _pauseCancellationTokenSource = new CancellationTokenSource(); _linkedCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(_cancellationTokenSource.Token, _onwerShipReturnedCancellationTokenSource.Token, _pauseCancellationTokenSource.Token); - _dmcVideoStreamingSession.StopStreamingFromOwnerShipReturned += _dmcVideoStreamingSession_StopStreamingFromOwnerShipReturned; + //_dmcVideoStreamingSession.StopStreamingFromOwnerShipReturned += _dmcVideoStreamingSession_StopStreamingFromOwnerShipReturned; try { @@ -111,7 +113,7 @@ public async Task DownloadAsync() finally { _ = _cancelAwaitTcs.TrySetResult(true); - _dmcVideoStreamingSession.StopStreamingFromOwnerShipReturned -= _dmcVideoStreamingSession_StopStreamingFromOwnerShipReturned; + //_dmcVideoStreamingSession.StopStreamingFromOwnerShipReturned -= _dmcVideoStreamingSession_StopStreamingFromOwnerShipReturned; downloadStream.Dispose(); _onwerShipReturnedCancellationTokenSource.Dispose(); _pauseCancellationTokenSource.Dispose(); @@ -148,7 +150,7 @@ public async Task CancelAsync() void IDisposable.Dispose() { - _dmcVideoStreamingSession.Dispose(); + //_dmcVideoStreamingSession.Dispose(); } public Task PauseAsync() diff --git a/Hohoema.Core/Models/VideoCache/VideoCacheManager.cs b/Hohoema.Core/Models/VideoCache/VideoCacheManager.cs index 83778fbd..da301dff 100644 --- a/Hohoema.Core/Models/VideoCache/VideoCacheManager.cs +++ b/Hohoema.Core/Models/VideoCache/VideoCacheManager.cs @@ -323,8 +323,8 @@ public async Task GetCacheVideoMediaSource(VideoCacheItem item) } // require watch permission - NiconicoToolkit.Video.Watch.WatchPageResponse watchData = await _niconicoSession.ToolkitContext.Video.VideoWatch.GetInitialWatchDataAsync(item.VideoId); - NiconicoToolkit.Video.Watch.DmcWatchApiData watchApiData = watchData?.WatchApiResponse?.WatchApiData; + NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse watchData = await _niconicoSession.ToolkitContext.Video.VideoWatch.GetWatchDataAsync(item.VideoId); + NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse.Response watchApiData = watchData.Data.Response; if (watchApiData?.Media?.Delivery is null) { throw new VideoCacheException("VideoCacheItem is can not play, require content access permission. reason : " + watchApiData?.OkReason); @@ -689,9 +689,8 @@ internal async ValueTask CreateDownlo try { - NiconicoToolkit.Video.Watch.WatchPageResponse res = await _niconicoSession.ToolkitContext.Video.VideoWatch.GetInitialWatchDataAsync(item.VideoId, false, false); - NiconicoToolkit.Video.Watch.DmcWatchApiData watchApiData = res.WatchApiResponse?.WatchApiData; - + NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse watchData = await _niconicoSession.ToolkitContext.Video.VideoWatch.GetWatchDataAsync(item.VideoId); + NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse.Response watchApiData = watchData.Data.Response; if (watchApiData is null) { @@ -825,10 +824,11 @@ internal async ValueTask CreateDownlo UpdateVideoCacheEntity(item); - DmcVideoStreamingSession dmcVideoStreamingSession = new(NicoVideoCacheQualityHelper.CacheQualityToQualityId(candidateDownloadingQuality), watchApiData, _niconicoSession, videoSessionOwnershipRentResult, forCacheDownload: true); - VideoCacheDownloadOperation op = new(this, item, dmcVideoStreamingSession, new VideoCacheDownloadOperationOutputWithEncryption(outputFile, Xts)); + //DmcVideoStreamingSession dmcVideoStreamingSession = new(NicoVideoCacheQualityHelper.CacheQualityToQualityId(candidateDownloadingQuality), watchApiData, _niconicoSession, videoSessionOwnershipRentResult, forCacheDownload: true); + //VideoCacheDownloadOperation op = new(this, item, dmcVideoStreamingSession, new VideoCacheDownloadOperationOutputWithEncryption(outputFile, Xts)); - return new VideoCacheDownloadOperationCreationResult(op); + //return new VideoCacheDownloadOperationCreationResult(op); + throw new NotSupportedException(); } catch { diff --git a/Hohoema/Package.appxmanifest b/Hohoema/Package.appxmanifest index dcdbd6eb..26e8cc05 100644 --- a/Hohoema/Package.appxmanifest +++ b/Hohoema/Package.appxmanifest @@ -1,6 +1,6 @@  - + Hohoema diff --git a/Hohoema/Services/Player/Videos/VideoEndedRecommendation.cs b/Hohoema/Services/Player/Videos/VideoEndedRecommendation.cs index 983992fe..4a4ae76a 100644 --- a/Hohoema/Services/Player/Videos/VideoEndedRecommendation.cs +++ b/Hohoema/Services/Player/Videos/VideoEndedRecommendation.cs @@ -18,6 +18,7 @@ using System.Threading.Tasks; using Windows.Media.Playback; using Windows.System; +using static NiconicoToolkit.Video.Watch.NicoVideoWatchApiResponse; namespace Hohoema.Services.Player; diff --git a/Hohoema/Views.Niconico/Video/VideoInfomationPageViewModel.cs b/Hohoema/Views.Niconico/Video/VideoInfomationPageViewModel.cs index f00ac9fa..5557dca8 100644 --- a/Hohoema/Views.Niconico/Video/VideoInfomationPageViewModel.cs +++ b/Hohoema/Views.Niconico/Video/VideoInfomationPageViewModel.cs @@ -796,9 +796,9 @@ public class HyperlinkItem public class VideoSeriesViewModel : ISeries { - private readonly WatchApiSeries _userSeries; + private readonly NicoVideoWatchApiResponse.WatchApiSeries _userSeries; - public VideoSeriesViewModel(WatchApiSeries userSeries) + public VideoSeriesViewModel(NicoVideoWatchApiResponse.WatchApiSeries userSeries) { _userSeries = userSeries; } diff --git a/Hohoema/Views.Player/VideoPlayerPageViewModel.cs b/Hohoema/Views.Player/VideoPlayerPageViewModel.cs index 2ee2104f..cb81211d 100644 --- a/Hohoema/Views.Player/VideoPlayerPageViewModel.cs +++ b/Hohoema/Views.Player/VideoPlayerPageViewModel.cs @@ -703,9 +703,9 @@ private void SetSidePaneViewModel(PlayerSidePaneContentType sidePaneType) public class VideoSeriesViewModel : ISeries { - private readonly WatchApiSeries _userSeries; + private readonly NicoVideoWatchApiResponse.WatchApiSeries _userSeries; - public VideoSeriesViewModel(WatchApiSeries userSeries) + public VideoSeriesViewModel(NicoVideoWatchApiResponse.WatchApiSeries userSeries) { _userSeries = userSeries; } diff --git a/Hohoema/Views/PrimaryWindowCoreLayoutViewModel.cs b/Hohoema/Views/PrimaryWindowCoreLayoutViewModel.cs index 5739b668..1598dfc8 100644 --- a/Hohoema/Views/PrimaryWindowCoreLayoutViewModel.cs +++ b/Hohoema/Views/PrimaryWindowCoreLayoutViewModel.cs @@ -165,7 +165,7 @@ OpenPageCommand openPageCommand new SeparatorMenuItemViewModel(), _queueMenuItemViewModel, new NavigateAwareMenuItemViewModel(HohoemaPageType.RankingCategoryList.Translate(), HohoemaPageType.RankingCategoryList), - new NavigateAwareMenuItemViewModel(HohoemaPageType.NicoRepo.Translate(), HohoemaPageType.NicoRepo, new NavigationParameters("type=Video")), + //new NavigateAwareMenuItemViewModel(HohoemaPageType.NicoRepo.Translate(), HohoemaPageType.NicoRepo, new NavigationParameters("type=Video")), new SubscriptionMenuItemViewModel(_messenger, _subscriptionManager, _queuePlaylist, _notificationService), //new NavigateAwareMenuItemViewModel("WatchAfterMylist".Translate(), HohoemaPageType.Mylist, new NavigationParameters(("id", MylistId.WatchAfterMylistId.ToString()))), new MylistSubMenuMenu(_userMylistManager, OpenPageCommand), @@ -175,7 +175,7 @@ OpenPageCommand openPageCommand new SeparatorMenuItemViewModel(), new LogginUserLiveSummaryItemViewModel(NiconicoSession, _logger, OpenLiveContentCommand), - new NavigateAwareMenuItemViewModel(HohoemaPageType.NicoRepo.Translate(), HohoemaPageType.NicoRepo, new NavigationParameters("type=Program")), + //new NavigateAwareMenuItemViewModel(HohoemaPageType.NicoRepo.Translate(), HohoemaPageType.NicoRepo, new NavigationParameters("type=Program")), new NavigateAwareMenuItemViewModel(HohoemaPageType.Timeshift.Translate(), HohoemaPageType.Timeshift), }; @@ -1014,6 +1014,8 @@ public async void RefreshItems() _nextRefreshAvairableAt = DateTime.Now + TimeSpan.FromMinutes(1); var res = await _niconicoSession.ToolkitContext.Live.LiveNotify.GetLiveNotifyAsync(); + if (res.IsSuccess is false) { return; } + Items.Clear(); foreach (var data in res.Data.NotifyboxContent) { From 740e4276545925ce83b84077fd9f03f421e8d8b0 Mon Sep 17 00:00:00 2001 From: tor4kichi Date: Mon, 5 Aug 2024 22:30:59 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E3=82=A2=E3=83=97=E3=83=AA=E3=81=AE?= =?UTF-8?q?=E8=AA=AC=E6=98=8E=E3=82=92Windows10=E3=81=A8=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=9F=E7=82=B9=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Hohoema/Package.appxmanifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Hohoema/Package.appxmanifest b/Hohoema/Package.appxmanifest index 26e8cc05..4bf68e32 100644 --- a/Hohoema/Package.appxmanifest +++ b/Hohoema/Package.appxmanifest @@ -15,7 +15,7 @@ - +