fedarovich / qbittorrent-net-client

qBittorrent client library for .Net
MIT License
32 stars 14 forks source link

Where did `TorrentContentPriority` come from? #20

Open thytrherfvsefasfd443sf opened 1 year ago

thytrherfvsefasfd443sf commented 1 year ago

SetFilePriorityAsync seems to take TorrentContentPriority and its values are from 1 to 7. But the "set file priority" API seems to take the priority values which are 0,1,6,7.

image

The values are different from TorrentContentPriority. For example, 1 is "normal", when "4" is normal in TorrentContentPriority.

        /// <summary>
        /// Sets the file priority.
        /// </summary>
        /// <param name="hash">The torrent hash.</param>
        /// <param name="fileId">The file identifier.</param>
        /// <param name="priority">The priority.</param>
        /// <param name="token">The cancellation token.</param>
        /// <returns></returns>
        Task SetFilePriorityAsync(
            [NotNull] string hash,
            int fileId,
            TorrentContentPriority priority,
            CancellationToken token = default);

    /// <summary>
    /// Torrent content file download priority
    /// </summary>
    public enum TorrentContentPriority
    {
        /// <summary>
        /// Do not download the file (0).
        /// </summary>
        Skip = 0,

        /// <summary>
        /// The minimal priority (1). 
        /// </summary>
        Minimal = 1,

        /// <summary>
        /// The very low priority (2).
        /// </summary>
        VeryLow = 2,

        /// <summary>
        /// The low priority (3).
        /// </summary>
        Low = 3,

        /// <summary>
        /// The normal priority (4).
        /// </summary>
        Normal = 4,

        /// <summary>
        /// The high priority (5).
        /// </summary>
        High = 5,

        /// <summary>
        /// The very high priority (6).
        /// </summary>
        VeryHigh = 6,

        /// <summary>
        /// The maximal priority (7).
        /// </summary>
        Maximal = 7
    }
fedarovich commented 1 year ago

In the previous versions of qBittorent the priorities were as described in this enum. Starting from some version (I do not remember which one exactly, probably 4.1.5 or 4.2.0) the priorities were changed to the ones you specified.

I probably need to create a new enum and additional method overload to accept new priorities.