add rss support to client_test
This commit is contained in:
parent
a79fb228f2
commit
54dd2a06f5
|
@ -192,6 +192,7 @@ enum {
|
||||||
torrents_queued,
|
torrents_queued,
|
||||||
torrents_stopped,
|
torrents_stopped,
|
||||||
torrents_checking,
|
torrents_checking,
|
||||||
|
torrents_feeds,
|
||||||
|
|
||||||
torrents_max
|
torrents_max
|
||||||
};
|
};
|
||||||
|
@ -262,6 +263,7 @@ bool show_torrent(libtorrent::torrent_status const& st, int torrent_filter, int*
|
||||||
case torrents_stopped: return st.paused && !st.auto_managed;
|
case torrents_stopped: return st.paused && !st.auto_managed;
|
||||||
case torrents_checking: return st.state == torrent_status::checking_files
|
case torrents_checking: return st.state == torrent_status::checking_files
|
||||||
|| st.state == torrent_status::queued_for_checking;
|
|| st.state == torrent_status::queued_for_checking;
|
||||||
|
case torrents_feeds: return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1450,6 +1452,17 @@ int main(int argc, char* argv[])
|
||||||
if (c == '5') print_peer_rate = !print_peer_rate;
|
if (c == '5') print_peer_rate = !print_peer_rate;
|
||||||
if (c == '6') print_fails = !print_fails;
|
if (c == '6') print_fails = !print_fails;
|
||||||
if (c == '7') print_send_bufs = !print_send_bufs;
|
if (c == '7') print_send_bufs = !print_send_bufs;
|
||||||
|
if (c == 'y')
|
||||||
|
{
|
||||||
|
char url[2048];
|
||||||
|
puts("Enter RSS feed URL:\n");
|
||||||
|
scanf("%2048s", url);
|
||||||
|
feed_settings set;
|
||||||
|
set.url = url;
|
||||||
|
set.add_args.save_path = save_path;
|
||||||
|
feed_handle h = ses.add_feed(set);
|
||||||
|
h.update_feed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (c == 'q') break;
|
if (c == 'q') break;
|
||||||
|
|
||||||
|
@ -1497,7 +1510,7 @@ int main(int argc, char* argv[])
|
||||||
"[1] toggle IP [2] toggle AS [3] toggle timers [4] toggle block progress "
|
"[1] toggle IP [2] toggle AS [3] toggle timers [4] toggle block progress "
|
||||||
"[5] toggle peer rate [6] toggle failures [7] toggle send buffers [R] save resume data\n";
|
"[5] toggle peer rate [6] toggle failures [7] toggle send buffers [R] save resume data\n";
|
||||||
|
|
||||||
char const* filter_names[] = { "all", "downloading", "non-paused", "seeding", "queued", "stopped", "checking"};
|
char const* filter_names[] = { "all", "downloading", "non-paused", "seeding", "queued", "stopped", "checking", "RSS"};
|
||||||
for (int i = 0; i < int(sizeof(filter_names)/sizeof(filter_names[0])); ++i)
|
for (int i = 0; i < int(sizeof(filter_names)/sizeof(filter_names[0])); ++i)
|
||||||
{
|
{
|
||||||
char filter[200];
|
char filter[200];
|
||||||
|
@ -1510,6 +1523,32 @@ int main(int argc, char* argv[])
|
||||||
char str[500];
|
char str[500];
|
||||||
int torrent_index = 0;
|
int torrent_index = 0;
|
||||||
int lines_printed = 3;
|
int lines_printed = 3;
|
||||||
|
|
||||||
|
if (torrent_filter == torrents_feeds)
|
||||||
|
{
|
||||||
|
std::vector<feed_handle> feeds;
|
||||||
|
ses.get_feeds(feeds);
|
||||||
|
for (std::vector<feed_handle>::iterator i = feeds.begin()
|
||||||
|
, end(feeds.end()); i != end; ++i)
|
||||||
|
{
|
||||||
|
if (lines_printed >= terminal_height - 15)
|
||||||
|
{
|
||||||
|
out += "...\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
feed_status st = i->get_feed_status();
|
||||||
|
if (st.url.size() > 70) st.url.resize(70);
|
||||||
|
snprintf(str, sizeof(str), "%-70s %c %4d (%2d) %s\n", st.url.c_str()
|
||||||
|
, st.updating? 'u' : '-'
|
||||||
|
, st.next_update
|
||||||
|
, int(st.items.size())
|
||||||
|
, st.error ? st.error.message().c_str() : "");
|
||||||
|
out += str;
|
||||||
|
++lines_printed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (std::vector<torrent_status>::iterator i = handles.begin();
|
for (std::vector<torrent_status>::iterator i = handles.begin();
|
||||||
i != handles.end(); ++torrent_index)
|
i != handles.end(); ++torrent_index)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1179,8 +1179,10 @@ namespace aux {
|
||||||
boost::shared_ptr<feed> f(new_feed(*this, feed_settings()));
|
boost::shared_ptr<feed> f(new_feed(*this, feed_settings()));
|
||||||
if (settings->list_at(i)->type() != lazy_entry::dict_t) continue;
|
if (settings->list_at(i)->type() != lazy_entry::dict_t) continue;
|
||||||
f->load_state(*settings->list_at(i));
|
f->load_state(*settings->list_at(i));
|
||||||
|
f->update_feed();
|
||||||
m_feeds.push_back(f);
|
m_feeds.push_back(f);
|
||||||
}
|
}
|
||||||
|
update_rss_feeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||||
|
|
Loading…
Reference in New Issue