pobrn / mktorrent Goto Github PK
View Code? Open in Web Editor NEWA simple command line utility to create BitTorrent metainfo files
License: Other
A simple command line utility to create BitTorrent metainfo files
License: Other
Type 'make' to build the program. Do 'make install' to install the program to /usr/local/bin. For more options look in the Makefile. If you use an old version of BSD's make, you might need make -f BSDmakefile See https://github.com/pobrn/mktorrent/wiki for more info.
mktorrent does not build on Alpine Linux without adding an #include <stdint.h>
to mktorrent.h
before line 14.
Could we have a -l auto
option please, which calculates using the torrent size a piece length between 15 and 24, so that there are usually maybe between 1000 and 2000 pieces.
Perhaps with this formula:
max( 15, min( 24, floor( log( torrent_size / 1000 ) / log( 2 ))))
Trying to make mktorrent from source but getting the following errors when I attempt:
cc -O2 -Wall -Wextra -Wpedantic prefix.c -o prefix`
cc -O2 -Wall -Wextra -Wpedantic -DPRIoff="\"ld\"" -DVERSION="\"1.1\"" -c ftw.c
cc -O2 -Wall -Wextra -Wpedantic -DPRIoff="\"ld\"" -DVERSION="\"1.1\"" -c init.c
In file included from init.c:39:0:
msg.h:9:32: warning: anonymous variadic macros were introduced in C99 [-Wvariadic-macros]
#define FATAL_IF(cond, format, ...) do { if (cond) fatal(format, __VA_ARGS__); } while(0)
^
init.c: In function ‘is_dir’:
init.c:181:3: warning: initializer element is not computable at load time
strdup(target),
^
init.c:183:2: warning: initializer element is not computable at load time
};
^
init.c:180:2: warning: ISO C90 forbids mixed declarations and code [-Wpedantic]
struct file_data fd = {
^
init.c: In function ‘process_node’:
init.c:227:3: warning: initializer element is not computable at load time
strdup(path),
^
init.c:229:2: warning: initializer element is not computable at load time
};
^
init.c:226:2: warning: ISO C90 forbids mixed declarations and code [-Wpedantic]
struct file_data fd = {
^
init.c: In function ‘print_help’:
init.c:291:4: warning: string length ‘985’ is greater than the length ‘509’ ISO C90 compilers are required to support [-Woverlength-strings]
"general gossip about the program to: [email protected]\n");
^
In file included from mktorrent.h:12:0,
from init.c:37:
init.c: In function ‘print_announce_list’:
ll.h:32:51: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
#define LL_FOR_FROM_TO_STEP(node, from, to, step) for (struct ll_node *(node) = from; node != to; step(node))
^
ll.h:33:28: note: in expansion of macro ‘LL_FOR_FROM_TO_STEP’
#define LL_FOR(node, list) LL_FOR_FROM_TO_STEP(node, LL_HEAD(list), NULL, LL_STEP)
^
init.c:301:2: note: in expansion of macro ‘LL_FOR’
LL_FOR(node, list) {
^
ll.h:32:51: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
#define LL_FOR_FROM_TO_STEP(node, from, to, step) for (struct ll_node *(node) = from; node != to; step(node))
^
ll.h:33:28: note: in expansion of macro ‘LL_FOR_FROM_TO_STEP’
#define LL_FOR(node, list) LL_FOR_FROM_TO_STEP(node, LL_HEAD(list), NULL, LL_STEP)
^
init.c:301:2: note: in expansion of macro ‘LL_FOR’
LL_FOR(node, list) {
^
ll.h:32:51: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
#define LL_FOR_FROM_TO_STEP(node, from, to, step) for (struct ll_node *(node) = from; node != to; step(node))
^
ll.h:34:33: note: in expansion of macro ‘LL_FOR_FROM_TO_STEP’
#define LL_FOR_FROM(node, from) LL_FOR_FROM_TO_STEP(node, from, NULL, LL_STEP)
^
init.c:308:3: note: in expansion of macro ‘LL_FOR_FROM’
LL_FOR_FROM(inner_node, LL_NEXT(LL_HEAD(inner_list))) {
^
init.c: In function ‘print_web_seed_list’:
ll.h:32:51: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
#define LL_FOR_FROM_TO_STEP(node, from, to, step) for (struct ll_node *(node) = from; node != to; step(node))
^
ll.h:34:33: note: in expansion of macro ‘LL_FOR_FROM_TO_STEP’
#define LL_FOR_FROM(node, from) LL_FOR_FROM_TO_STEP(node, from, NULL, LL_STEP)
^
init.c:329:2: note: in expansion of macro ‘LL_FOR_FROM’
LL_FOR_FROM(node, LL_NEXT(LL_HEAD(list))) {
^
GNUmakefile:64: recipe for target 'init.o' failed
make: *** [init.o] Error 1
The help screen still reports the announce url as required, but it is not. This can be fixed by deleting this line:
Add an option to ignore files.
Relaying this for someone since it appears to be an issue.
It seems a new release needs to be done to have the '-s' flag be available to people in normal distribution channels.
currently:
mktorrent blah.zip -o blah.torrent
proposed with magnet:
mktorrent blah.zip -m
When I use the 1.0 version, the -v mode can show the hashing process like this
128 of 300 pieces
so how can we get that back in 1.1?
Thanks.
Hello!
I would like a -s option to set the source tag of a torrent.
Please include a manpage together with the tool. A starting point could be the manpage written for the Debian package (which I maintain):
https://salsa.debian.org/debian/mktorrent/-/blob/debian/latest/debian/mktorrent.1
which could be included almost as-is. The manpage is GPL-2 as the rest of the package.
Forwarded from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699487 (slightly reworded).
A common feature that mktorrent(1) is lacking is the support for writing the resulting Bencode'd data to stdout. The issue is three-fold:
-
has no special meaning for --output=
, and thus using --output=-
results in a file named -
being created in the current working directory; (unless such file exists, that is);--output=/dev/stdout
(or similar) fails because of the unconditional use of O_CREAT | O_EXCL
(as I've noted in another report);The Debian bug report contains a patch implementing this.
PS. Also to note is that as long as the use of mktorrent(1) from Shell code is considered, writing copyright information upon every invocation doesn't seem like a particularly clever idea, either. Perhaps it should be dropped altogether. Or, there could be --version…
Would be nice, if this tool would be updated with the latest BitTorrent Protocol Specification v2 described here: http://bittorrent.org/beps/bep_0052.html
Especially the part with stronger hash functions (SHA2-256) would be nice.
Since trackers are largely unnecessary nowadays, have you considered
letting mktorrent run with no -a option, unless -p is set?
I tend to set "-a null" just to shut it up :D
Currently, each output .torrent includes metadata "created by mktorrent $version
":
/* I made this! */
fprintf(f, "10:created by13:mktorrent " VERSION);
See https://github.com/pobrn/mktorrent/blob/master/output.c#L165
I would love an option to disable emitting this metadata, similar to --no-date
.
Thanks!
Hi,
I have more than 20 active cpu (24), so why limiting the number of threads to 20 ?
Thanks.
Would it be possible to cut a new release soon? The last one was four years ago and it seems ownership of the project has changed hands once again.
Would it be possible to add the CHANGELOG
to the repo itself?
Also, what were the changes toward 1.1?
The http://mktorrent.sourceforge.net/ URL in README gives a “Whoops, we can't find that page.”
Thanks!
Hello !
I was using mktorrent v1.0 that was showing the progress output like that : "1500 pieces of 2000 hashed".
Now i installed rutorrent 3.10, with mktorrent v1.1 and it seems that your tool is not anymore showing the progress of his job.
I think that it is really necessary to know the progress even more with large torrent.
You can see that the issue is really old and has been reported on rutorrent side, but the problem is on mktorrent side..
Thanks !
Trying to create torrents containing files over 2GB, with mktorrent 1.1, on ubuntu 16.04 32bit:
mktorrent -a https://random-tracker.com some_file_larger_than_2gb.iso
mktorrent 1.1 (c) 2007, 2009 Emil Renner Berthing
Error stat'ing 'some_file_larger_than_2gb.iso: Value too large for defined data type
Trying with mktorrent 1.0 and it creates files without problem:
/usr/bin/mktorrent -a https://some-tracker.com some_file_larger_than_2gb.iso
mktorrent 1.0 (c) 2007, 2009 Emil Renner Berthing
Hashed 1114 of 1114 pieces.
Writing metainfo file... done.
Creating torrents with files under 2GB works without problem on both 1.0 and 1.1
uname -a:
Linux montera 4.15.0-36-generic #39~16.04.1-Ubuntu SMP Tue Sep 25 09:00:45 UTC 2018 i686 i686 i686 GNU/Linux
Why is there no parameter description in the help ?
file_name = ? or input_file
When OS X creates a torrent file, it uses a UTF-8 naming convention, however it's using the Normalization Form Canonical Decomposition (NFD) instead of Normalization Form Canonical Composition (NFC). Most clients on other operating systems, who would of course torrent using torrent files made on OS X, are going to expect NFC. Meanwhile, OS X torrent clients are, for the most part, able to handle NFC- or NFD-normalized filenames. They ensure the end filenames are NFD-normalized, which is what the HFS+ filesystem expects.
The ideal, therefore, is for all torrent files to be generated as UTF-8/NFC, which is the implicit standard for the Bittorrent protocol: "All strings in a .torrent file that contains text must be UTF-8 encoded."
At the moment, mktorrent (and all other torrent clients I've tested) do not distinguish between UTF-8/NFC and UTF-8/NFD, and therefore does not convert UTF-8/NFD text strings to UTF-8/NFC,
My question is, would there be a general interest in an option to format torrent files generated on OS X with the NFC unicode equivalent encoding for the torrent-creating computer's NFD-normalized filenames? If so, would forking the project be the best way to contribute? (New to GitHub, sorry!) Or is there already a super-secret option for something like that?
Screenshot: http://img177.imageshack.us/img177/486/mktorrenterror.png
Windows 7 64-bit.
I cannot figure out whats wrong, so annoying :(
Many torrent clients can transfer files by setting peer IP and port and don’t need at announce URL.
Please, make this option optional.
Forwarded from: https://bugs.debian.org/cgi-bin/pkgreport.cgi?src=mktorrent
Probably the best way to create a temporary file in Shell is to use mktemp(1). Alas, mktorrent(1) doesn't allow for the --output=
file to be overwritten, thus making it “incompatible” with mktemp(1). Consider, e.g.:
$ mktorrent --announce=http://nowhere.invalid:8080/ \
-o "$(mktemp -t -- torrent.XXXXXXXX)" -- example
mktorrent 1.0 (c) 2007, 2009 Emil Renner Berthing
Error creating '/tmp/torrent.xejf3RRS': File exists
AIUI, the conventional wisdom is to support some kind of a --force
option to disable the checks such as the one performed by mktorrent(1) in open_file()
.
Hello there
I have the problem that the -n option alters the basename of the target.
Situation:
Because I add the "unzipped" to the naming, then the torrent folder contained in the .torrent file will be changed to "MyTorrent unzipped". That means after creating the .torrent file I would have to rename the "MyTorrent" folder, otherwise the data within can't be used.
The mktorrent help states this:
-n : set the name of the torrent,
default is the basename of the target
In my opinion, it should just alter the name displayed in the torrent client to "MyTorrent unzipped" but not the actual folder.
--> I'm currently using v1.0 from sourceforge.
Hashing xxx.file.r21.
Segmentation fault
with
mktorrent -l 22 -a announce.url -o taken.torrent /folder/destination/
I keep getting this error. I tried it so:
mktorrent -a tracker -p folder-of-file
and I keep getting error out of memory. I did only make and then sudo make PREFIX=/usr install
Linux version 2.6.18-238.9.1.el5.028stab089.1 (root@rhel5-build-x64) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Thu Apr 14 14:06:01 MSD 2011
I created using mktorrent a very large torrent file from approximately 5 TB of videos, some ~200 files ranging from a few GB each up to around 75 GB. The torrent file itself is nearly 100 MB. The folks to whom I've distributed the torrent file report that they've not been able to get their clients to read the torrent file.
biglybt:
qbittorrent:
I'm having trouble getting it to work in Transmission. My only Transmission instance is the web interface and uploading it just… crashes the web interface. Latest versions, all.
I see two resolutions for this on the mktorrent side:
While browsing the code base I found two macros: ALLINONE and EXPORT. Is there any value this functionality brings to the software? Because I could not figure out why it is beneficial to have just a single translation unit. In a brief correspondence with the current owner of the project, @Rudde, s/he said s/he did not know the origins of these two macros. So this question is mainly directed towards the original author, @esmil (as far as I know).
Hi,
on Gentoo we have a bug where mktorrent-1.1 creates corrupt torrents when built with other CFLAGS than the default ones, e.g. "-march=native" (at least on Intel i-CPUs so far reported).
The compiler versions tested are gcc-6.4.0 and 7.3.0.
Any ideas what's wrong here?
Supported by Bitcomet and others is the Publisher Fields
I guess special comments , IE Publisher IE from
and Homepage url. or in the case of BitComet publisher name / publisher url.
-h "somehomepage.com" -p "somecool-linux distro name"
anyhow if you commonly download from a page ie ISO's etc giving a home page and Name of publisher seems nice and polished.
anyhow it's just an "Enhancement" Idea
The COPYING
file reports a rather outdated copyright notice:
Copyright (C) 2007, 2009 Emil Renner Berthing
as it's 2018 and Emil Renner Berthing handed over the maintainership of this program in 2016, so perhaps the new maintainer should be listed there too. The same goes for mktorrent's output:
$ mktorrent
mktorrent 1.1 (c) 2007, 2009 Emil Renner Berthing
[...]
If this parameter is enabled to seed, another hash will be displayed when the seed is opened on other clients. If this parameter is not used, the hash will always be unique.
Based on the above facts, I think it is necessary to explain the - x parameter in more detail. Avoid user ambiguity
eg:
mktorrent generation ..
magnet:?xt=urn:btih:efa8b1a37da52ae5fa7a711eb361bfab12ad72b4
qbittorrent is open torrent file show torrent hash:
magnet:?xt=urn:btih:1fa7f48c866cb6a9c90b314ad2d2148c3ac422f7
close -x
is hash same
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.