X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=pctb%2Fconvert.c;h=8386c1609a0f68f85a0936a0df953b26c120f2c2;hb=ca2598d063219f019ba8e04a4762552f556795ca;hp=61901a5924854c967d9fc981a63406d6af89f66d;hpb=c2c039f07de178037bfbf12e4ee23c06f546de32;p=ypp-sc-tools.db-live.git diff --git a/pctb/convert.c b/pctb/convert.c index 61901a5..8386c16 100644 --- a/pctb/convert.c +++ b/pctb/convert.c @@ -66,7 +66,9 @@ FILE *screenshot_file; const char *o_ocean, *o_pirate; int o_quiet; -enum flags o_flags= ff_dict_fetch|ff_dict_submit|ff_dict_pirate; +enum flags o_flags= + ff_charset_allowedit | + ff_dict_fetch|ff_dict_submit|ff_dict_pirate; static void vbadusage(const char *fmt, va_list) FMT(1,0) NORET; static void vbadusage(const char *fmt, va_list al) { @@ -92,7 +94,7 @@ static void run_analysis(void) { analyse(tf); if (o_flags & ff_upload) { - if (o_flags & ff_singlepage) + if (npages<=1) fatal("Recognition successful, but refusing to upload partial data\n" " (--single-page specified). Specify an output mode?"); } @@ -123,9 +125,11 @@ void fetch_with_rsync(const char *stem) { const char *src= getenv("YPPSC_PCTB_DICT_UPDATE"); char *remote= masprintf("%s/master-%s.txt", src, stem); - char *local= masprintf("#master-%s#.txt", stem); + char *local= masprintf("_master-%s.txt", stem); + if (DEBUGP(rsync)) + fprintf(stderr,"executing rsync to fetch %s to %s\n",remote,local); execlp(rsync, "rsync", - DEBUGP(rsync) ? "-vLt" : "-Lt", + DEBUGP(rsync) ? "-zvLt" : "-zLt", "--",remote,local,(char*)0); sysassert(!"exec rsync failed"); } @@ -193,7 +197,8 @@ int main(int argc, char **argv) { else if (IS("--find-island")) o_flags |= ffs_printisland; else if (IS("--single-page")) o_flags |= ff_singlepage; else if (IS("--quiet")) o_quiet= 1; - else if (IS("--edit-charset")) o_flags |= ff_editcharset; + else if (IS("--edit-charset")) o_flags |= ff_charset_edit; + else if (IS("--no-edit-charset")) o_flags &= ~(ffm_charset); else if (IS("--test-servers")) o_flags |= ff_testservers; else if (IS("--dict-local-only")) o_flags &= ~ffs_dict; else if (IS("--dict-read-only")) o_flags &= (~ffs_dict | ff_dict_fetch); @@ -262,10 +267,12 @@ int main(int argc, char **argv) { o_serv_dict_submit, o_flags & ff_dict_submit); if (!o_screenshot_fn) - o_screenshot_fn= masprintf("%s/#pages#.ppm",get_vardir()); + o_screenshot_fn= masprintf("%s/_pages.ppm",get_vardir()); /* Actually do the work */ + canon_colour_prepare(); + if (o_mode & mf_findwindow) { screenshot_startup(); find_yppclient_window(); @@ -292,16 +299,19 @@ int main(int argc, char **argv) { open_screenshot_file("w"); if (o_flags & ff_singlepage) take_one_screenshot(); else take_screenshots(); - progress_log("OK for you to move the mouse now."); + progress_log("OK for you to move the mouse now, and you can" + " use the YPP client again."); } if (o_mode & mf_readscreenshot) { + if ((o_flags & ff_upload) && !(o_flags & ff_testservers)) + badusage("must not reuse screenshots for upload to live PCTB database"); open_screenshot_file("r"); if (o_flags & ff_singlepage) read_one_screenshot(); else read_screenshots(); } if (o_mode & mf_analyse) { if (o_flags & ff_needisland) { - find_islandname(page0_rgbimage); + find_islandname(); if (o_flags & ff_printisland) printf("%s, %s\n", archipelago, island); sysassert(! setenv("YPPSC_ISLAND",island,1) );