mirror of
https://github.com/gnosygnu/xowa.git
synced 2025-06-13 12:54:14 +00:00
DownloadCentral: Do not pack text files in html package
This commit is contained in:
parent
bd6576b716
commit
50a063c8de
@ -20,7 +20,7 @@ import gplx.xowa.addons.bldrs.centrals.tasks.*;
|
|||||||
import gplx.xowa.wikis.domains.*;
|
import gplx.xowa.wikis.domains.*;
|
||||||
import gplx.xowa.langs.*;
|
import gplx.xowa.langs.*;
|
||||||
public class Xobc_filter_mgr {
|
public class Xobc_filter_mgr {
|
||||||
public static Xobc_task_itm[] Filter_by_lang(Xobc_task_regy__base task_list, String lang_key_str) {
|
public static Xobc_task_itm[] Filter(Xobc_task_regy__base task_list, String lang_key_str, String type_key_str) {
|
||||||
List_adp tmp = List_adp_.New();
|
List_adp tmp = List_adp_.New();
|
||||||
|
|
||||||
// loop tasks and find matches
|
// loop tasks and find matches
|
||||||
@ -28,7 +28,11 @@ public class Xobc_filter_mgr {
|
|||||||
for (int i = 0; i < len; ++i) {
|
for (int i = 0; i < len; ++i) {
|
||||||
Xobc_task_itm task = (Xobc_task_itm)task_list.Get_at(i);
|
Xobc_task_itm task = (Xobc_task_itm)task_list.Get_at(i);
|
||||||
Xobc_task_key task_key_itm = Xobc_task_key.To_itm(task.Task_key());
|
Xobc_task_key task_key_itm = Xobc_task_key.To_itm(task.Task_key());
|
||||||
if (Xow_domain_itm_.Match_lang(task_key_itm.Wiki_domain_itm(), lang_key_str))
|
Xow_domain_itm task_domain = task_key_itm.Wiki_domain_itm();
|
||||||
|
if ( Xow_domain_itm_.Match_lang(task_domain, lang_key_str)
|
||||||
|
&& Xow_domain_itm_.Match_type(task_domain, type_key_str)
|
||||||
|
)
|
||||||
|
|
||||||
tmp.Add(task);
|
tmp.Add(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,14 +33,14 @@ public class Xobc_task_bridge implements gplx.xowa.htmls.bridges.Bridge_cmd_itm
|
|||||||
case Proc__run_next: task_mgr.Work_mgr().Run_next(); break;
|
case Proc__run_next: task_mgr.Work_mgr().Run_next(); break;
|
||||||
case Proc__stop_cur: task_mgr.Work_mgr().Stop_cur(); break;
|
case Proc__stop_cur: task_mgr.Work_mgr().Stop_cur(); break;
|
||||||
case Proc__redo_cur: task_mgr.Work_mgr().Redo_cur(); break;
|
case Proc__redo_cur: task_mgr.Work_mgr().Redo_cur(); break;
|
||||||
case Proc__filter_by_lang: task_mgr.Filter_by_lang(args.Get_as_str("lang_key")); break;
|
case Proc__filter_todo: task_mgr.Filter_todo(args.Get_as_str("lang_key"), args.Get_as_str("type_key")); break;
|
||||||
case Proc__download_db: gplx.xowa.addons.bldrs.centrals.dbs.Xobc_data_db_upgrader.Check_for_updates(task_mgr); break;
|
case Proc__download_db: gplx.xowa.addons.bldrs.centrals.dbs.Xobc_data_db_upgrader.Check_for_updates(task_mgr); break;
|
||||||
default: throw Err_.new_unhandled_default(proc_id);
|
default: throw Err_.new_unhandled_default(proc_id);
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
private static final byte[] Msg__proc = Bry_.new_a7("proc"), Msg__args = Bry_.new_a7("args");
|
private static final byte[] Msg__proc = Bry_.new_a7("proc"), Msg__args = Bry_.new_a7("args");
|
||||||
private static final byte Proc__reload = 0, Proc__add_work = 1, Proc__del_work = 2, Proc__del_done = 3, Proc__run_next = 4, Proc__stop_cur = 5, Proc__redo_cur = 6, Proc__download_db = 7, Proc__filter_by_lang = 8;
|
private static final byte Proc__reload = 0, Proc__add_work = 1, Proc__del_work = 2, Proc__del_done = 3, Proc__run_next = 4, Proc__stop_cur = 5, Proc__redo_cur = 6, Proc__download_db = 7, Proc__filter_todo = 8;
|
||||||
private static final Hash_adp_bry proc_hash = Hash_adp_bry.cs()
|
private static final Hash_adp_bry proc_hash = Hash_adp_bry.cs()
|
||||||
.Add_str_byte("reload" , Proc__reload)
|
.Add_str_byte("reload" , Proc__reload)
|
||||||
.Add_str_byte("add_work" , Proc__add_work)
|
.Add_str_byte("add_work" , Proc__add_work)
|
||||||
@ -50,7 +50,7 @@ public class Xobc_task_bridge implements gplx.xowa.htmls.bridges.Bridge_cmd_itm
|
|||||||
.Add_str_byte("stop_cur" , Proc__stop_cur)
|
.Add_str_byte("stop_cur" , Proc__stop_cur)
|
||||||
.Add_str_byte("redo_cur" , Proc__redo_cur)
|
.Add_str_byte("redo_cur" , Proc__redo_cur)
|
||||||
.Add_str_byte("download_db" , Proc__download_db)
|
.Add_str_byte("download_db" , Proc__download_db)
|
||||||
.Add_str_byte("filter_by_lang" , Proc__filter_by_lang)
|
.Add_str_byte("filter_todo" , Proc__filter_todo)
|
||||||
;
|
;
|
||||||
|
|
||||||
public byte[] Key() {return BRIDGE_KEY;} public static final byte[] BRIDGE_KEY = Bry_.new_a7("builder_central.exec");
|
public byte[] Key() {return BRIDGE_KEY;} public static final byte[] BRIDGE_KEY = Bry_.new_a7("builder_central.exec");
|
||||||
|
@ -60,11 +60,11 @@ public class Xobc_task_mgr implements Xog_json_wkr {
|
|||||||
done_mgr.Save_to(lists_nde.New_ary("done"));
|
done_mgr.Save_to(lists_nde.New_ary("done"));
|
||||||
cbk_mgr.Send_json(cbk_trg, "xo.bldr.core.reload__recv", root);
|
cbk_mgr.Send_json(cbk_trg, "xo.bldr.core.reload__recv", root);
|
||||||
}
|
}
|
||||||
public void Filter_by_lang(String lang_key) {
|
public void Filter_todo(String lang_key, String type_key) {
|
||||||
Gfo_log_.Instance.Info("task_mgr.filter_by_lang.bgn");
|
Gfo_log_.Instance.Info("task_mgr.filter_by_lang.bgn");
|
||||||
Gfobj_nde root = Gfobj_nde.New();
|
Gfobj_nde root = Gfobj_nde.New();
|
||||||
Gfobj_nde lists_nde = root.New_nde("lists").Add_str("list_name", "todo");
|
Gfobj_nde lists_nde = root.New_nde("lists").Add_str("list_name", "todo");
|
||||||
todo_mgr.Save_to(lists_nde.New_ary("todo"), Xobc_filter_mgr.Filter_by_lang(todo_mgr, lang_key));
|
todo_mgr.Save_to(lists_nde.New_ary("todo"), Xobc_filter_mgr.Filter(todo_mgr, lang_key, type_key));
|
||||||
cbk_mgr.Send_json(cbk_trg, "xo.bldr.core.reload_list__recv", root);
|
cbk_mgr.Send_json(cbk_trg, "xo.bldr.core.reload_list__recv", root);
|
||||||
}
|
}
|
||||||
public void Transfer(Xobc_task_regy__base src, Xobc_task_regy__base trg, Xobc_task_itm task) {
|
public void Transfer(Xobc_task_regy__base src, Xobc_task_regy__base trg, Xobc_task_itm task) {
|
||||||
|
@ -36,7 +36,7 @@ class Pack_hash_bldr {
|
|||||||
for (int i = 0; i < len; ++i) {
|
for (int i = 0; i < len; ++i) {
|
||||||
Xow_db_file file = db_mgr.Dbs__get_at(i);
|
Xow_db_file file = db_mgr.Dbs__get_at(i);
|
||||||
int pack_tid = Get_pack_tid(file.Tid());
|
int pack_tid = Get_pack_tid(file.Tid());
|
||||||
if (pack_tid == Xobc_import_type.Tid__ignore) continue;
|
if (Int_.In(pack_tid, Xobc_import_type.Tid__ignore, Xobc_import_type.Tid__wiki__text)) continue;
|
||||||
rv.Add(zip_name_bldr, pack_tid, file.Url());
|
rv.Add(zip_name_bldr, pack_tid, file.Url());
|
||||||
}
|
}
|
||||||
rv.Consolidate(Xobc_import_type.Tid__wiki__srch);
|
rv.Consolidate(Xobc_import_type.Tid__wiki__srch);
|
||||||
|
@ -90,7 +90,22 @@ public class Xow_domain_itm_ {
|
|||||||
return String_.Eq(cur, "lzh");
|
return String_.Eq(cur, "lzh");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public static final String Lang_key__all = "*";
|
public static boolean Match_type(Xow_domain_itm domain, String match) {
|
||||||
|
// exit early if "*"
|
||||||
|
if (String_.Eq(match, Type_key__all)) return true;
|
||||||
|
|
||||||
|
// get lang
|
||||||
|
String cur = domain.Domain_type().Key_str();
|
||||||
|
|
||||||
|
// return true if direct match; EX: "wiki" <-> "wiki"; "wiktionary" <-> "wiktionary"
|
||||||
|
if (String_.Eq(cur, match)) return true;
|
||||||
|
|
||||||
|
// handle special cases
|
||||||
|
if (String_.Eq(match, "wikimisc"))
|
||||||
|
return String_.In(domain.Domain_str(), "species.wikimedia.org", "www.wikidata.org", "commons.wikimedia.org");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public static final String Lang_key__all = "*", Type_key__all = "*";
|
||||||
|
|
||||||
private static Xow_domain_itm new_other(byte[] raw) {return Xow_domain_itm.new_(raw, Xow_domain_tid_.Tid__other, Xol_lang_stub_.Key__unknown);}
|
private static Xow_domain_itm new_other(byte[] raw) {return Xow_domain_itm.new_(raw, Xow_domain_tid_.Tid__other, Xol_lang_stub_.Key__unknown);}
|
||||||
private static byte[] Get_lang_code_for_mw_messages_file(byte[] v) {
|
private static byte[] Get_lang_code_for_mw_messages_file(byte[] v) {
|
||||||
|
Loading…
Reference in New Issue
Block a user