Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using HyPlayer.PlayCore.Abstraction.Models.Resources;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.Playback;

public interface IPlaybackQualitySelector
{
ResourceQualityTag? GetPlaybackQualityTag(SingleSongBase song);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using HyPlayer.PlayCore.Abstraction.Interfaces.Provider;
using HyPlayer.PlayCore.Abstraction.Models.Resources;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.Playback;

public interface IPlaybackResourceResolver
{
Task<MusicResourceBase?> ResolvePlaybackResourceAsync(
SingleSongBase song,
IMusicResourceProvidable provider,
ResourceQualityTag? qualityTag,
CancellationToken ctk = default);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using HyPlayer.PlayCore.Abstraction.Models;
using HyPlayer.PlayCore.Abstraction.Models.SingleItems;

namespace HyPlayer.PlayCore.Abstraction.Interfaces.Provider;

public interface IProvidableItemCommentPageTokenProvidable : IProvider
{
public Task<ProviderPageResult<CommentBase>> GetCommentsPageAsync(string itemId, string typeId, string? pageToken, int count, int sortType = 1, CancellationToken ctk = new());

public Task<ProviderPageResult<CommentBase>> GetThreadedCommentsPageAsync(string itemId, string typeId, string commentId, string? pageToken, int count, CancellationToken ctk = new());
}
2 changes: 2 additions & 0 deletions HyPlayer.PlayCore.Abstraction/Models/ProviderPageResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public sealed class ProviderPageResult<TItem>
/// </summary>
public int? NextOffset { get; set; }

public string? NextPageToken { get; set; }

/// <summary>
/// Gets or sets the total item count when the provider exposes one.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace HyPlayer.PlayCore.Abstraction.Models.Resources;

public interface IAudioTrialMetadata
{
bool IsTrial { get; }
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Depository.Abstraction.Interfaces;
using HyPlayer.PlayCore.Abstraction.Interfaces.AudioServices;
using HyPlayer.PlayCore.Abstraction.Interfaces.Playback;
using HyPlayer.PlayCore.Abstraction.Interfaces.Provider;
using HyPlayer.PlayCore.Abstraction;
using HyPlayer.PlayCore.Abstraction.Models.AudioServiceComponents;
Expand Down Expand Up @@ -112,7 +113,12 @@ private async Task DisposeCurrentPlayingTicketAsync(bool stopTicket, Cancellatio
if (provider is null)
return null;

return await provider.GetMusicResourceAsync(song, null, ctk).ConfigureAwait(false);
var qualityTag = ResolveOptional<IPlaybackQualitySelector>(typeof(IPlaybackQualitySelector))
?.GetPlaybackQualityTag(song);
if (ResolveOptional<IPlaybackResourceResolver>(typeof(IPlaybackResourceResolver)) is { } resolver)
return await resolver.ResolvePlaybackResourceAsync(song, provider, qualityTag, ctk).ConfigureAwait(false);

return await provider.GetMusicResourceAsync(song, qualityTag, ctk).ConfigureAwait(false);
}

private Task PublishPlaybackFailureAsync(SingleSongBase? song, string reason, Exception? exception, CancellationToken ctk)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ private async Task AppendSongContainerToList(
(hasMore, var progressiveList) = await progressiveLoadingContainer.GetProgressiveItemsListAsync(
start, progressiveLoadingContainer.MaxProgressiveCount,
ctk);
if (progressiveList.Count == 0)
break;

var resultList = progressiveList.OfType<SingleSongBase>().ToList();
list.AddRange(resultList);
_list.AddRange(resultList);
start += progressiveLoadingContainer.MaxProgressiveCount;
start += progressiveList.Count;
await _notificationHub.PublishNotificationAsync(new InnerPlayListProgressiveAddedNotification
{
AddedSongs = resultList
Expand Down
Loading