- Fixed unicode in mininova and btjunkie search engines

This commit is contained in:
Christophe Dumez
2009-03-26 16:49:44 +00:00
parent aaf79add0b
commit a2e9210665
8 changed files with 95 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
#VERSION: 1.11
#VERSION: 1.2
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -26,7 +26,9 @@
def prettyPrinter(dictionnary):
dictionnary['size'] = anySizeToBytes(dictionnary['size'])
print "%(link)s|%(name)s|%(size)s|%(seeds)s|%(leech)s|%(engine_url)s" % dictionnary
if isinstance(dictionnary['name'], unicode):
dictionnary['name'] = dictionnary['name'].encode('utf-8')
print dictionnary['link'],'|',dictionnary['name'],'|',dictionnary['size'],'|',dictionnary['seeds'],'|',dictionnary['leech'],'|',dictionnary['engine_url']
def anySizeToBytes(size_string):
"""
@@ -42,7 +44,7 @@ def anySizeToBytes(size_string):
size = size[:-len(unit)]
except:
return -1
if len(size) == 0:
if len(size) == 0:
return -1
size = float(size)
short_unit = unit.upper()[0]