diff options
Diffstat (limited to 'checkrenyi.py')
-rwxr-xr-x | checkrenyi.py | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/checkrenyi.py b/checkrenyi.py deleted file mode 100755 index 162cfcb..0000000 --- a/checkrenyi.py +++ /dev/null @@ -1,50 +0,0 @@ -#! /usr/bin/env python -# -*- coding: utf-8 -*- - -import sys -from path import path -from xmlio import Xmlio -NEWLINE = '\n' - -#open file for output -outfile = open('errorrpt','w') -errorcount = 0 -#for each directory in Renyi -try: - d = path('/home/olpc/Activities/ImageQuizPlus.activity/flashcards/library/russian/renyi') - i = path('/home/olpc/Activities/ImageQuizPlus.activity/flashcards/library/russian/renyi/image') - s = path('/home/olpc/Activities/ImageQuizPlus.activity/flashcards/library/russian/renyi/sound') -except: - print 'invalid path' -print d -print i -print s -for cat in d.dirs(): - outfile.write(cat + NEWLINE) - for f in cat.files('*.xml'): - #write directory name - deck = Xmlio(f) - cards = deck.getroot() - outfile.write(f + ' ' + str(len(cards)) + NEWLINE) - #if img not in image: - for card in cards: - question_node = card.find('question') - if question_node: - sound = question_node.findtext('sound') - answer_node = card.find('answer') - if answer_node: - temp = answer_node.findtext('image') - if temp: - image = temp[:-4] + '.png' - if image and not path(i/image).isfile(): - outfile.write(image + ' not found' + NEWLINE) - errorcount += 1 - if sound: - sounds = sound.split('/') - for item in sounds: - temp = item[:-4] + '.ogg' - if not path(s/temp).isfile(): - outfile.write(temp + ' not found' + NEWLINE) - errorcount += 1 -outfile.write(str(errorcount) + ' errors') -print (errorcount, ' errors') |