diff options
author | mona <mona@monapc.(none)> | 2010-06-14 22:49:13 +0300 |
---|---|---|
committer | mona <mona@monapc.(none)> | 2010-06-14 22:49:13 +0300 |
commit | 4e196f0f22a045ea3841c7613a3472d1853c5a34 (patch) | |
tree | 1e0cc15226acd1802f198e6c54fd4d2c8b674cd1 /segget/distfile.cpp | |
parent | Add curses ui. (diff) | |
download | idfetch-4e196f0f22a045ea3841c7613a3472d1853c5a34.tar.gz idfetch-4e196f0f22a045ea3841c7613a3472d1853c5a34.tar.bz2 idfetch-4e196f0f22a045ea3841c7613a3472d1853c5a34.zip |
Add Tsettings class. Settings include feature to skip fetching of downloaded files
Diffstat (limited to 'segget/distfile.cpp')
-rw-r--r-- | segget/distfile.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/segget/distfile.cpp b/segget/distfile.cpp index 32eb7ca..293f10b 100644 --- a/segget/distfile.cpp +++ b/segget/distfile.cpp @@ -41,7 +41,7 @@ public: void load_distfile_from_json(json_object* json_obj_distfile); void load_url_list(json_object* json_array_distfile_urllist); void split_into_segments(); - Tsegment* provide_segment(CURLM* cm, uint con_num, uint seg_num); + int provide_segment(CURLM* cm, uint con_num, uint seg_num); }; void Tdistfile::load_url_list(json_object* json_array_distfile_urllist){ @@ -89,12 +89,17 @@ Tdistfile::~Tdistfile(){ delete [] url_list; } -Tsegment* Tdistfile::provide_segment(CURLM* cm, uint con_num, uint seg_num) +int Tdistfile::provide_segment(CURLM* cm, uint con_num, uint seg_num) { // cout << "=Seg #"<<seg_num<< " of "<<segments_count<< " from " << "url:"<<url_list[url_num]<<"\n"; - url_num++; - if (url_num >= url_count) - url_num=0; - dn_segments[seg_num].prepare_for_connection(cm, con_num, url_list[url_num]); - return &dn_segments[seg_num]; + if (dn_segments[seg_num].downloaded) + return 1; + else{ + url_num++; + if (url_num >= url_count) + url_num=0; + dn_segments[seg_num].prepare_for_connection(cm, con_num, url_list[url_num]); + return 0; + } + //segment=dn_segments[seg_num]; } |