rndusr / torf

Python module to create, parse and edit torrent files and magnet links
GNU General Public License v3.0
179 stars 18 forks source link

Is it possible to add a file with a different filename inside the torrent? #27

Closed wwww-wwww closed 1 year ago

wwww-wwww commented 1 year ago

For example, I have a file named "out.html" and want it to be named "index.html" inside the torrent file. I am loading the paths by setting filepaths, so I figured it could be possible to either have it when setting or change it after under metainfo["info"]["files"].

rndusr commented 1 year ago

Maybe.

Try calling generate() first while you still have "out.html" in the metainfo, then rename it to "index.html".

wwww-wwww commented 1 year ago

write with validate=True complains about the missing file write with validate=False has it with the original filename

rndusr commented 1 year ago

What I meant was something like this:

torrent.generate()
torrent.metainfo["info"]["files"][0]["path"] = ["index.html"]

Can you post your code?

rndusr commented 1 year ago

OP seems to have lost interest.