(* Group pictures by dates *) maintainDates := ( (* Organize collection subsets by dates *) maintainSubsets; (* Save subcollections as files into html/system/collections *) maintainSubcollections; (* Print places and create a template file for edited-places to show on the web page *) maintainPlaces; (* Photomontage of pictures for each collection *) thsize = 128; columns0 = 6; Do[{date, set} = csubset; mset = Length[set]; If[mset > 1, columns = Min[columns0, mset]; sdate = ToString /@ date; date2 = dateS[date, "-"]; dirmont = ToFileName[{dir0, "date-pic"}]; checkdir1[dirmont]; filemont = ToFileName[dirmont, date2 <> ".jpg"]; maintainMontage], {csubset, csubsets}]; (* Creating geo files *.kml *) maintainDatesKML; (* Pictures grouped by dates *) maintainIndexc; (* Web page for a given date *) maintainDate; ); (* Organize collection subsets by dates *) maintainSubsets := ( cdates = shootingdata["datetime", #[[2]], #[[3]]] & /@ rmushpictures; (* Overwrite wrong dates by a date specified in the caption *) cdates1 = DateList[datedata[#[[2]], #[[3]]]] & /@ rmushpictures; Do[ cdate = cdates[[nr]]; cdate1 = cdates1[[nr]]; cdatea = Take[cdate, 3]; cdatea1 = Take[cdate1, 3]; If[cdatea =!= cdatea1, Print["Picture ", rmushpictures[[nr]], ": Changing date: ", cdatea, " -> ", cdatea1]; cdates[[nr, 1]] = cdatea1[[1]]; cdates[[nr, 2]] = cdatea1[[2]]; cdates[[nr, 3]] = cdatea1[[3]]; ], {nr, Length[rmushpictures]}]; data = Transpose[{rmushpictures, cdates}]; data = Gather[data, (#1[[2, {1, 2, 3}]] === #2[[2, {1, 2, 3}]]) &]; csubsets = {#[[1, 2, {1, 2, 3}]], Transpose[#][[1]]} & /@ data; csubsetsp = Table[ {date, set} = csubset; date = DateString[date, {"MonthName", " ", "Day", ", ", "Year"}]; set = (#[[2]] <> "-" <> #[[3]]) & /@ set; set = ToString[set]; {date, set}, {csubset, csubsets}]; msubsets = Length[csubsets]; subdates = First /@ csubsetsp; Print["Collection is organized into ", msubsets, " subsets corresponding to following dates: ", Short[subdates]]; noPrint[csubsetsp // TableForm]; ); (* Save subcollections as files into html/system/collections *) maintainSubcollections := ( dirsc = ToFileName[{dir00, "system", "collections"}]; Do[ {date, set} = csubset; filesc = ToFileName[dirsc, "rusmush_" <> dateS[date, "_"] <> ".dat"]; text = Table[StringJoin[Riffle[pic, " "]], {pic, set}]; Export[filesc, text, "Lines"], {csubset, csubsets}]; Print["Subcollections data were saved into directory ", dirsc, ". Upload it to a web directory!"]; ); (* Print places and create a template file for edited-places to show on the web page *) maintainPlaces := ( fileplaces = ToFileName[dirwork, "places.txt"]; ClearAll[placeprint]; (* Reading file *) If[FileType[fileplaces] === File, Print["Reading places from the file ", fileplaces]; data = Import[fileplaces, "Lines"]; Do[ dat1 = StringSplit[dat, ":"]; date = dat1[[1]]; place = dat1[[2]]; date = ToExpression/@StringSplit[date]; place = StringTrim[place]; placeprint[date] = place, {dat, data}]; ]; table = Table[ {date, set} = csubset; plnames = placename @@ #[[{2, 3}]] & /@ set; plnames = Select[plnames, Head[#] === String &]; plnames = Union[plnames]; plnames = StringJoin[Riffle[plnames, " / "]]; datep = dateS[date, " "]; link = "http://127.0.0.1:81/pictures/k/c-rusmush_" <> dateS[date, "_"] <> ".htm"; placeshort = placeprint[date]; If[Head[placeshort] =!= String, placeshort = ""]; {Hyperlink[datep, link], placeshort, plnames}, {csubset, csubsets}]; table = Select[table, (#[[2]] === "")&]; If[table =!= {}, Print["Warning: there are some dates without places!"]; Print[table // TableForm]; ]; If[FileType[fileplaces] =!= File, Print["Attention: File with names of the places " fileplaces, " is not present! A draft file will be created. It should be edited!"]; text = Table[ {datep, plnames} = tab; datep = datep[[1]]; plnames = StringSplit[plnames, " / "]; plnames = If[plnames === {}, "XXXXX", plnames[[1]]]; datep <> ": " <> plnames, {tab, table}]; Export[fileplaces, text, "Text"]; ]; );