1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.8.1.1'

This commit is contained in:
gnosygnu
2016-07-31 21:41:19 -04:00
parent 8e91ac0bc4
commit b0fdf78a41
388 changed files with 3517 additions and 2553 deletions

View File

@@ -24,7 +24,7 @@ public class Xof_ext_ {
, Id_mid = 10, Id_ogg = 11, Id_oga = 12, Id_ogv = 13, Id_webm = 14
, Id_flac = 15, Id_bmp = 16, Id_xcf = 17, Id_wav = 18;
public static final int Id__max = 19;
public static final byte[]
public static final byte[]
Bry_png = Bry_.new_a7("png"), Bry_jpg = Bry_.new_a7("jpg"), Bry_jpeg = Bry_.new_a7("jpeg")
, Bry_gif = Bry_.new_a7("gif"), Bry_tif = Bry_.new_a7("tif"), Bry_tiff = Bry_.new_a7("tiff")
, Bry_svg = Bry_.new_a7("svg"), Bry_djvu = Bry_.new_a7("djvu"), Bry_pdf = Bry_.new_a7("pdf")
@@ -32,7 +32,7 @@ public class Xof_ext_ {
, Bry_ogv = Bry_.new_a7("ogv"), Bry_webm = Bry_.new_a7("webm"), Bry_flac = Bry_.new_a7("flac")
, Bry_bmp = Bry_.new_a7("bmp"), Bry_xcf = Bry_.new_a7("xcf"), Bry_wav = Bry_.new_a7("wav")
;
public static final byte[][] Bry__ary = new byte[][]
public static final byte[][] Bry__ary = new byte[][]
{ Bry_.Empty, Bry_png, Bry_jpg, Bry_jpeg
, Bry_gif, Bry_tif, Bry_tiff
, Bry_svg, Bry_djvu, Bry_pdf
@@ -40,7 +40,7 @@ public class Xof_ext_ {
, Bry_ogv, Bry_webm, Bry_flac
, Bry_bmp, Bry_xcf, Bry_wav
};
public static final byte[][] Mime_type__ary = new byte[][]
public static final byte[][] Mime_type__ary = new byte[][]
{ Bry_.new_a7("application/octet-stream"), Bry_.new_a7("image/png"), Bry_.new_a7("image/jpg"), Bry_.new_a7("image/jpeg")
, Bry_.new_a7("image/gif"), Bry_.new_a7("image/tiff"), Bry_.new_a7("image/tiff")
, Bry_.new_a7("image/svg+xml"), Bry_.new_a7("image/x.djvu"), Bry_.new_a7("application/pdf")
@@ -48,7 +48,7 @@ public class Xof_ext_ {
, Bry_.new_a7("video/ogg"), Bry_.new_a7("video/webm"), Bry_.new_a7("audio/flac")
, Bry_.new_a7("image/bmp"), Bry_.new_a7("image/xcf"), Bry_.new_a7("audio/x-wav")
};
private static final Hash_adp id_hash = id_hash_new_();
private static final Hash_adp id_hash = id_hash_new_();
private static Hash_adp id_hash_new_() {
Hash_adp rv = Hash_adp_bry.cs();
id_hash_new_(rv, Bry_png, Id_png); id_hash_new_(rv, Bry_jpg, Id_jpg); id_hash_new_(rv, Bry_jpeg, Id_jpeg);
@@ -59,9 +59,9 @@ public class Xof_ext_ {
id_hash_new_(rv, Bry_bmp, Id_bmp); id_hash_new_(rv, Bry_xcf, Id_xcf); id_hash_new_(rv, Bry_wav, Id_wav);
return rv;
}
private static void id_hash_new_(Hash_adp hash, byte[] key, int val) {hash.Add(key, Int_obj_val.new_(val));}
private static void id_hash_new_(Hash_adp hash, byte[] key, int val) {hash.Add(key, new Int_obj_val(val));}
private static final Hash_adp_bry ext_hash = Hash_adp_bry.ci_a7()
private static final Hash_adp_bry ext_hash = Hash_adp_bry.ci_a7()
.Add_bry_bry(Bry_png).Add_bry_bry(Bry_jpg).Add_bry_bry(Bry_jpeg)
.Add_bry_bry(Bry_gif).Add_bry_bry(Bry_tif).Add_bry_bry(Bry_tiff)
.Add_bry_bry(Bry_svg).Add_bry_bry(Bry_djvu).Add_bry_bry(Bry_pdf)
@@ -69,7 +69,7 @@ public class Xof_ext_ {
.Add_bry_bry(Bry_ogv).Add_bry_bry(Bry_webm).Add_bry_bry(Bry_flac)
.Add_bry_bry(Bry_bmp).Add_bry_bry(Bry_xcf).Add_bry_bry(Bry_wav)
;
private static final Xof_ext[] Ary = new Xof_ext[Id__max];
private static final Xof_ext[] Ary = new Xof_ext[Id__max];
public static byte[] Get_ext_by_id_(int id) {
if (id < 0 || id >= Id__max) throw Err_.new_wo_type("index out of bounds", "id", id);

View File

@@ -23,11 +23,11 @@ public class Xof_mime_minor_ {
int id = id_obj == null ? Xof_ext_.Id_unknown : id_obj.Val();
return Xof_ext_.new_by_id_(id);
}
private static final byte[]
private static final byte[]
Mime_svg = Bry_.new_a7("svg+xml"), Mime_djvu = Bry_.new_a7("vnd.djvu"), Mime_midi = Bry_.new_a7("midi")
, Mime_xcf = Bry_.new_a7("x-xcf"), Mime_flac = Bry_.new_a7("x-flac")
, Mime_bmp = Bry_.new_a7("x-bmp"), Mime_bmp_2 = Bry_.new_a7("x-ms-bmp");
private static final Hash_adp mime_hash = mime_hash_();
private static final Hash_adp mime_hash = mime_hash_();
private static Hash_adp mime_hash_() {
Hash_adp rv = Hash_adp_bry.cs();
mime_hash_itm_(rv, Xof_ext_.Bry_png , Xof_ext_.Id_png);
@@ -51,5 +51,5 @@ public class Xof_mime_minor_ {
mime_hash_itm_(rv, Xof_ext_.Bry_wav , Xof_ext_.Id_wav);
return rv;
}
private static void mime_hash_itm_(Hash_adp hash, byte[] key, int val) {hash.Add(key, Int_obj_val.new_(val));}
private static void mime_hash_itm_(Hash_adp hash, byte[] key, int val) {hash.Add(key, new Int_obj_val(val));}
}

View File

@@ -25,14 +25,14 @@ public class Xofc_fil_itm implements CompareAble {
}
public String Key;
public int Uid() {return uid;} public void Uid_(int v) {uid = v;} private int uid;
public int Dir_id() {return dir_id;} private final int dir_id;
public byte[] Name() {return name;} private final byte[] name;
public boolean Is_orig() {return is_orig;} private final boolean is_orig;
public int W() {return w;} private final int w;
public int H() {return h;} private final int h;
public double Time() {return time;} private final double time;
public int Page() {return page;} private final int page;
public Xof_ext Ext() {return ext;} private final Xof_ext ext;
public int Dir_id() {return dir_id;} private final int dir_id;
public byte[] Name() {return name;} private final byte[] name;
public boolean Is_orig() {return is_orig;} private final boolean is_orig;
public int W() {return w;} private final int w;
public int H() {return h;} private final int h;
public double Time() {return time;} private final double time;
public int Page() {return page;} private final int page;
public Xof_ext Ext() {return ext;} private final Xof_ext ext;
public long Size() {return size;} private long size;
public void Size_(long v) {
this.size = v;
@@ -40,7 +40,7 @@ public class Xofc_fil_itm implements CompareAble {
}
public long Cache_time() {return cache_time;} private long cache_time;
public Xofc_fil_itm Cache_time_now_() {
this.cache_time = DateAdp_.Now().XtoUtc().Timestamp_unix();
this.cache_time = Datetime_now.Get().XtoUtc().Timestamp_unix();
cmd_mode = Db_cmd_mode.To_update(cmd_mode);
return this;
}
@@ -69,5 +69,5 @@ public class Xofc_fil_itm implements CompareAble {
return bfr.To_bry_and_clear();
}
public int compareTo(Object obj) {Xofc_fil_itm comp = (Xofc_fil_itm)obj; return -Long_.Compare(cache_time, comp.cache_time);} // - for DESC sort
public static final Xofc_fil_itm Null = null;
public static final Xofc_fil_itm Null = null;
}

View File

@@ -35,41 +35,41 @@ public class Xou_cache_itm {
this.lnki_key = Key_gen(lnki_key_bfr, lnki_wiki_abrv, lnki_ttl, lnki_type, lnki_upright, lnki_w, lnki_h, lnki_time, lnki_page, user_thumb_w);
}
public byte Db_state() {return db_state;} public void Db_state_(byte v) {db_state = v;} private byte db_state;
public byte[] Lnki_wiki_abrv() {return lnki_wiki_abrv;} private final byte[] lnki_wiki_abrv; // differentiate commonwiki rows inserted by one wiki vs another
public byte[] Lnki_key() {return lnki_key;} private final byte[] lnki_key; // unique key by lnki props
public byte[] Lnki_ttl() {return lnki_ttl;} private final byte[] lnki_ttl;
public int Lnki_type() {return lnki_type;} private final int lnki_type;
public double Lnki_upright() {return lnki_upright;} private final double lnki_upright;
public int Lnki_w() {return lnki_w;} private final int lnki_w;
public int Lnki_h() {return lnki_h;} private final int lnki_h;
public double Lnki_time() {return lnki_time;} private final double lnki_time;
public int Lnki_page() {return lnki_page;} private final int lnki_page;
public int User_thumb_w() {return user_thumb_w;} private final int user_thumb_w;
public int Orig_repo_id() {return orig_repo_id;} private final int orig_repo_id;
public byte[] Orig_ttl() {return orig_ttl;} private final byte[] orig_ttl;
public byte[] Lnki_wiki_abrv() {return lnki_wiki_abrv;} private final byte[] lnki_wiki_abrv; // differentiate commonwiki rows inserted by one wiki vs another
public byte[] Lnki_key() {return lnki_key;} private final byte[] lnki_key; // unique key by lnki props
public byte[] Lnki_ttl() {return lnki_ttl;} private final byte[] lnki_ttl;
public int Lnki_type() {return lnki_type;} private final int lnki_type;
public double Lnki_upright() {return lnki_upright;} private final double lnki_upright;
public int Lnki_w() {return lnki_w;} private final int lnki_w;
public int Lnki_h() {return lnki_h;} private final int lnki_h;
public double Lnki_time() {return lnki_time;} private final double lnki_time;
public int Lnki_page() {return lnki_page;} private final int lnki_page;
public int User_thumb_w() {return user_thumb_w;} private final int user_thumb_w;
public int Orig_repo_id() {return orig_repo_id;} private final int orig_repo_id;
public byte[] Orig_ttl() {return orig_ttl;} private final byte[] orig_ttl;
public byte[] Orig_ttl_md5() {if (orig_ttl_md5 == null) orig_ttl_md5 = Xof_file_wkr_.Md5_fast(orig_ttl); return orig_ttl_md5;} private byte[] orig_ttl_md5;
public int Orig_ext_id() {return orig_ext_id;} private final int orig_ext_id;
public int Orig_ext_id() {return orig_ext_id;} private final int orig_ext_id;
public Xof_ext Orig_ext_itm() {if (orig_ext_itm == null) orig_ext_itm = Xof_ext_.new_by_id_(orig_ext_id); return orig_ext_itm;} private Xof_ext orig_ext_itm;
public int Orig_w() {return orig_w;} private final int orig_w;
public int Orig_h() {return orig_h;} private final int orig_h;
public int Html_w() {return html_w;} private final int html_w;
public int Html_h() {return html_h;} private final int html_h;
public double Html_time() {return html_time;} private final double html_time;
public int Html_page() {return html_page;} private final int html_page;
public boolean File_is_orig() {return file_is_orig;} private final boolean file_is_orig;
public int Orig_w() {return orig_w;} private final int orig_w;
public int Orig_h() {return orig_h;} private final int orig_h;
public int Html_w() {return html_w;} private final int html_w;
public int Html_h() {return html_h;} private final int html_h;
public double Html_time() {return html_time;} private final double html_time;
public int Html_page() {return html_page;} private final int html_page;
public boolean File_is_orig() {return file_is_orig;} private final boolean file_is_orig;
public int File_w() {return file_w;} private int file_w;
public double File_time() {return file_time;} private final double file_time;
public int File_page() {return file_page;} private final int file_page;
public long File_size() {return file_size;} private final long file_size;
public double File_time() {return file_time;} private final double file_time;
public int File_page() {return file_page;} private final int file_page;
public long File_size() {return file_size;} private final long file_size;
public Io_url File_url() {return file_url;} public void File_url_(Io_url v) {file_url = v;} private Io_url file_url;
public int View_count() {return view_count;} private int view_count;
public long View_date() {return view_date;} private long view_date;
public void Update_view_stats() {
++view_count;
view_date = DateAdp_.Now().Timestamp_unix();
view_date = Datetime_now.Get().Timestamp_unix();
db_state = Db_cmd_mode.To_update(db_state);
}
public static final Xou_cache_itm Null = null;
public static final Xou_cache_itm Null = null;
public static byte[] Key_gen(Bry_bfr key_bfr, byte[] lnki_wiki_abrv, byte[] ttl, int type, double upright, int w, int h, double time, int page, int user_thumb_w) {
key_bfr.Add(lnki_wiki_abrv).Add_byte_pipe()
.Add(ttl).Add_byte_pipe().Add_int_variable(type).Add_byte_pipe().Add_double(upright).Add_byte_pipe()
@@ -85,5 +85,5 @@ class Xof_cache_mgr_sorter implements gplx.core.lists.ComparerAble {
Xou_cache_itm rhs = (Xou_cache_itm)rhsObj;
return -Long_.Compare(lhs.View_date(), rhs.View_date()); // - for DESC sort
}
public static final Xof_cache_mgr_sorter Instance = new Xof_cache_mgr_sorter(); Xof_cache_mgr_sorter() {}
public static final Xof_cache_mgr_sorter Instance = new Xof_cache_mgr_sorter(); Xof_cache_mgr_sorter() {}
}

View File

@@ -72,7 +72,7 @@ public class Xou_cache_mgr {
, fsdb.Orig_repo_id(), fsdb.Orig_ttl(), fsdb.Orig_ext().Id(), fsdb.Orig_w(), fsdb.Orig_h()
, fsdb.Html_w(), fsdb.Html_h(), fsdb.Lnki_time(), fsdb.Lnki_page()
, fsdb.File_is_orig(), fsdb.File_w(), fsdb.Lnki_time(), fsdb.Lnki_page(), fsdb.File_size()
, 1, DateAdp_.Now().Timestamp_unix())
, 1, Datetime_now.Get().Timestamp_unix())
;
hash.Add(itm.Lnki_key(), itm);
fsys_size_cur += itm.File_size();

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.files.caches; import gplx.*; import gplx.xowa.*; import gplx.xowa.files.*;
import org.junit.*; import gplx.dbs.*; import gplx.xowa.files.fsdb.*; import gplx.xowa.files.repos.*;
public class Xou_cache_mgr_tst {
@Before public void init() {fxt.Clear();} private final Xou_cache_mgr_fxt fxt = new Xou_cache_mgr_fxt();
@Before public void init() {fxt.Clear();} private final Xou_cache_mgr_fxt fxt = new Xou_cache_mgr_fxt();
@Test public void Update() {
Xof_fsdb_itm itm_1 = fxt.Make_itm("en.w", "1.png", 2);
fxt.Exec_update(itm_1);
@@ -60,7 +60,7 @@ public class Xou_cache_mgr_tst {
class Xou_cache_mgr_fxt {
private Xou_cache_mgr mgr;
public void Clear() {
Tfds.Now_set(DateAdp_.new_(1970, 1, 1, 0, 0, 0, 0));
Datetime_now.Manual_(DateAdp_.new_(1970, 1, 1, 0, 0, 0, 0));
Io_mgr.Instance.InitEngine_mem();
Db_conn_bldr.Instance.Reg_default_mem();
Xoae_app app = Xoa_app_fxt.Make__app__edit();

View File

@@ -21,6 +21,7 @@ import gplx.xowa.wikis.domains.*;
import gplx.xowa.parsers.utils.*;
import gplx.xowa.wikis.tdbs.metas.*;
public class Xowe_repo_mgr implements Xow_repo_mgr, Gfo_invk {
private Xofw_file_finder_rslt tmp_rslt = new Xofw_file_finder_rslt();
private Xowe_wiki wiki; private final List_adp repos = List_adp_.New();
public Xowe_repo_mgr(Xowe_wiki wiki) {
this.wiki = wiki;
@@ -183,7 +184,7 @@ public class Xowe_repo_mgr implements Xow_repo_mgr, Gfo_invk {
meta_itm.Vrtl_repo_(Xof_meta_itm.Repo_unknown);
}
return new_tid;
} private Xofw_file_finder_rslt tmp_rslt = new Xofw_file_finder_rslt();
}
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
if (ctx.Match(k, Invk_add)) return Add_repo(m.ReadBry("src"), m.ReadBry("trg"));
else if (ctx.Match(k, Invk_clear)) {repos.Clear(); repos_ary = null;} // reset repos_ary variable