[geany/geany-themes] 2a8731: Add "screen_hash" field and rename "md5hash" to "scheme_hash"

Matthew Brush git-noreply at xxxxx
Sat Nov 23 10:06:48 UTC 2013


Branch:      refs/heads/master
Author:      Matthew Brush <mbrush at codebrainz.ca>
Committer:   Matthew Brush <mbrush at codebrainz.ca>
Date:        Wed, 19 Jun 2013 07:26:44 UTC
Commit:      2a873134eb6f0ab6b1b6a2abfc1d8c5345305648
             https://github.com/geany/geany-themes/commit/2a873134eb6f0ab6b1b6a2abfc1d8c5345305648

Log Message:
-----------
Add "screen_hash" field and rename "md5hash" to "scheme_hash"

These are the fields containing an MD5 sum of the screenshot and
color scheme files in the index.


Modified Paths:
--------------
    index/README.md
    index/index.json
    index/index.json.md5
    scripts/mkindex.py

Modified: index/README.md
10 files changed, 9 insertions(+), 1 deletions(-)
===================================================================
@@ -34,13 +34,21 @@ This field will never be empty.
 A short description of the theme or an empty string. The string is meant
 to be displayed to human beings.
 
-#### md5hash
+#### scheme_hash
 
 An MD5 hash of the colour scheme `.conf` file from the last time it was
 changed. This value can be used to check if a local scheme needs updating
 and/or to verify the integrity of the file that could be downloaded using
 the `colorscheme` URL field. This field will never be empty.
 
+#### screen_hash
+
+An MD5 hash of the colour scheme preview/screenshot image the last time
+it was changed. This value can be used to check if a cached screenshot
+needs to be updated locally and/or to verify the integrity of a the
+downloaded screenshot. This field may be empty if a screenshot does
+not exist.
+
 #### name
 
 A human-readable name of the colour scheme meant to be display for example


Modified: index/index.json
69 files changed, 46 insertions(+), 23 deletions(-)
===================================================================
No diff available, check online


Modified: index/index.json.md5
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -1 +1 @@
-280deb164da000700d8a004ec2ccddb7  index.json
+1872d82f783e0f7f74e366da400a60d5  index.json


Modified: scripts/mkindex.py
9 files changed, 8 insertions(+), 1 deletions(-)
===================================================================
@@ -76,6 +76,12 @@ def create_index(themes_dir, screenshot_dir='screenshots'):
             version = int(get_option(cp, 'theme_info', 'version', '0'))
         except:
             version = '0'
+        
+        png_file = os.path.join(screenshot_dir, scheme_name + '.png')
+        if os.path.isfile(png_file):
+          png_hash = hashlib.md5(open(png_file).read()).hexdigest()
+        else:
+          png_hash = ''
 
         data[scheme_name] = {
             'name': get_option(cp, 'theme_info', 'name', 'Untitled'),
@@ -84,8 +90,9 @@ def create_index(themes_dir, screenshot_dir='screenshots'):
             'author': get_option(cp, 'theme_info', 'author', 'Unknown Author'),
             'screenshot': '%s%s.png' % (SCREENSHOT_BASE, scheme_name),
             'colorscheme': '%s%s.conf' % (SCHEMES_BASE, scheme_name),
-            'md5hash': hashlib.md5(open(conf_file).read()).hexdigest(),
             'thumbnail': generate_thumbnail(conf_file, screenshot_dir),
+            'screen_hash': png_hash,
+            'scheme_hash': hashlib.md5(open(conf_file).read()).hexdigest(),
         }
 
     # json.dumps() leaves trailing whitespace on some lines, strip it off



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list