Open GoogleCodeExporter opened 8 years ago
for single file torrents, the name of the torrent and the name of the file is
the same thing. They are literally stored in the same field in the .torrent
file.
Original comment by arvid.no...@gmail.com
on 5 Jun 2015 at 10:02
Is there a quick way you can think of that I could get around this? Like adding
an extra blank file to the torrent just so they can have a different name?
I do need this, to have the torrent name be a different name than the single
file inside.
Original comment by Tchouli...@gmail.com
on 6 Jun 2015 at 5:35
making it a multi-file torrent would definitely do it.
The distinction is that a multi-file torrent has a directory (the name of the
torrent) with the files in it. A single file torrent just has a file, no
directory. hence no separate torrent name.
technically, the .torrent format supports a multi-file torrent with just a
single file, it's possible that if you add a file with a directory component
libtorrent will create such a torrent (where the root directory becomes the
torrent name).
Original comment by arvid.no...@gmail.com
on 6 Jun 2015 at 6:37
> technically, the .torrent format supports a multi-file torrent with just a
single file, it's possible that if you add a file with a directory component
libtorrent will create such a torrent (where the root directory becomes the
torrent name).
Lets call this fake-multi-file haha.
Right now I'm using libtorrent.add_files(/path/to/single/file), but its
creating the single file torrent, where I can't do the renaming.
How do I do the fake-multi-file?
Original comment by Tchouli...@gmail.com
on 6 Jun 2015 at 6:40
from looking at the code, if you pass in a filename with a path it looks like
it would create a multi-file torrent with a single file in it. but it looks
like that's what you're doing.
Original comment by arvid.no...@gmail.com
on 11 Jun 2015 at 1:52
Anyone you could ask about this? I can't figure out a way to get this to work.
Original comment by Tchouli...@gmail.com
on 24 Jun 2015 at 2:11
you could step into add_file() in a debugger and see what it's doing. or you
could create the torrent file from scratch.
Original comment by arvid.no...@gmail.com
on 24 Jun 2015 at 3:32
Unfortunately I'm using libtorrent through a java swig JNI layer. I tried to
debug it with my java debugger, but it doesn't look like it can go into native
libraries.
Original comment by Tchouli...@gmail.com
on 24 Jun 2015 at 1:47
Specifically, its using libtorrent.file_storage_set_name
Original comment by Tchouli...@gmail.com
on 24 Jun 2015 at 1:48
right. see comment #1. did you try #3 first?
Original comment by arvid.no...@gmail.com
on 25 Jun 2015 at 12:24
Reading your comment #3:
> it's possible that if you add a file with a directory component libtorrent
will create such a torrent (where the root directory becomes the torrent name).
I currently only see two libtorrent.add_files methods(sorry for the java):
libtorrent_jni.add_files__SWIG_2(file_storage.getCPtr(fs), fs, file, flags);
libtorrent_jni.add_files__SWIG_3(file_storage.getCPtr(fs), fs, file);
They both just use file_storage, and a file path.
Here's my current code:
file_storage fs = new file_storage();
// Add the file
libtorrent.add_files(fs, song.getFile().getAbsolutePath());
So I am giving it a path component already.
What else can I try?
Original comment by Tchouli...@gmail.com
on 25 Jun 2015 at 2:48
I just tried a lot today, both with file_storage.add_file, and
libtorrent.add_files, but couldn't get either to show a different torrent name
than the single file within it. I suppose this is just a limitation of how
things are stored.
My main problem, is that I would like a torrent client to show my torrent as:
'Artist-Album-Track'
But instead its shown as:
'## TrackName'
Which is standard convention for how individual songs are named.
Original comment by Tchouli...@gmail.com
on 25 Jun 2015 at 2:24
renaming the torrent/file will do that. but you _also_ want this one file to
live inside a directory. right?
the name of the torrent is basically defined as the root directory or the
filename (for single file torrents). There's no additional name for a torrent.
If you want to create a torrent that has a single file A inside a directory B,
you want to create a multi-file torrent named B containing a single file, named
A.
normally you wouldn't want to create a multi-file torrent for just single
files, so you'll have to jump through some hoops. If you look in
create_torrent.cpp
https://github.com/arvidn/libtorrent/blob/master/src/create_torrent.cpp#L323
you'll see that there's logic there to make sure that if the single file has a
path prepended to it, it will become a multifile torrent.
now, make sure you use a recent enough version of libtorrent that includes that
line.
Original comment by arvid.no...@gmail.com
on 25 Jun 2015 at 9:59
> but you _also_ want this one file to live inside a directory. right?
No, I'm creating individual torrents for songs, which most often don't live in
their own directories(per song). Its usually per album.
If I'm interpreting this line correctly:
if (!m_multifile && has_parent_path(m_files.file_path(0))) m_multifile = true;
This fits the first condition, since the the number of files is 1.
I'm not sure how to read the second condition, but its clear my
Wouldn't a better solution, instead of faking a multi file torrent, be to 1
- create an extra location to store the torrent name
- set it to the file name by default, and
- allow the option to use set_name to change it?
Also, I'm on libtorrent 1.0.5.0
BTW I much prefer github to this, have you thought about exporting these issues
to github? I see only a few there from your link.
Original comment by Tchouli...@gmail.com
on 25 Jun 2015 at 10:10
libtorrent lives on github at https://github.com/arvidn/libtorrent
I may not quite understand you. what exactly do you mean by "torrent name", if
you don't mean the directory the file is saved under? what property of the
.torrent file are you looking for, the filename of the .torrent file itself?
You can create any number of fields you like in a .torrent file, it's just
bencoded. and you can interpret them and call them whatever you like. but
calling your field "torrent name" may be confusing, because that name is
already defined for torrents, and it means either the directory the files are
stored in, or the filename of the single-file torrent. So you may want to call
it something else.
has_parent_path() basically means, is there a directory separator ("/") in that
path, as opposed to just a filename.
Original comment by arvid.no...@gmail.com
on 26 Jun 2015 at 4:09
Original issue reported on code.google.com by
Tchouli...@gmail.com
on 5 Jun 2015 at 4:34