Discussion:
[libtorrent] Complete control in torrent download (Faheem Mohammed)
Thomas Vincent-Sweet
2017-02-26 14:55:40 UTC
Permalink
Hi Faheem,

There's an acronym that is used a lot in programming (but not only): *RTFM*.
It means Read The F****** Manual.
If anything is *not* in the manual, or needs more detailing because it is
unclear, feel free to ask.

Manual can be found here:
http://www.rasterbar.com/products/libtorrent/manual.html

You can use the browser's search function (Ctrl+F) to find stuff, for
example, "queue".
To help with your queueing question, yes libtorrent can queue:
http://www.rasterbar.com/products/libtorrent/manual.html#queuing

It's all in the manual.
Good luck learning.
Thomas


Date: Sun, 26 Feb 2017 15:37:43 +0530
Subject: Re: [libtorrent] Complete control in torrent download
To: General discussion about libtorrent
com>
Content-Type: text/plain; charset=UTF-8
Is there queuing in libtorrent... If there how to implement?
On Sat, Feb 25, 2017 at 11:15 PM, Faheem Mohammed <
I am a beginner....So please don't feel disturbed by my questions
Regards...
On Fri, Feb 24, 2017 at 11:46 PM, sledgehammer999 <
Sorry I meant torrent_handle.auto_managed(false)
2017-02-24 20:15 GMT+02:00 sledgehammer999
rg>
So use torrent_handle.auto_manage(false) before
torrent_handle.pause().
Or when adding the torrent to the session make sure to unset the
auto_managed flag.
And this question seems like homework...
On Fri, Feb 24, 2017 at 12:46 PM, Faheem Mohammed <
*Current code I am working on is as follows. At iteration 10 it has
to
pause. I used the code 'torrent_handle.pause()' but not pausing.*
probably because you didn't read the documentation I referred you to.
Torrents that are auto-managed may be automatically resumed again
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Faheem Mohammed
2017-03-14 13:34:23 UTC
Permalink
how to get filename from magnet uri in libtorrent

On Sun, Feb 26, 2017 at 8:25 PM, Thomas Vincent-Sweet <
Post by Thomas Vincent-Sweet
Hi Faheem,
There's an acronym that is used a lot in programming (but not only): *RTFM*.
It means Read The F****** Manual.
If anything is *not* in the manual, or needs more detailing because it is
unclear, feel free to ask.
http://www.rasterbar.com/products/libtorrent/manual.html
You can use the browser's search function (Ctrl+F) to find stuff, for
example, "queue".
http://www.rasterbar.com/products/libtorrent/manual.html#queuing
It's all in the manual.
Good luck learning.
Thomas
Date: Sun, 26 Feb 2017 15:37:43 +0530
Subject: Re: [libtorrent] Complete control in torrent download
To: General discussion about libtorrent
com>
Content-Type: text/plain; charset=UTF-8
Is there queuing in libtorrent... If there how to implement?
On Sat, Feb 25, 2017 at 11:15 PM, Faheem Mohammed <
I am a beginner....So please don't feel disturbed by my questions
Regards...
On Fri, Feb 24, 2017 at 11:46 PM, sledgehammer999 <
Sorry I meant torrent_handle.auto_managed(false)
2017-02-24 20:15 GMT+02:00 sledgehammer999
rg>
So use torrent_handle.auto_manage(false) before
torrent_handle.pause().
Or when adding the torrent to the session make sure to unset the
auto_managed flag.
And this question seems like homework...
On Fri, Feb 24, 2017 at 12:46 PM, Faheem Mohammed <
*Current code I am working on is as follows. At iteration 10 it
has
to
pause. I used the code 'torrent_handle.pause()' but not pausing.*
probably because you didn't read the documentation I referred you
to.
Torrents that are auto-managed may be automatically resumed
again
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Arvid Norberg
2017-03-14 14:06:06 UTC
Permalink
On Tue, Mar 14, 2017 at 9:34 AM, Faheem Mohammed <
Post by Faheem Mohammed
how to get filename from magnet uri in libtorrent
filenames are not part of the URI. You have to first wait for the metadata
(.torrent file) to be downloaded from the swarm, then you can ask your
torrent_handle for it, and enumerate the files.
--
Arvid Norberg
Faheem Mohammed
2017-03-14 14:26:59 UTC
Permalink
can you please explain the code using torrent handle to retrieve filename
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 9:34 AM, Faheem Mohammed <
Post by Faheem Mohammed
how to get filename from magnet uri in libtorrent
filenames are not part of the URI. You have to first wait for the metadata
(.torrent file) to be downloaded from the swarm, then you can ask your
torrent_handle for it, and enumerate the files.
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Arvid Norberg
2017-03-14 14:48:14 UTC
Permalink
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to retrieve filename
You can read about it here:

http://libtorrent.org/reference-Alerts.html#metadata-received-alert
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
Faheem Mohammed
2017-03-18 17:26:08 UTC
Permalink
How to determine whether the download is finished.. Is there any inbuilt
function..
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to retrieve filename
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Calum Lind
2017-03-18 18:58:59 UTC
Permalink
Seriously?! People here don't mind answering questions but you are just
being lazy and not reading the reference manual, all the answers are there.
Post by Faheem Mohammed
How to determine whether the download is finished.. Is there any inbuilt
function..
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to retrieve
filename
Post by Arvid Norberg
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Faheem Mohammed
2017-03-20 14:33:44 UTC
Permalink
Sorry, I was a bit urgent... that's why??? Regards
Post by Calum Lind
Seriously?! People here don't mind answering questions but you are just
being lazy and not reading the reference manual, all the answers are there.
Post by Faheem Mohammed
How to determine whether the download is finished.. Is there any inbuilt
function..
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to retrieve
filename
Post by Arvid Norberg
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Calum Lind
2017-03-20 15:22:31 UTC
Permalink
Sorry no you have been repeatedly given links to read the manual. You did
not show any effort on your part to do research and I doubt anyone else
here has any interest in fast-tracking your urgent deadline demands. In
fact it would have been quicker to search the manual than write the
question.

There is a certain etiquette to asking questions:

http://www.catb.org/~esr/faqs/smart-questions.html



On 20 Mar 2017 14:35, "Faheem Mohammed" <***@gmail.com> wrote:

Sorry, I was a bit urgent... that's why??? Regards
Post by Calum Lind
Seriously?! People here don't mind answering questions but you are just
being lazy and not reading the reference manual, all the answers are there.
Post by Faheem Mohammed
How to determine whether the download is finished.. Is there any inbuilt
function..
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to retrieve
filename
Post by Arvid Norberg
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
Libtorrent-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Angel Leon
2017-03-20 16:29:03 UTC
Permalink
The answer was on the first link given to you. Read about alerts.
http://libtorrent.org/reference-Alerts.html#metadata-received-alert

You're interested in file-completed-alert
http://libtorrent.org/reference-Alerts.html#file-completed-alert

Read the answers given to you.
Post by Calum Lind
Sorry no you have been repeatedly given links to read the manual. You did
not show any effort on your part to do research and I doubt anyone else
here has any interest in fast-tracking your urgent deadline demands. In
fact it would have been quicker to search the manual than write the
question.
http://www.catb.org/~esr/faqs/smart-questions.html
Sorry, I was a bit urgent... that's why??? Regards
Post by Calum Lind
Seriously?! People here don't mind answering questions but you are just
being lazy and not reading the reference manual, all the answers are
there.
Post by Calum Lind
Post by Faheem Mohammed
How to determine whether the download is finished.. Is there any
inbuilt
Post by Calum Lind
Post by Faheem Mohammed
function..
On Tue, Mar 14, 2017 at 8:18 PM, Arvid Norberg <
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to retrieve
filename
Post by Arvid Norberg
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Angel Leon
2017-03-20 16:43:51 UTC
Permalink
My bad Faheem, I believe that didn't answer your question 100% as you may
also be dealing with a client that's been shut down and starting a previous
session, and the file may have already been completed.

In that case you want to take a look at torrent_handle::file_progress(...)


file_progress()

void *file_progress* (std::vector<boost::int64_t>& progress, int flags
= 0) const;

This function fills in the supplied vector with the the number of bytes
downloaded of each file in this torrent. The progress values are ordered
the same as the files in the torrent_info
<http://www.libtorrent.org/reference-Core.html#torrent_info>. This
operation is not very cheap. Its complexity is *O(n + mj)*. Where *n* is
the number of files, *m* is the number of downloading pieces and *j* is the
number of blocks in a piece.

The flags parameter can be used to specify the granularity of the file
progress. If left at the default value of 0, the progress will be as
accurate as possible, but also more expensive to calculate. If
torrent_handle::piece_granularity is specified, the progress will be
specified in piece granularity. i.e. only pieces that have been fully
downloaded and passed the hash check count. When specifying piece
granularity, the operation is a lot cheaper, since libtorrent already keeps
track of this internally and no calculation is required.
Post by Angel Leon
The answer was on the first link given to you. Read about alerts.
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
You're interested in file-completed-alert
http://libtorrent.org/reference-Alerts.html#file-completed-alert
Read the answers given to you.
Sorry no you have been repeatedly given links to read the manual. You did
not show any effort on your part to do research and I doubt anyone else
here has any interest in fast-tracking your urgent deadline demands. In
fact it would have been quicker to search the manual than write the
question.
http://www.catb.org/~esr/faqs/smart-questions.html
Sorry, I was a bit urgent... that's why??? Regards
Post by Calum Lind
Seriously?! People here don't mind answering questions but you are just
being lazy and not reading the reference manual, all the answers are
there.
Post by Calum Lind
Post by Faheem Mohammed
How to determine whether the download is finished.. Is there any
inbuilt
Post by Calum Lind
Post by Faheem Mohammed
function..
On Tue, Mar 14, 2017 at 8:18 PM, Arvid Norberg <
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to retrieve
filename
Post by Arvid Norberg
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Faheem Mohammed
2017-03-21 07:21:11 UTC
Permalink
Can anyone give me a code to retrieve filename in python. I am a beginner
in this, so can't convert the c code in documentation. Please help...
Post by Angel Leon
My bad Faheem, I believe that didn't answer your question 100% as you may
also be dealing with a client that's been shut down and starting a previous
session, and the file may have already been completed.
In that case you want to take a look at torrent_handle::file_progress(...)
file_progress()
void *file_progress* (std::vector<boost::int64_t>& progress, int flags
= 0) const;
This function fills in the supplied vector with the the number of bytes
downloaded of each file in this torrent. The progress values are ordered
the same as the files in the torrent_info
<http://www.libtorrent.org/reference-Core.html#torrent_info>. This
operation is not very cheap. Its complexity is *O(n + mj)*. Where *n* is
the number of files, *m* is the number of downloading pieces and *j* is the
number of blocks in a piece.
The flags parameter can be used to specify the granularity of the file
progress. If left at the default value of 0, the progress will be as
accurate as possible, but also more expensive to calculate. If
torrent_handle::piece_granularity is specified, the progress will be
specified in piece granularity. i.e. only pieces that have been fully
downloaded and passed the hash check count. When specifying piece
granularity, the operation is a lot cheaper, since libtorrent already keeps
track of this internally and no calculation is required.
Post by Angel Leon
The answer was on the first link given to you. Read about alerts.
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
You're interested in file-completed-alert
http://libtorrent.org/reference-Alerts.html#file-completed-alert
Read the answers given to you.
Sorry no you have been repeatedly given links to read the manual. You did
not show any effort on your part to do research and I doubt anyone else
here has any interest in fast-tracking your urgent deadline demands. In
fact it would have been quicker to search the manual than write the
question.
http://www.catb.org/~esr/faqs/smart-questions.html
Sorry, I was a bit urgent... that's why??? Regards
Post by Calum Lind
Seriously?! People here don't mind answering questions but you are just
being lazy and not reading the reference manual, all the answers are
there.
Post by Calum Lind
On 18 March 2017 at 17:26, Faheem Mohammed <
Post by Faheem Mohammed
How to determine whether the download is finished.. Is there any
inbuilt
Post by Calum Lind
Post by Faheem Mohammed
function..
On Tue, Mar 14, 2017 at 8:18 PM, Arvid Norberg <
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to retrieve
filename
Post by Arvid Norberg
http://libtorrent.org/reference-Alerts.html#
metadata-received-alert
Post by Angel Leon
Post by Calum Lind
Post by Faheem Mohammed
Post by Arvid Norberg
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Post by Angel Leon
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Faheem Mohammed
2017-03-22 17:57:44 UTC
Permalink
PLEASE HELP..
I have been looking through the documentation for a long, but cannot get
the proper code for obtaining filename from magnet uri... Below is my code:

import libtorrent as lt
import time
import sys
def get_libtorrent_session_and_start_dht(start_port, end_port):
ses = lt.session()
ses.listen_on(start_port, end_port)
ses.add_dht_router('dht.transmissionbt.com', start_port)
ses.add_dht_router('router.bittorrent.com', start_port)
ses.add_dht_router('router.utorrent.com', start_port)
ses.start_dht()
return ses
const_state_str = ['queued', 'checking', 'downloading metadata', \
'downloading', 'finished', 'seeding', 'allocating',
'checking fastresume']
const_pause_torrent = "pause_torrent"
const_resume_torrent = "resume_torrent"
const_kill_torrent = "kill_torrent"
const_user_logged_in = "user_logged_in"
const_user_logged_out = "user_logged_out"
const_quit_seeding = "quit_seeding"
ses = get_libtorrent_session_and_start_dht(6881, 6891)
torrent_info = file
torrent_handle = None
params = {
'save_path': '/home/faheem/Downloads/',
'storage_mode': lt.storage_mode_t(2)
}
link = "magnet:?xt=urn:btih:B583B1DE1473232CBC480E703F5F8EEDF647D531&dn=Rufus+2.12+Create+bootable+USB+flash+drives+%28USB+keys+or+pen+drives%2C+and+memory+sticks%29+-+786zx&tr=http%3A%2F%2Ft.nyaatracker.com
<http://2ft.nyaatracker.com/>%2Fannounce&tr=http%3A%2F%2Ft.nyaatracker.com
<http://2ft.nyaatracker.com/>%3A80%2Fannounce&tr=http%3A%2F%2Fipv4.tracker.harry.lu
<http://2fipv4.tracker.harry.lu/>%2Fannounce&tr=http%3A%2F%2Fipv4.tracker.harry.lu
<http://2fipv4.tracker.harry.lu/>%3A80%2Fannounce&tr=https%3A%2F%2Fopen.kickasstracker.com
<http://2fopen.kickasstracker.com/>%3A443%2Fannounce&tr=http%3A%2F%2Ftracker.tfile.me
<http://2ftracker.tfile.me/>%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk
<http://2ftracker.coppersurfer.tk/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.ilibr.org
<http://2ftracker.ilibr.org/>%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.pirateparty.gr
<http://2ftracker.pirateparty.gr/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.ilibr.org
<http://2ftracker.ilibr.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org
<http://2ftracker.opentrackr.org/>%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to
<http://2ftracker.zer0day.to/>%3A1337%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com
<http://2fp4p.arenabg.com/>%3A1337%2Fannounce&tr=udp%3A%2F%2Fshadowshq.yi.org
<http://2fshadowshq.yi.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Feddie4.nl%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to
<http://2ftracker.zer0day.to/>%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org
<http://2ftracker.leechers-paradise.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Fcoppersurfer.tk%3A6969%2Fannounce"
try:
torrent_handle = lt.add_magnet_uri(ses,link,params)
except Exception as exception:
raise exception
print "Getting meta data"
while not torrent_handle.has_metadata():
time.sleep(1)
print 'got metadata, starting torrent download...'

current_iteration = 0
while not torrent_handle.is_seed():
torrent_status = torrent_handle.status()
print "current_iteration: " + str(current_iteration)
if const_state_str[torrent_status.state] == "checking":
print 'Checking Torrent....'
continue
print'faheem %.3f MB'%(float(torrent_status.total_done/float(1000000)))
print '\r%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s' % \
(torrent_status.progress * 100, torrent_status.download_rate
/ 1000, torrent_status.upload_rate / 1000, \
torrent_status.num_peers, const_state_str[torrent_status.state]), \
sys.stdout.flush()
current_iteration += 1
if torrent_status.paused:
print "Is Paused"
else:
print "Is Not Paused"
time.sleep(1)
while torrent_handle.is_seed():
print'SEEDING'



On Tue, Mar 21, 2017 at 12:51 PM, Faheem Mohammed <
Post by Faheem Mohammed
Can anyone give me a code to retrieve filename in python. I am a beginner
in this, so can't convert the c code in documentation. Please help...
Post by Angel Leon
My bad Faheem, I believe that didn't answer your question 100% as you may
also be dealing with a client that's been shut down and starting a previous
session, and the file may have already been completed.
In that case you want to take a look at torrent_handle::file_progress(
...)
file_progress()
void *file_progress* (std::vector<boost::int64_t>& progress, int flags
= 0) const;
This function fills in the supplied vector with the the number of bytes
downloaded of each file in this torrent. The progress values are ordered
the same as the files in the torrent_info
<http://www.libtorrent.org/reference-Core.html#torrent_info>. This
operation is not very cheap. Its complexity is *O(n + mj)*. Where *n* is
the number of files, *m* is the number of downloading pieces and *j* is the
number of blocks in a piece.
The flags parameter can be used to specify the granularity of the file
progress. If left at the default value of 0, the progress will be as
accurate as possible, but also more expensive to calculate. If
torrent_handle::piece_granularity is specified, the progress will be
specified in piece granularity. i.e. only pieces that have been fully
downloaded and passed the hash check count. When specifying piece
granularity, the operation is a lot cheaper, since libtorrent already keeps
track of this internally and no calculation is required.
Post by Angel Leon
The answer was on the first link given to you. Read about alerts.
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
You're interested in file-completed-alert
http://libtorrent.org/reference-Alerts.html#file-completed-alert
Read the answers given to you.
Sorry no you have been repeatedly given links to read the manual. You
did
Post by Angel Leon
not show any effort on your part to do research and I doubt anyone else
here has any interest in fast-tracking your urgent deadline demands. In
fact it would have been quicker to search the manual than write the
question.
http://www.catb.org/~esr/faqs/smart-questions.html
Sorry, I was a bit urgent... that's why??? Regards
Post by Calum Lind
Seriously?! People here don't mind answering questions but you are
just
Post by Angel Leon
Post by Calum Lind
being lazy and not reading the reference manual, all the answers are
there.
Post by Calum Lind
On 18 March 2017 at 17:26, Faheem Mohammed <
Post by Faheem Mohammed
How to determine whether the download is finished.. Is there any
inbuilt
Post by Calum Lind
Post by Faheem Mohammed
function..
On Tue, Mar 14, 2017 at 8:18 PM, Arvid Norberg <
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to retrieve
filename
Post by Arvid Norberg
http://libtorrent.org/reference-Alerts.html#metadata-
received-alert
Post by Angel Leon
Post by Calum Lind
Post by Faheem Mohammed
Post by Arvid Norberg
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Post by Angel Leon
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Faheem Mohammed
2017-03-23 18:51:23 UTC
Permalink
PLEASE HELP...

On Wed, Mar 22, 2017 at 11:27 PM, Faheem Mohammed <
Post by Faheem Mohammed
PLEASE HELP..
I have been looking through the documentation for a long, but cannot get
import libtorrent as lt
import time
import sys
ses = lt.session()
ses.listen_on(start_port, end_port)
ses.add_dht_router('dht.transmissionbt.com', start_port)
ses.add_dht_router('router.bittorrent.com', start_port)
ses.add_dht_router('router.utorrent.com', start_port)
ses.start_dht()
return ses
const_state_str = ['queued', 'checking', 'downloading metadata', \
'downloading', 'finished', 'seeding', 'allocating', 'checking fastresume']
const_pause_torrent = "pause_torrent"
const_resume_torrent = "resume_torrent"
const_kill_torrent = "kill_torrent"
const_user_logged_in = "user_logged_in"
const_user_logged_out = "user_logged_out"
const_quit_seeding = "quit_seeding"
ses = get_libtorrent_session_and_start_dht(6881, 6891)
torrent_info = file
torrent_handle = None
params = {
'save_path': '/home/faheem/Downloads/',
'storage_mode': lt.storage_mode_t(2)
}
link = "magnet:?xt=urn:btih:B583B1DE1473232CBC480E703F5F8EEDF647D531&dn=Rufus+2.12+Create+bootable+USB+flash+drives+%28USB+keys+or+pen+drives%2C+and+memory+sticks%29+-+786zx&tr=http%3A%2F%2Ft.nyaatracker.com <http://2ft.nyaatracker.com/>%2Fannounce&tr=http%3A%2F%2Ft.nyaatracker.com <http://2ft.nyaatracker.com/>%3A80%2Fannounce&tr=http%3A%2F%2Fipv4.tracker.harry.lu <http://2fipv4.tracker.harry.lu/>%2Fannounce&tr=http%3A%2F%2Fipv4.tracker.harry.lu <http://2fipv4.tracker.harry.lu/>%3A80%2Fannounce&tr=https%3A%2F%2Fopen.kickasstracker.com <http://2fopen.kickasstracker.com/>%3A443%2Fannounce&tr=http%3A%2F%2Ftracker.tfile.me <http://2ftracker.tfile.me/>%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk <http://2ftracker.coppersurfer.tk/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.ilibr.org <http://2ftracker.ilibr.org/>%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.pirateparty.gr <http://2ftracker.pirateparty.gr/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.ilibr.org <http://2ftracker.ilibr.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org <http://2ftracker.opentrackr.org/>%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to <http://2ftracker.zer0day.to/>%3A1337%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com <http://2fp4p.arenabg.com/>%3A1337%2Fannounce&tr=udp%3A%2F%2Fshadowshq.yi.org <http://2fshadowshq.yi.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Feddie4.nl%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to <http://2ftracker.zer0day.to/>%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org <http://2ftracker.leechers-paradise.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Fcoppersurfer.tk%3A6969%2Fannounce"
torrent_handle = lt.add_magnet_uri(ses,link,params)
raise exception
print "Getting meta data"
time.sleep(1)
print 'got metadata, starting torrent download...'
current_iteration = 0
torrent_status = torrent_handle.status()
print "current_iteration: " + str(current_iteration)
print 'Checking Torrent....'
continue
print'faheem %.3f MB'%(float(torrent_status.total_done/float(1000000)))
print '\r%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s' % \
(torrent_status.progress * 100, torrent_status.download_rate / 1000, torrent_status.upload_rate / 1000, \
torrent_status.num_peers, const_state_str[torrent_status.state]), \
sys.stdout.flush()
current_iteration += 1
print "Is Paused"
print "Is Not Paused"
time.sleep(1)
print'SEEDING'
On Tue, Mar 21, 2017 at 12:51 PM, Faheem Mohammed <
Post by Faheem Mohammed
Can anyone give me a code to retrieve filename in python. I am a beginner
in this, so can't convert the c code in documentation. Please help...
Post by Angel Leon
My bad Faheem, I believe that didn't answer your question 100% as you may
also be dealing with a client that's been shut down and starting a previous
session, and the file may have already been completed.
In that case you want to take a look at torrent_handle::file_progress(
...)
file_progress()
void *file_progress* (std::vector<boost::int64_t>& progress, int flags
= 0) const;
This function fills in the supplied vector with the the number of bytes
downloaded of each file in this torrent. The progress values are ordered
the same as the files in the torrent_info
<http://www.libtorrent.org/reference-Core.html#torrent_info>. This
operation is not very cheap. Its complexity is *O(n + mj)*. Where *n* is
the number of files, *m* is the number of downloading pieces and *j* is the
number of blocks in a piece.
The flags parameter can be used to specify the granularity of the file
progress. If left at the default value of 0, the progress will be as
accurate as possible, but also more expensive to calculate. If
torrent_handle::piece_granularity is specified, the progress will be
specified in piece granularity. i.e. only pieces that have been fully
downloaded and passed the hash check count. When specifying piece
granularity, the operation is a lot cheaper, since libtorrent already keeps
track of this internally and no calculation is required.
Post by Angel Leon
The answer was on the first link given to you. Read about alerts.
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
You're interested in file-completed-alert
http://libtorrent.org/reference-Alerts.html#file-completed-alert
Read the answers given to you.
Sorry no you have been repeatedly given links to read the manual. You
did
Post by Angel Leon
not show any effort on your part to do research and I doubt anyone else
here has any interest in fast-tracking your urgent deadline demands. In
fact it would have been quicker to search the manual than write the
question.
http://www.catb.org/~esr/faqs/smart-questions.html
Sorry, I was a bit urgent... that's why??? Regards
Post by Calum Lind
Seriously?! People here don't mind answering questions but you are
just
Post by Angel Leon
Post by Calum Lind
being lazy and not reading the reference manual, all the answers are
there.
Post by Calum Lind
On 18 March 2017 at 17:26, Faheem Mohammed <
Post by Faheem Mohammed
How to determine whether the download is finished.. Is there any
inbuilt
Post by Calum Lind
Post by Faheem Mohammed
function..
On Tue, Mar 14, 2017 at 8:18 PM, Arvid Norberg <
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to
retrieve
Post by Angel Leon
Post by Calum Lind
Post by Faheem Mohammed
filename
Post by Arvid Norberg
http://libtorrent.org/reference-Alerts.html#metadata-receive
d-alert
Post by Angel Leon
Post by Calum Lind
Post by Faheem Mohammed
Post by Arvid Norberg
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Post by Angel Leon
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Faheem Mohammed
2017-04-13 15:21:24 UTC
Permalink
I have been asking the same question for a long, but no one is replying.
Please it is very urgent.
How to retrieve filename from metadata in libtorrent. I searched the whole
libtorrent library but I cannot understand anything. Please give me a code.
I am doing it in python.
Regards

On Fri, Mar 24, 2017 at 12:21 AM, Faheem Mohammed <
Post by Faheem Mohammed
PLEASE HELP...
On Wed, Mar 22, 2017 at 11:27 PM, Faheem Mohammed <
Post by Faheem Mohammed
PLEASE HELP..
I have been looking through the documentation for a long, but cannot get
import libtorrent as lt
import time
import sys
ses = lt.session()
ses.listen_on(start_port, end_port)
ses.add_dht_router('dht.transmissionbt.com', start_port)
ses.add_dht_router('router.bittorrent.com', start_port)
ses.add_dht_router('router.utorrent.com', start_port)
ses.start_dht()
return ses
const_state_str = ['queued', 'checking', 'downloading metadata', \
'downloading', 'finished', 'seeding', 'allocating', 'checking fastresume']
const_pause_torrent = "pause_torrent"
const_resume_torrent = "resume_torrent"
const_kill_torrent = "kill_torrent"
const_user_logged_in = "user_logged_in"
const_user_logged_out = "user_logged_out"
const_quit_seeding = "quit_seeding"
ses = get_libtorrent_session_and_start_dht(6881, 6891)
torrent_info = file
torrent_handle = None
params = {
'save_path': '/home/faheem/Downloads/',
'storage_mode': lt.storage_mode_t(2)
}
link = "magnet:?xt=urn:btih:B583B1DE1473232CBC480E703F5F8EEDF647D531&dn=Rufus+2.12+Create+bootable+USB+flash+drives+%28USB+keys+or+pen+drives%2C+and+memory+sticks%29+-+786zx&tr=http%3A%2F%2Ft.nyaatracker.com <http://2ft.nyaatracker.com/>%2Fannounce&tr=http%3A%2F%2Ft.nyaatracker.com <http://2ft.nyaatracker.com/>%3A80%2Fannounce&tr=http%3A%2F%2Fipv4.tracker.harry.lu <http://2fipv4.tracker.harry.lu/>%2Fannounce&tr=http%3A%2F%2Fipv4.tracker.harry.lu <http://2fipv4.tracker.harry.lu/>%3A80%2Fannounce&tr=https%3A%2F%2Fopen.kickasstracker.com <http://2fopen.kickasstracker.com/>%3A443%2Fannounce&tr=http%3A%2F%2Ftracker.tfile.me <http://2ftracker.tfile.me/>%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk <http://2ftracker.coppersurfer.tk/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.ilibr.org <http://2ftracker.ilibr.org/>%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.pirateparty.gr <http://2ftracker.pirateparty.gr/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.ilibr.org <http://2ftracker.ilibr.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org <http://2ftracker.opentrackr.org/>%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to <http://2ftracker.zer0day.to/>%3A1337%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com <http://2fp4p.arenabg.com/>%3A1337%2Fannounce&tr=udp%3A%2F%2Fshadowshq.yi.org <http://2fshadowshq.yi.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Feddie4.nl%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to <http://2ftracker.zer0day.to/>%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org <http://2ftracker.leechers-paradise.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Fcoppersurfer.tk%3A6969%2Fannounce"
torrent_handle = lt.add_magnet_uri(ses,link,params)
raise exception
print "Getting meta data"
time.sleep(1)
print 'got metadata, starting torrent download...'
current_iteration = 0
torrent_status = torrent_handle.status()
print "current_iteration: " + str(current_iteration)
print 'Checking Torrent....'
continue
print'faheem %.3f MB'%(float(torrent_status.total_done/float(1000000)))
print '\r%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s' % \
(torrent_status.progress * 100, torrent_status.download_rate / 1000, torrent_status.upload_rate / 1000, \
torrent_status.num_peers, const_state_str[torrent_status.state]), \
sys.stdout.flush()
current_iteration += 1
print "Is Paused"
print "Is Not Paused"
time.sleep(1)
print'SEEDING'
On Tue, Mar 21, 2017 at 12:51 PM, Faheem Mohammed <
Post by Faheem Mohammed
Can anyone give me a code to retrieve filename in python. I am a
beginner in this, so can't convert the c code in documentation. Please
help...
Post by Angel Leon
My bad Faheem, I believe that didn't answer your question 100% as you may
also be dealing with a client that's been shut down and starting a previous
session, and the file may have already been completed.
In that case you want to take a look at torrent_handle::file_progress(
...)
file_progress()
void *file_progress* (std::vector<boost::int64_t>& progress, int flags
= 0) const;
This function fills in the supplied vector with the the number of bytes
downloaded of each file in this torrent. The progress values are ordered
the same as the files in the torrent_info
<http://www.libtorrent.org/reference-Core.html#torrent_info>. This
operation is not very cheap. Its complexity is *O(n + mj)*. Where *n* is
the number of files, *m* is the number of downloading pieces and *j* is the
number of blocks in a piece.
The flags parameter can be used to specify the granularity of the file
progress. If left at the default value of 0, the progress will be as
accurate as possible, but also more expensive to calculate. If
torrent_handle::piece_granularity is specified, the progress will be
specified in piece granularity. i.e. only pieces that have been fully
downloaded and passed the hash check count. When specifying piece
granularity, the operation is a lot cheaper, since libtorrent already keeps
track of this internally and no calculation is required.
Post by Angel Leon
The answer was on the first link given to you. Read about alerts.
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
You're interested in file-completed-alert
http://libtorrent.org/reference-Alerts.html#file-completed-alert
Read the answers given to you.
Sorry no you have been repeatedly given links to read the manual. You
did
Post by Angel Leon
not show any effort on your part to do research and I doubt anyone
else
Post by Angel Leon
here has any interest in fast-tracking your urgent deadline demands.
In
Post by Angel Leon
fact it would have been quicker to search the manual than write the
question.
http://www.catb.org/~esr/faqs/smart-questions.html
Sorry, I was a bit urgent... that's why??? Regards
Post by Calum Lind
Seriously?! People here don't mind answering questions but you are
just
Post by Angel Leon
Post by Calum Lind
being lazy and not reading the reference manual, all the answers are
there.
Post by Calum Lind
On 18 March 2017 at 17:26, Faheem Mohammed <
Post by Faheem Mohammed
How to determine whether the download is finished.. Is there any
inbuilt
Post by Calum Lind
Post by Faheem Mohammed
function..
On Tue, Mar 14, 2017 at 8:18 PM, Arvid Norberg <
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to
retrieve
Post by Angel Leon
Post by Calum Lind
Post by Faheem Mohammed
filename
Post by Arvid Norberg
http://libtorrent.org/reference-Alerts.html#metadata-receive
d-alert
Post by Angel Leon
Post by Calum Lind
Post by Faheem Mohammed
Post by Arvid Norberg
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Post by Angel Leon
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Faheem Mohammed
2017-04-13 16:29:54 UTC
Permalink
Sorry all for disturbing. I finally found the code. It is
torrent_handle.name()

I tried this code before, but forgot to specify name as a function, hence
it didn't work.

Thank you all

On Thu, Apr 13, 2017 at 8:51 PM, Faheem Mohammed <
Post by Faheem Mohammed
I have been asking the same question for a long, but no one is replying.
Please it is very urgent.
How to retrieve filename from metadata in libtorrent. I searched the whole
libtorrent library but I cannot understand anything. Please give me a code.
I am doing it in python.
Regards
On Fri, Mar 24, 2017 at 12:21 AM, Faheem Mohammed <
Post by Faheem Mohammed
PLEASE HELP...
On Wed, Mar 22, 2017 at 11:27 PM, Faheem Mohammed <
Post by Faheem Mohammed
PLEASE HELP..
I have been looking through the documentation for a long, but cannot get
import libtorrent as lt
import time
import sys
ses = lt.session()
ses.listen_on(start_port, end_port)
ses.add_dht_router('dht.transmissionbt.com', start_port)
ses.add_dht_router('router.bittorrent.com', start_port)
ses.add_dht_router('router.utorrent.com', start_port)
ses.start_dht()
return ses
const_state_str = ['queued', 'checking', 'downloading metadata', \
'downloading', 'finished', 'seeding', 'allocating', 'checking fastresume']
const_pause_torrent = "pause_torrent"
const_resume_torrent = "resume_torrent"
const_kill_torrent = "kill_torrent"
const_user_logged_in = "user_logged_in"
const_user_logged_out = "user_logged_out"
const_quit_seeding = "quit_seeding"
ses = get_libtorrent_session_and_start_dht(6881, 6891)
torrent_info = file
torrent_handle = None
params = {
'save_path': '/home/faheem/Downloads/',
'storage_mode': lt.storage_mode_t(2)
}
link = "magnet:?xt=urn:btih:B583B1DE1473232CBC480E703F5F8EEDF647D531&dn=Rufus+2.12+Create+bootable+USB+flash+drives+%28USB+keys+or+pen+drives%2C+and+memory+sticks%29+-+786zx&tr=http%3A%2F%2Ft.nyaatracker.com <http://2ft.nyaatracker.com/>%2Fannounce&tr=http%3A%2F%2Ft.nyaatracker.com <http://2ft.nyaatracker.com/>%3A80%2Fannounce&tr=http%3A%2F%2Fipv4.tracker.harry.lu <http://2fipv4.tracker.harry.lu/>%2Fannounce&tr=http%3A%2F%2Fipv4.tracker.harry.lu <http://2fipv4.tracker.harry.lu/>%3A80%2Fannounce&tr=https%3A%2F%2Fopen.kickasstracker.com <http://2fopen.kickasstracker.com/>%3A443%2Fannounce&tr=http%3A%2F%2Ftracker.tfile.me <http://2ftracker.tfile.me/>%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk <http://2ftracker.coppersurfer.tk/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.ilibr.org <http://2ftracker.ilibr.org/>%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.pirateparty.gr <http://2ftracker.pirateparty.gr/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.ilibr.org <http://2ftracker.ilibr.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org <http://2ftracker.opentrackr.org/>%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to <http://2ftracker.zer0day.to/>%3A1337%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com <http://2fp4p.arenabg.com/>%3A1337%2Fannounce&tr=udp%3A%2F%2Fshadowshq.yi.org <http://2fshadowshq.yi.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Feddie4.nl%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to <http://2ftracker.zer0day.to/>%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org <http://2ftracker.leechers-paradise.org/>%3A6969%2Fannounce&tr=udp%3A%2F%2Fcoppersurfer.tk%3A6969%2Fannounce"
torrent_handle = lt.add_magnet_uri(ses,link,params)
raise exception
print "Getting meta data"
time.sleep(1)
print 'got metadata, starting torrent download...'
current_iteration = 0
torrent_status = torrent_handle.status()
print "current_iteration: " + str(current_iteration)
print 'Checking Torrent....'
continue
print'faheem %.3f MB'%(float(torrent_status.total_done/float(1000000)))
print '\r%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s' % \
(torrent_status.progress * 100, torrent_status.download_rate / 1000, torrent_status.upload_rate / 1000, \
torrent_status.num_peers, const_state_str[torrent_status.state]), \
sys.stdout.flush()
current_iteration += 1
print "Is Paused"
print "Is Not Paused"
time.sleep(1)
print'SEEDING'
On Tue, Mar 21, 2017 at 12:51 PM, Faheem Mohammed <
Post by Faheem Mohammed
Can anyone give me a code to retrieve filename in python. I am a
beginner in this, so can't convert the c code in documentation. Please
help...
Post by Angel Leon
My bad Faheem, I believe that didn't answer your question 100% as you may
also be dealing with a client that's been shut down and starting a previous
session, and the file may have already been completed.
In that case you want to take a look at torrent_handle::file_progress(
...)
file_progress()
void *file_progress* (std::vector<boost::int64_t>& progress, int flags
= 0) const;
This function fills in the supplied vector with the the number of bytes
downloaded of each file in this torrent. The progress values are ordered
the same as the files in the torrent_info
<http://www.libtorrent.org/reference-Core.html#torrent_info>. This
operation is not very cheap. Its complexity is *O(n + mj)*. Where *n* is
the number of files, *m* is the number of downloading pieces and *j* is the
number of blocks in a piece.
The flags parameter can be used to specify the granularity of the file
progress. If left at the default value of 0, the progress will be as
accurate as possible, but also more expensive to calculate. If
torrent_handle::piece_granularity is specified, the progress will be
specified in piece granularity. i.e. only pieces that have been fully
downloaded and passed the hash check count. When specifying piece
granularity, the operation is a lot cheaper, since libtorrent already keeps
track of this internally and no calculation is required.
Post by Angel Leon
The answer was on the first link given to you. Read about alerts.
http://libtorrent.org/reference-Alerts.html#metadata-received-alert
You're interested in file-completed-alert
http://libtorrent.org/reference-Alerts.html#file-completed-alert
Read the answers given to you.
Sorry no you have been repeatedly given links to read the manual.
You did
Post by Angel Leon
not show any effort on your part to do research and I doubt anyone
else
Post by Angel Leon
here has any interest in fast-tracking your urgent deadline demands.
In
Post by Angel Leon
fact it would have been quicker to search the manual than write the
question.
http://www.catb.org/~esr/faqs/smart-questions.html
Sorry, I was a bit urgent... that's why??? Regards
Post by Calum Lind
Seriously?! People here don't mind answering questions but you are
just
Post by Angel Leon
Post by Calum Lind
being lazy and not reading the reference manual, all the answers
are
Post by Angel Leon
there.
Post by Calum Lind
On 18 March 2017 at 17:26, Faheem Mohammed <
Post by Faheem Mohammed
How to determine whether the download is finished.. Is there any
inbuilt
Post by Calum Lind
Post by Faheem Mohammed
function..
On Tue, Mar 14, 2017 at 8:18 PM, Arvid Norberg <
Post by Arvid Norberg
On Tue, Mar 14, 2017 at 10:26 AM, Faheem Mohammed <
Post by Faheem Mohammed
can you please explain the code using torrent handle to
retrieve
Post by Angel Leon
Post by Calum Lind
Post by Faheem Mohammed
filename
Post by Arvid Norberg
http://libtorrent.org/reference-Alerts.html#metadata-receive
d-alert
Post by Angel Leon
Post by Calum Lind
Post by Faheem Mohammed
Post by Arvid Norberg
http://libtorrent.org/reference-Core.html#torrent_file()
http://libtorrent.org/reference-Core.html#torrent_info
http://libtorrent.org/reference-Core.html#files()
http://libtorrent.org/reference-Storage.html#file_storage
http://libtorrent.org/reference-Storage.html#num_files()
http://libtorrent.org/reference-Storage.html#file_path()
--
Arvid Norberg
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-disc
uss
Post by Angel Leon
Post by Calum Lind
Post by Faheem Mohammed
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Post by Angel Leon
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Loading...