Description:
Improve workflow for adding images.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r442:040b11ced988 -

1 NO CONTENT: new file 100755, binary diff hidden
NO CONTENT: new file 100755, binary diff hidden
@@ -0,0 +1,42
1 #r "YamlDotNet.dll"
2 using YamlDotNet.Serialization;
3
4 public enum OrganizationType
5 {
6 Unspecified,
7 Family,
8 LargeCorporation,
9 Cooperative
10 }
11
12 public struct ImageMetadata
13 {
14 public string Description;
15 public string Subject;
16 public string Source;
17 public string URL;
18 public string Filename;
19 public OrganizationType[] OrganizationType;
20 public int Subjects;
21 }
22
23 public struct NewsItem
24 {
25 public string hed;
26 public string contents;
27 public string source;
28 public Dictionary<string, string> variables;
29 }
30
31 public List<ImageMetadata> LoadImageMeta()
32 {
33
34 var sr = new StreamReader(@"isometric-park-fna/Content/portraits.yaml");
35
36 var input = new StringReader(sr.ReadToEnd());
37 var deserializer = new DeserializerBuilder()
38 .Build();
39
40 return deserializer.Deserialize<List<ImageMetadata>>(input);
41
42 }
@@ -0,0 +1,16
1
2 #load "Shared.csx"
3
4
5 var image_meta = LoadImageMeta();
6
7 var images = new HashSet<String>(Directory.GetFiles("isometric-park-fna/Content/Portraits/"));
8
9 var image_meta_names = image_meta.Select((item) => "isometric-park-fna/Content/Portraits/" + item.Filename);
10 var missing_images = images.Except(image_meta_names);
11
12 foreach (String name in missing_images)
13 {
14 Console.WriteLine(String.Format("- Description: TODO\n Subject: TODO\n Source: TODO\n Filename: {0}\n Subjects: TODO\n", name));
15 }
16
1 NO CONTENT: new file 100755, binary diff hidden
NO CONTENT: new file 100755, binary diff hidden
@@ -0,0 +1,22
1 #!/bin/bash
2
3 NEWDIR=`mktemp --directory`
4
5 hg convert . $NEWDIR --filemap gitfiles.map
6
7 cd $NEWDIR
8
9 BRANCHES=`hg branches`
10
11 for BRANCH in ${BRANCHES[@]}; do
12 if [[ ! "$BRANCH" =~ ^([0-9]+:)|(inactive)|(closed) ]]; then
13 echo $BRANCH;
14 `hg bookmark -r "${BRANCH}" "${BRANCH}_bookmark"`
15 fi
16 done
17
18 hg push https://gitlab.com/actuallyalys/isometric-park-fna.git
19
20
21 echo "run 'rm -r $NEWDIR' to clear directory."
22
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -2,35 +2,35
2 Subject: Person
2 Subject: Person
3 Source: Bain Collection, Via Library of Congress
3 Source: Bain Collection, Via Library of Congress
4 URL: https://www.example.com
4 URL: https://www.example.com
5 Filename: 51105041943_e5527c802e_o.jpg.converted4grey_medium_reorder.jpg
5 Filename: 51105041943_e5527c802e_o.jpg
6 Subjects: 1
6 Subjects: 1
7 - Description: This is a person
7 - Description: This is a person
8 Subject: Person
8 Subject: Person
9 Source: Bain Collection, Via Library of Congress
9 Source: Bain Collection, Via Library of Congress
10 Filename: 51346251445_ae7044d163_o.jpg.converted4grey_medium_reorder.jpg
10 Filename: 51346251445_ae7044d163_o.jpg
11 Subjects: 1
11 Subjects: 1
12 - Description: This is a person
12 - Description: This is a person
13 Subject: Person
13 Subject: Person
14 Source: Bain Collection, Via Library of Congress
14 Source: Bain Collection, Via Library of Congress
15 Filename: 51104913627_bf626a8a53_o.jpg.converted4grey_medium_reorder.png
15 Filename: 51104913627_bf626a8a53_o.jpg
16 Subjects: 1
16 Subjects: 1
17 - Description: Sun Fo
17 - Description: Sun Fo
18 Subject: Person
18 Subject: Person
19 Source: Bain Collection, Via Library of Congress
19 Source: Bain Collection, Via Library of Congress
20 Filename: 9684139377_9f74e12129_o.jpg.converted4grey_medium_reorder.png
20 Filename: 9684139377_9f74e12129_o.jpg
21 Subjects: 1
21 Subjects: 1
22 - Description: M-4 tank crews of the United States, Ft. Knox, Ky.
22 - Description: M-4 tank crews of the United States, Ft. Knox, Ky.
23 Subject: Person
23 Subject: Person
24 Source: Bain Collection, Via Library of Congress
24 Source: Bain Collection, Via Library of Congress
25 Filename: service-pnp-fsac-1a35000-1a35200-1a35210v.jpg.converted4grey_medium_reorder.png
25 Filename: service-pnp-fsac-1a35000-1a35200-1a35210v.jpg
26 Subjects: 4
26 Subjects: 4
27 - Description: Yuvaraja of Mysore
27 - Description: Yuvaraja of Mysore
28 Subject: Person
28 Subject: Person
29 Source: Bain Collection, Via Library of Congress
29 Source: Bain Collection, Via Library of Congress
30 Filename: service-pnp-ggbain-20000-20016r.jpg.converted4grey_medium_reorder.png
30 Filename: service-pnp-ggbain-20000-20016r.jpg
31 Subjects: 1
31 Subjects: 1
32 - Description: Mrs. Marie L. Baldwin
32 - Description: Mrs. Marie L. Baldwin
33 Subject: Person
33 Subject: Person
34 Source: Bain Collection, Via Library of Congress
34 Source: Bain Collection, Via Library of Congress
35 Filename: 5926007035_9d728b1837_o.jpg.converted4grey_medium_reorder.png
35 Filename: 5926007035_9d728b1837_o.jpg
36 Subjects: 1
36 Subjects: 1
@@ -1,16 +1,12
1 #r "YamlDotNet.dll"
1 #r "YamlDotNet.dll"
2 #load "Shared.csx"
2
3
3
4
4 using YamlDotNet.Serialization;
5 using YamlDotNet.Serialization;
6 using System.Linq;
7 using System.Collections.Generic;
5
8
6
9
7 public struct NewsItem
8 {
9 public string hed;
10 public string contents;
11 public string source;
12 public Dictionary<string, string> variables;
13 }
14
10
15 Console.WriteLine("Hello World");
11 Console.WriteLine("Hello World");
16 var sr = new StreamReader(@"isometric-park-fna/Content/news_items.yaml");
12 var sr = new StreamReader(@"isometric-park-fna/Content/news_items.yaml");
@@ -32,3 +28,26
32
28
33
29
34 Console.WriteLine("news_items_pregenerated.yaml loaded.");
30 Console.WriteLine("news_items_pregenerated.yaml loaded.");
31
32
33 var image_meta = LoadImageMeta();
34
35 var images = new HashSet<String>(Directory.GetFiles("isometric-park-fna/Content/Portraits/"));
36
37 if (images.Count() != image_meta.Count()) {
38 Console.WriteLine(String.Format("Image metadata ({0}) doesn't match images ({1})", image_meta.Count(), images.Count()));
39
40 Console.WriteLine("Missing Images:");
41 var image_meta_names = image_meta.Select((item) => "isometric-park-fna/Content/Portraits/" + item.Filename);
42 var missing_images = images.Except(image_meta_names);
43
44 foreach (String name in missing_images)
45 {
46 Console.WriteLine(name);
47 }
48 System.Environment.Exit(1);
49 }
50
51
52
53 Console.WriteLine(String.Format("Items ({0}) portraits.yaml loaded.", image_meta.Count()));
You need to be logged in to leave comments. Login now