webtorrent / webtorrent-desktop

❤️ Streaming torrent app for Mac, Windows, and Linux
https://webtorrent.io/desktop
MIT License
9.67k stars 1k forks source link

Watch for new .magnet files and add them immediately #2156

Closed eskinderg closed 2 years ago

eskinderg commented 2 years ago

Hoping to implement a new feature that watches for new .magnet files and add them to the download list.

I have tried implementing it myself by modifying folder-watch.js and changing the glob to /**/*.magnet and it works. The problem is that after adding the magnet, it is not able to continue download and instead gets stuck at 0% and i had to restart the app for it to resume the download.

my changes are as follows regarding watching for .magnet files and adding them to the download list.

folder-watch.js

const fs = require('fs')
const glob = `${torrentsFolderPath}/**/*.magnet`

    this.watcher
      .on('add', (path) => {
        log('Folder Watcher: added torrent: ', path)

        fs.readFile(path, 'utf8' , (err, data) => { 
          if (err) {
            console.error(err)
            return
          }
          this.window.dispatch('addTorrent', data)
        })
      })

Any idea how to implement this at least for my self. Thanks

github-actions[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?