forked from premiere/premiere-libtorrent
*** empty log message ***
This commit is contained in:
parent
bcaf8af662
commit
6a09806ad4
|
@ -59,7 +59,7 @@
|
|||
<li><a class="reference" href="#trackers" id="id48" name="id48">trackers()</a></li>
|
||||
<li><a class="reference" href="#total-size-piece-length-piece-size-num-pieces" id="id49" name="id49">total_size() piece_length() piece_size() num_pieces()</a></li>
|
||||
<li><a class="reference" href="#hash-for-piece-info-hash" id="id50" name="id50">hash_for_piece() info_hash()</a></li>
|
||||
<li><a class="reference" href="#name-comment-creation-date" id="id51" name="id51">name() comment() creation_date()</a></li>
|
||||
<li><a class="reference" href="#name-comment-creation-date-creator" id="id51" name="id51">name() comment() creation_date() creator()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#torrent-handle" id="id52" name="id52">torrent_handle</a><ul>
|
||||
|
@ -941,6 +941,7 @@ public:
|
|||
sha1_hash const& info_hash() const;
|
||||
std::stirng const& name() const;
|
||||
std::string const& comment() const;
|
||||
std::string const& creator() const;
|
||||
|
||||
boost::optional<boost::posix_time::ptime>
|
||||
creation_date() const;
|
||||
|
@ -1117,8 +1118,8 @@ sha1_hash const& hash_for_piece(unsigned int index) const;
|
|||
piece and <tt class="docutils literal"><span class="pre">info_hash()</span></tt> returns the 20-bytes sha1-hash for the info-section of the
|
||||
torrent file. For more information on the <tt class="docutils literal"><span class="pre">sha1_hash</span></tt>, see the <a class="reference" href="#big-number">big_number</a> class.</p>
|
||||
</div>
|
||||
<div class="section" id="name-comment-creation-date">
|
||||
<h2><a name="name-comment-creation-date">name() comment() creation_date()</a></h2>
|
||||
<div class="section" id="name-comment-creation-date-creator">
|
||||
<h2><a name="name-comment-creation-date-creator">name() comment() creation_date() creator()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
std::string const& name() const;
|
||||
|
@ -1131,6 +1132,8 @@ boost::optional<boost::posix_time::ptime> creation_date() const;
|
|||
it will return an empty string. <tt class="docutils literal"><span class="pre">creation_date()</span></tt> returns a <a class="reference" href="http://www.boost.org/libs/date_time/doc/class_ptime.html">boost::posix_time::ptime</a>
|
||||
object, representing the time when this torrent file was created. If there's no timestamp
|
||||
in the torrent file, this will return a date of january 1:st 1970.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">cretor()</span></tt> returns the creator string in the torrent. If there is no creator string
|
||||
it will return an empty string.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="torrent-handle">
|
||||
|
|
|
@ -849,6 +849,7 @@ The ``torrent_info`` has the following synopsis::
|
|||
sha1_hash const& info_hash() const;
|
||||
std::stirng const& name() const;
|
||||
std::string const& comment() const;
|
||||
std::string const& creator() const;
|
||||
|
||||
boost::optional<boost::posix_time::ptime>
|
||||
creation_date() const;
|
||||
|
@ -1047,8 +1048,8 @@ piece and ``info_hash()`` returns the 20-bytes sha1-hash for the info-section of
|
|||
torrent file. For more information on the ``sha1_hash``, see the big_number_ class.
|
||||
|
||||
|
||||
name() comment() creation_date()
|
||||
--------------------------------
|
||||
name() comment() creation_date() creator()
|
||||
------------------------------------------
|
||||
|
||||
::
|
||||
|
||||
|
@ -1063,6 +1064,9 @@ it will return an empty string. ``creation_date()`` returns a `boost::posix_time
|
|||
object, representing the time when this torrent file was created. If there's no timestamp
|
||||
in the torrent file, this will return a date of january 1:st 1970.
|
||||
|
||||
``cretor()`` returns the creator string in the torrent. If there is no creator string
|
||||
it will return an empty string.
|
||||
|
||||
__ http://www.boost.org/libs/date_time/doc/class_ptime.html
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
<div class="section" id="introduction">
|
||||
<h1><a name="introduction">introduction</a></h1>
|
||||
<h1><a class="toc-backref" href="#id6" name="introduction">introduction</a></h1>
|
||||
<p>A tracker with the protocol "udp://" in its URI
|
||||
is supposed to be contacted using this protocol.</p>
|
||||
<p>This protocol is supported by
|
||||
|
@ -57,9 +57,9 @@ the request. If no reply has been received after 60 seconds, stop
|
|||
retrying.</p>
|
||||
</div>
|
||||
<div class="section" id="connecting">
|
||||
<h1><a name="connecting">connecting</a></h1>
|
||||
<h1><a class="toc-backref" href="#id7" name="connecting">connecting</a></h1>
|
||||
<div class="section" id="client-sends-packet">
|
||||
<h2><a name="client-sends-packet">Client sends packet:</a></h2>
|
||||
<h2><a class="toc-backref" href="#id8" name="client-sends-packet">Client sends packet:</a></h2>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="18%" />
|
||||
|
@ -91,7 +91,7 @@ identify the protocol.</td>
|
|||
</table>
|
||||
</div>
|
||||
<div class="section" id="server-replies-with-packet">
|
||||
<h2><a name="server-replies-with-packet">Server replies with packet:</a></h2>
|
||||
<h2><a class="toc-backref" href="#id9" name="server-replies-with-packet">Server replies with packet:</a></h2>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="18%" />
|
||||
|
@ -131,9 +131,9 @@ anymore.</td>
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="announcing">
|
||||
<h1><a name="announcing">announcing</a></h1>
|
||||
<h1><a class="toc-backref" href="#id10" name="announcing">announcing</a></h1>
|
||||
<div class="section" id="id2">
|
||||
<h2><a name="id2">Client sends packet:</a></h2>
|
||||
<h2><a class="toc-backref" href="#id11" name="id2">Client sends packet:</a></h2>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="18%" />
|
||||
|
@ -226,7 +226,7 @@ in the reply. Use -1 for default.</td>
|
|||
</table>
|
||||
</div>
|
||||
<div class="section" id="id3">
|
||||
<h2><a name="id3">Server replies with packet:</a></h2>
|
||||
<h2><a class="toc-backref" href="#id12" name="id3">Server replies with packet:</a></h2>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="18%" />
|
||||
|
@ -297,9 +297,9 @@ seeding.</td>
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="scraping">
|
||||
<h1><a name="scraping">scraping</a></h1>
|
||||
<h1><a class="toc-backref" href="#id13" name="scraping">scraping</a></h1>
|
||||
<div class="section" id="id4">
|
||||
<h2><a name="id4">Client sends packet:</a></h2>
|
||||
<h2><a class="toc-backref" href="#id14" name="id4">Client sends packet:</a></h2>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="18%" />
|
||||
|
@ -360,7 +360,7 @@ follow.</td>
|
|||
</table>
|
||||
</div>
|
||||
<div class="section" id="id5">
|
||||
<h2><a name="id5">Server replies with packet:</a></h2>
|
||||
<h2><a class="toc-backref" href="#id15" name="id5">Server replies with packet:</a></h2>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="18%" />
|
||||
|
@ -420,10 +420,10 @@ leechers.</td>
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="errors">
|
||||
<h1><a name="errors">errors</a></h1>
|
||||
<h1><a class="toc-backref" href="#id16" name="errors">errors</a></h1>
|
||||
<p>In case of a tracker error,</p>
|
||||
<div class="section" id="server-replies-packet">
|
||||
<h2><a name="server-replies-packet">server replies packet:</a></h2>
|
||||
<h2><a class="toc-backref" href="#id17" name="server-replies-packet">server replies packet:</a></h2>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="18%" />
|
||||
|
@ -457,7 +457,7 @@ describing the error.</td>
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="actions">
|
||||
<h1><a name="actions">actions</a></h1>
|
||||
<h1><a class="toc-backref" href="#id18" name="actions">actions</a></h1>
|
||||
<p>The action fields has the following encoding:</p>
|
||||
<blockquote>
|
||||
<ul class="simple">
|
||||
|
@ -469,7 +469,7 @@ describing the error.</td>
|
|||
</blockquote>
|
||||
</div>
|
||||
<div class="section" id="extensions">
|
||||
<h1><a name="extensions">extensions</a></h1>
|
||||
<h1><a class="toc-backref" href="#id19" name="extensions">extensions</a></h1>
|
||||
<p>The extensions field is a bitmask. The following
|
||||
bits are assigned:</p>
|
||||
<blockquote>
|
||||
|
@ -478,7 +478,7 @@ bits are assigned:</p>
|
|||
</ul>
|
||||
</blockquote>
|
||||
<div class="section" id="authentication">
|
||||
<h2><a name="authentication">authentication</a></h2>
|
||||
<h2><a class="toc-backref" href="#id20" name="authentication">authentication</a></h2>
|
||||
<p>The packet will have an authentication part
|
||||
appended to it. It has the following format:</p>
|
||||
<table border="1" class="docutils">
|
||||
|
@ -518,7 +518,7 @@ from the 20 bytes hash calculated.</td>
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
<h1><a name="credits">credits</a></h1>
|
||||
<h1><a class="toc-backref" href="#id21" name="credits">credits</a></h1>
|
||||
<p>Protocol designed by Olaf van der Spek</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -79,6 +79,8 @@ int main(int argc, char* argv[])
|
|||
std::cout << "number of pieces: " << t.num_pieces() << "\n";
|
||||
std::cout << "piece length: " << t.piece_length() << "\n";
|
||||
std::cout << "info hash: " << t.info_hash() << "\n";
|
||||
std::cout << "comment: " << t.comment() << "\n";
|
||||
std::cout << "created_by: " << t.creator() << "\n";
|
||||
std::cout << "files:\n";
|
||||
for (torrent_info::file_iterator i = t.begin_files();
|
||||
i != t.end_files(); ++i)
|
||||
|
|
|
@ -138,6 +138,9 @@ namespace libtorrent
|
|||
boost::optional<boost::posix_time::ptime>
|
||||
creation_date() const;
|
||||
|
||||
const std::string& creator() const
|
||||
{ return m_created_by; }
|
||||
|
||||
const std::string& comment() const
|
||||
{ return m_comment; }
|
||||
|
||||
|
|
|
@ -203,13 +203,9 @@ namespace libtorrent
|
|||
|
||||
// extract file name (or the directory name if it's a multifile libtorrent)
|
||||
if (entry const* e = info.find_key("name.utf-8"))
|
||||
{
|
||||
m_name = e->string();
|
||||
}
|
||||
{ m_name = e->string(); }
|
||||
else
|
||||
{
|
||||
m_name = info["name"].string();
|
||||
}
|
||||
{ m_name = info["name"].string(); }
|
||||
|
||||
path tmp = m_name;
|
||||
if (tmp.is_complete()) throw std::runtime_error("torrent contains "
|
||||
|
@ -314,19 +310,16 @@ namespace libtorrent
|
|||
catch (type_error) {}
|
||||
|
||||
// extract comment
|
||||
try
|
||||
{
|
||||
m_comment = torrent_file["comment"].string();
|
||||
}
|
||||
catch (type_error) {}
|
||||
|
||||
// extract comment
|
||||
try
|
||||
{
|
||||
m_created_by = torrent_file["created by"].string();
|
||||
}
|
||||
catch (type_error) {}
|
||||
if (entry const* e = torrent_file.find_key("comment.utf-8"))
|
||||
{ m_comment = e->string(); }
|
||||
else if (entry const* e = torrent_file.find_key("comment"))
|
||||
{ m_comment = e->string(); }
|
||||
|
||||
if (entry const* e = torrent_file.find_key("created by.utf-8"))
|
||||
{ m_created_by = e->string(); }
|
||||
else if (entry const* e = torrent_file.find_key("created by"))
|
||||
{ m_created_by = e->string(); }
|
||||
|
||||
parse_info_section(torrent_file["info"]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue