rtorrent downloads the metadata from magnet-uri to "infohash.meta", this downloaded "infohash.meta" file is exactly the "info" section of a complete .torrent file, so the content is not enclosed with the keyword "info" and the preceding "announce" section is missing. Load .meta file with "load_normal" command, it fails with message:
Could not create download: Object operator [info] could not find element
It means user must edit the .meta file to save or load a torrent, which is kind of technical and unnecessary.
The meta-data file is loaded using some special magic, so won't be touching this until I get around to refactoring that part.
Not familiar with the torrent format, but is it somehow possible (through scripting) to convert a meta file to a torrent one?
I have the same question. Can I get an actual .torrent file from a magnet link using rtorrent?
I would love this too. Bump
+1 That would be awesome

Given just the filename INFOHASH.meta, you can construct a magnet link that rtorrent understands.
Magnet links begin with magnet:?xt=urn:btih:, so this gives you magnet:?xt=urn:btih:INFOHASH. This still won't work though: rtorrent wants at least one tracker. Pick one that you think might have peers for the torrent you want, like udp://public.popcorn-tracker.org:6969. This needs to be URL encoded, giving udp%3A%2F%2Fpublic.popcorn-tracker.org%3A6969. Trackers have the magnet link key tr. This gives you
magnet:?xt=urn:btih:INFOHASH&tr=udp%3A%2F%2Fpublic.popcorn-tracker.org%3A6969
which rtorrent will happily accept.
I've got a perl-script doing what noffle suggested for me. just input the INFOHASH.meta and a list of trackers as commandline-arguments, trackers separated by = or & or space/newline so that you could insert just about any other magnet link on this commandline or paste a random listing of them with whatever stats. output is a single line with (unquoted) magnet link suitable even for older rtorrent clients. you probably need to alter the hard-coded default name and hardcode some default trackers. the script, if at all altered and published, should be GPL-licensed...
Or what @getmeacuboftea suggested.
There's also a trick:
session directory when downloading a magnet-link is finishedd.tied_to_file property of the download to the new path of the copied torrent fileI'll post the solution later.
I'll post the solution later.
Let's suppose that:
cfg.dir.incomplete methodcfg.dir.meta_downl methodcfg.dir.session method# helper method: checks existence of a directory, file, symlink
method.insert = check_object.value, simple|private, "execute.capture=bash,-c,\"$cat=\\\"test -\\\",$argument.2=,\\\" \\\\\\\"\\\",$argument.0=,$argument.1=,\\\"\\\\\\\" && echo -n 1 || echo -n\\\"\""
# Defining directory constants
method.insert = cfg.dir.main, string|const|private, (cat,"/mnt/Torrents/")
method.insert = cfg.dir.sub, string|const|private, (cat,(cfg.dir.main),".rtorrent/")
method.insert = cfg.dir.incomplete, string|const|private, (cat,(cfg.dir.sub),"incomplete/")
method.insert = cfg.dir.meta_downl, string|const|private, (cat,(cfg.dir.sub),".downloading/")
method.insert = cfg.dir.session, string|const|private, (cat,(cfg.dir.sub),".session/")
directory.default.set = (cat,(cfg.dir.incomplete))
session.path.set = (cat,(cfg.dir.session))
### begin: Handle magnet links specail way ###
# Start any magnet torrent from the "load" watch directory (that only loads downloads into rtorrent)
method.set_key = event.download.inserted_new, auto_start_meta_in_load_dir, "branch=\"and={d.is_meta=,not=$d.state=}\",d.start="
# helper method: compose the full path of the wrong meta file in "incomplete" dir
method.insert = d.get_wrong_magnet_meta_file_path, simple|private, "cat=$cfg.dir.incomplete=,$d.hash=,.meta"
# helper method: compose the full path of the right torrent file in ".session" dir
method.insert = d.get_session_magnet_meta_file_path, simple|private, "cat=$cfg.dir.session=,$d.hash=,.torrent"
# helper method: compose the new full path of the right torrent file in watch dir
method.insert = d.get_new_magnet_meta_file_path, simple|private, "cat=$cfg.dir.meta_downl=,$d.name=,-,$d.hash=,.torrent"
# helper method: delete wrong meta file from "incomplete dir"
method.insert = d.delete_wrong_magnet_meta_file, simple|private, "execute.nothrow={rm,-rf,--,$d.get_wrong_magnet_meta_file_path=}"
# helper method: copy the right torrent file from ".session" dir into watch dir
method.insert = d.copy_session_magnet_meta_file, simple|private, "execute.nothrow={cp,--,$d.get_session_magnet_meta_file_path=,$d.get_new_magnet_meta_file_path=}"
# helper method: copies right one into its proper place, sets d.tied_to_file property to it, deletes the wrong one, saves session
method.insert = d.fix_magnet_tied_file, simple|private, "d.copy_session_magnet_meta_file=; d.tied_to_file.set=$d.get_new_magnet_meta_file_path=; d.delete_wrong_magnet_meta_file=; d.save_full_session="
# Fix tied torrent file of an initially magnet link when its download has been just started: delete the wrong one from "incomplete" dir and copy the right one from ".session" dir if they exist
method.set_key = event.download.inserted_new, fix_magnet_tied_file, "branch=\"and={\\\"check_object.value=$cat=$d.get_session_magnet_meta_file_path=,,f\\\",\\\"check_object.value=$cat=$d.get_wrong_magnet_meta_file_path=,,f\\\"}\",d.fix_magnet_tied_file="
### end: Handle magnet links specail way ###
The good thing about this solution is:
It uses 2 ideas:
check_object.value method is used to check whether a dir/file/symlink exist*.meta file is in the directory.default dirBut I still prefer @getmeacuboftea's solution: it still works when only encrypted connections are allowed.
PS:
d.is_meta : method.set_key = event.download.inserted_new, auto_start_meta_in_load_dir, "branch=\"and={d.is_meta=,not=$d.state=}\",d.start="
If the .meta files are almost like magnet links, why not just store the magnet links? Or .torrent files? That way it'd be actually possible to re-add, backup and add torrents to be downloaded instead of manually converting hundreds of .meta files to just a tad bit different format.
If the .meta files are almost like magnet links, ... Or .torrent files?
They are almost like .torrent files but they miss crucial info from them (e.g. tracker list), that's why rtorrent can't handle them as valid torrent files.
Magnet downloads were added around 7 (?) years ago as a hack into the ecosystem of rtorrent: it's an intermediate step only to download the proper torrent files from peers.
instead of manually converting hundreds of .meta files
Take a look at the post above yours as a workaround :)
They are almost like .torrent files but they miss crucial info from them (e.g. tracker list), that's why rtorrent can't handle them as valid torrent files.
Torrent files work fine without tracker list and in addition to that rtorrent itself has the list, it just doesn't store them in .meta. It might as well store everything in a .torrent file.
Take a look at the post above yours as a workaround :)
Yeah, it's a workaround, not a solution.
Most helpful comment