Store torrent data locally rather than redirecting users to remote websites

Issue #18 resolved
Shana Project repo owner created an issue

This resolves the following issues:

  • If a torrent host is acting flakey when a user tries to download the file via RSS, ShanaProject might think the file is there; but when it redirects the user to that site the download might fail. SP would then mark the file as downloaded even though the end users download fails.
  • ShanaProject currently does a HEAD request before redirecting the user to that torrent, these all come from the SP IP address, so a very popular file might cause SP to hammer a server (potentially resulting in a ban).

The process would be as follows:

  • When release is scraped from Tosho
    • Optionally fetch torrent from remote host
    • If successful, store locally
  • When a user requests a download
    • Check if there is a local copy of the file
    • If there is not, fetch the file and store it locally
    • Return the torrent data

Potential problems might include:

  • When a file is removed (404'd) due to a bad release, SP would still keep a copy that users might accidentally download

Comments (3)

  1. dgw

    What is really needed is better handling of releases that get replaced with a v2 (or v3, etc.). When the client requests the .torrent file for a release that has been 404'd, SP should either reject the request and add the newest matching release to the feed, or transparently return a file/redirect for the latest matching release.

    Just some thoughts. I know my suggestion doesn't address the issue of flaky .torrent file hosts.

  2. Shana Project reporter

    When a new release comes out, either with exactly the same file name (ignoring the file hash) or with a version greater than the previous files version, the old release will be removed from your follow list (and RSS) and the new one will be added.

    So even if the old torrent link 404's, your follow list should have the new version (or revised torrent) anyway.

    With the current implementation, a discrete redirect could be tricky... but assuming the above functionality works it shouldn't really be necessary.

    The only reason this would not "appear" to work is if you untick the "Show version 2 (fixed files) and above in your RSS feeds" option in your settings page (on by default).

    If you are experiencing issues where this doesn't seem to be working, please let me know (with some examples) and I'll look into it.

  3. Log in to comment