Files
allstarr/allstarr/Services/IDownloadService.cs
T
joshpatra e18840cddf feat: Fork octo-fiestarr as allstarr with Jellyfin proxy improvements
Major changes:
- Rename project from octo-fiesta to allstarr
- Add Jellyfin proxy support alongside Subsonic/Navidrome
- Implement fuzzy search with relevance scoring and Levenshtein distance
- Add POST body logging for debugging playback progress issues
- Separate local and external artists in search results
- Add +5 score boost for external results to prioritize larger catalog(probably gonna reverse it)
- Create FuzzyMatcher utility for intelligent search result scoring
- Add ConvertPlaylistToJellyfinItem method for playlist support
- Rename keys folder to apis and update gitignore
- Filter search results by relevance score (>= 40)
- Add Redis caching support with configurable settings
- Update environment configuration with backend selection
- Improve external provider integration (SquidWTF, Deezer, Qobuz)
- Add tests for all services
2026-01-29 17:36:53 -05:00

58 lines
2.5 KiB
C#

using allstarr.Models.Domain;
using allstarr.Models.Settings;
using allstarr.Models.Download;
using allstarr.Models.Search;
using allstarr.Models.Subsonic;
namespace allstarr.Services;
/// <summary>
/// Interface for the music download service (Deezspot or other)
/// </summary>
public interface IDownloadService
{
/// <summary>
/// Downloads a song from an external provider
/// </summary>
/// <param name="externalProvider">The provider (deezer, spotify)</param>
/// <param name="externalId">The ID on the external provider</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>The path to the downloaded file</returns>
Task<string> DownloadSongAsync(string externalProvider, string externalId, CancellationToken cancellationToken = default);
/// <summary>
/// Downloads a song and streams the result progressively
/// </summary>
/// <param name="externalProvider">The provider (deezer, spotify)</param>
/// <param name="externalId">The ID on the external provider</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>A stream of the audio file</returns>
Task<Stream> DownloadAndStreamAsync(string externalProvider, string externalId, CancellationToken cancellationToken = default);
/// <summary>
/// Downloads remaining tracks from an album in background (excluding the specified track)
/// </summary>
/// <param name="externalProvider">The provider (deezer, spotify)</param>
/// <param name="albumExternalId">The album ID on the external provider</param>
/// <param name="excludeTrackExternalId">The track ID to exclude (already downloaded)</param>
void DownloadRemainingAlbumTracksInBackground(string externalProvider, string albumExternalId, string excludeTrackExternalId);
/// <summary>
/// Checks if a song is currently being downloaded
/// </summary>
DownloadInfo? GetDownloadStatus(string songId);
/// <summary>
/// Gets the local path for a song if it has been downloaded already
/// </summary>
/// <param name="externalProvider">The provider (deezer, qobuz, etc.)</param>
/// <param name="externalId">The ID on the external provider</param>
/// <returns>The local file path if exists, null otherwise</returns>
Task<string?> GetLocalPathIfExistsAsync(string externalProvider, string externalId);
/// <summary>
/// Checks if the service is properly configured and functional
/// </summary>
Task<bool> IsAvailableAsync();
}