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

Add content type to streams #162

Merged
merged 4 commits into from
Aug 2, 2024

Conversation

izderadicka
Copy link
Contributor

This change is motivated by need to stream/open/download other files from torrent than mp4/mkv/avi.
Usecase is mainly if rqbit is running on other computer (like nas server) - so I can see what is in other files, download them to notebook etc. Ad there are other media files, which streams nicely in browser - mp3 ....

Changes:

  • add content-type header to stream - helps with handling the file in browser
  • change slightly when content-length is send - always when there is not content-range
  • in UI - add link to all files in torrent and add target to link to open in new tab

Note: for some reason files crates/librqbit/webui/dist, where checked in to repo, but they are also in .gitignore - I guess they are result of your release build process - so I did not included them.

Copy link
Owner

@ikatson ikatson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks beautiful and well reasoned! There's a small nit I left, otherwise LGTM

) -> Result<&'static str> {
let file_name = info
.iter_filenames_and_lengths()?
.enumerate()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather then enumerate().find_map(if ...) wouldn't just nth(file_idx) work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely, bad me - cannot remember all those cool iterators combinators - fixed in next commit.

@ikatson ikatson merged commit c86e663 into ikatson:main Aug 2, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants