diff --git a/README.md b/README.md
index e9fe9a0..642fab5 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ i.e.
- python main.py scribus input.csv palette
- will generate a cmyk .xml for use with scribus
- python main.py krita input.csv palette
- - produces a krita resource bundle that is currently not working
+ - produces a krita resource bundle
Where "input_csv" would be your input csv as in swatchos.csv
@@ -52,6 +52,9 @@ Place the outputted xml file in /usr/share/scribus/swatches (you will need to su
### Krita
-While I am working on the resource bundle for Krita, you can place the .gpl generated by using the gpl format into $HOME/.local/share/krita/palettes.
+You can either place the .gpl generated by using the gpl format into $HOME/.local/share/krita/palettes.
+or
-**The current resource bundle for Krita does not load the palette correctly**
\ No newline at end of file
+Use the Krita bundle and add via settings, manage resource libraries and then import from there
+
+**TODO, add a preview picture for the bundle, this is likely o be something generic, possibly a logo?**
\ No newline at end of file
diff --git a/main.py b/main.py
index 6f59c18..228765c 100644
--- a/main.py
+++ b/main.py
@@ -23,6 +23,7 @@ import os
import shutil
import zipfile
import hashlib
+from datetime import datetime
def cmyk_to_hex(cp, mp, yp, kp):
c = int(cp * 2.55)
@@ -81,25 +82,47 @@ def main(file_format, input, output):
if file_format == "krita":
- palette_hash = hashlib.md5(output_file_format).hexdigest()
+ hasher = hashlib.md5()
+
+ with open(output_file_format, "rb") as f:
+ for chunk in iter(lambda: f.read(4096), b""):
+ hasher.update(chunk)
+
+ palette_hash = hasher.hexdigest()
with open("mimetype", "w") as mt:
mt.write(f"application/x-krita-resourcebundle")
- with open("meta.xml", "w") as meta:
- meta.write(f'\n')
- meta.write(f'\n')
- meta.write(f"1\n")
- meta.write(f"CSV to Palette Generator\n")
- meta.write(f"Bundle Generated with CSV to Palette Generator\n")
- meta.write(f"\n')
- mani.write(f'\n')
- mani.write(f'\n')
- mani.write(f'\n')
- mani.write(f'')
- shutil.move("manifest.xml", "META-INF")
+
+ with open("meta.xml", "w") as meta:
+ meta.write(f'\n')
+ meta.write(f'\n')
+ meta.write(f'Krita (6.0.1)\n')
+ meta.write(f"1\n")
+ meta.write(f"CSV to Palette Generator\n")
+ meta.write(f'{output}\n')
+ meta.write(f"{output} Bundle Generated with CSV to Palette Generator\n")
+ meta.write(f'{output} Generated with CSV to Palette Generator\n')
+ meta.write(f'{output} Generated with CSV to Palette Generator\n')
+ meta.write(f'{datetime.now().strftime("%d/%m/%Y")}\n')
+ meta.write(f'{datetime.now().strftime("%d/%m/%Y")}\n')
+ meta.write(f'\n')
+ meta.write(f'CC-BY-SA\n')
+ meta.write(f'\n')
+ meta.write(f'\n')
+ meta.write(f'\n')
+ meta.write(f'\n')
+ meta.write(f'')
+
+ os.mkdir("META-INF")
+
+ with open("manifest.xml", "w") as mani:
+ mani.write(f'\n')
+ mani.write(f'\n')
+ mani.write(f'\n')
+ mani.write(f'\n')
+ mani.write(f'')
+
+ shutil.move("manifest.xml", "META-INF")
shutil.move(output_file_format, "palettes")
zipname = f"{output}.bundle"
with zipfile.ZipFile(zipname, "w") as zippy: