Billy Barrow 2 лет назад
Родитель
Сommit
5740457aeb
1 измененных файлов с 14 добавлено и 2 удалено
  1. 14 2
      src/lib/Metadata.vala

+ 14 - 2
src/lib/Metadata.vala

@@ -11,6 +11,7 @@ namespace Ppub {
         public const string TAGS = "tags";
         public const string COPYRIGHT = "copyright";
         public const string LICENCE = "licence";
+        public const string POSTER = "poster";
 
         private Gee.HashMap<string, string> entries {get; set;}
 
@@ -112,6 +113,15 @@ namespace Ppub {
                 set_value(LICENCE, value);
             }
         }
+
+        public string? poster {
+            owned get {
+                return get_value(POSTER);
+            }
+            set {
+                set_value(POSTER, value);
+            }
+        }
         
         public Metadata.from_stream(InputStream stream) throws IOError {
 
@@ -130,7 +140,9 @@ namespace Ppub {
         public string to_string() {
             var str = "";
             foreach (var item in entries) {
-                str += @"$(item.key): $(item.value)\n";
+                if(item.value != null || item.value.chug().chomp() != "") {
+                    str += @"$(item.key): $(item.value)\n";
+                }
             }
             return str;
         }
@@ -138,4 +150,4 @@ namespace Ppub {
 
     }
 
-}
+}