Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using SetPriority to exclude files #703

Open
paulmortlock opened this issue Oct 21, 2024 · 6 comments
Open

Using SetPriority to exclude files #703

paulmortlock opened this issue Oct 21, 2024 · 6 comments

Comments

@paulmortlock
Copy link

I saw an example on the wiki but this does not work.

image

@paulmortlock
Copy link
Author

image

@kaedei
Copy link
Contributor

kaedei commented Oct 26, 2024

Pass ITorrentManagerFile to SetFilePriorityAsync()

await torrentManager.SetFilePriorityAsync(torrentManager.Files[0], Priority.DoNotDownload);

@paulmortlock
Copy link
Author

That does not make sense to me show me please if there is also a way to do this without using foreach as it is slow when 14K files are present.

@paulmortlock
Copy link
Author

paulmortlock commented Oct 28, 2024

This is better but I have 87K files.

                var tasks = manager.Files
                .Where(files => !StartsWithStrings.Any(prefix => files.Path.StartsWith(prefix)) ||
                                !ContainsStrings.Any(prefix => files.Path.Contains(prefix)))
                .Select(async files =>
                {
                    await manager.SetFilePriorityAsync(files, Priority.DoNotDownload);
                    n2--;
                });
                await Task.WhenAll(tasks);

@sam-ludlow
Copy link

sam-ludlow commented Dec 31, 2024

Hello

Can we have a default Priority in the Torrent settings so all files can already be set to DoNotDownload (or whatever)?

Setting them all takes a while with a lot of files.

I tried not awaiting for SetFilePriorityAsync() but then await StartAsync() took ages.

Nice work BTW, everything works like a charm for me.

Cheers
Sam

@sam-ludlow
Copy link

sam-ludlow commented Jan 5, 2025

SetFilePriorityAsync() under .net Framework 4.8 this is A LOT slow than using .net 9.0 using exactly the same code.

EDIT: Actually I would have to do more tests to say this for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants