Giter Club home page Giter Club logo

Comments (6)

scttcper avatar scttcper commented on September 27, 2024

normalizedAddTorrent will do it, addMagnet only returns what qbittorrent api gives back, a mostly useless boolean.

from qbittorrent.

scttcper avatar scttcper commented on September 27, 2024

You might also get the hash yourself, see how its done here

torrentHash = magnetDecode(torrent).infoHash;

from qbittorrent.

blackwater17 avatar blackwater17 commented on September 27, 2024

Thanks. Does normalizedAddTorrent work with magnet urls too? If so, I couldn't get it to work. It throws an error and says "Error: not a number: buffer['0'] = 104"

Could it be because my input is actually not a magnet file? Because what I'm using as parameter is actually just a "download URL" for the torrent file. Does this count as magnet? When I use addMagnet function with this url it works btw.

And for the second method does it work with this url? Once again I tried it but it throw an error.

from qbittorrent.

scttcper avatar scttcper commented on September 27, 2024

You're probably adding by url then. I'm not sure how you would get the hash except by comparing the current set of torrents with the new set of torrents after adding the torrent. Another solution might be to download the torrent file in your code and pass that to add normalized torrent.

from qbittorrent.

blackwater17 avatar blackwater17 commented on September 27, 2024

Comparing the torrents and getting the hash is what I currently do. But sometimes it just doesn't work
and loads the wrong torrent for some reason. And its not best the best solution either. I could also download the torrent file and add it by file, but this would also make things more complicated. So are you confirming that this method is not supposed to work anyway?
I call it like this:
const result = await client.normalizedAddTorrent("https://....blablabla.torrent", { savepath: savepath, sequentialDownload:"True", paused:"False" }) // throws the error I shared above.
But the below code just works, and returns true.
const result = await client.addMagnet("https://....blablabla.torrent", { savepath: savepath, sequentialDownload:"True", paused:"False" })

from qbittorrent.

scttcper avatar scttcper commented on September 27, 2024

yeah add magnet is using the same api as add by url. normalizedAddTorrent can't support urls since there isn't a way to return the hash. maybe it should throw an error.

from qbittorrent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.