|
|
|
@ -25,20 +25,19 @@
@@ -25,20 +25,19 @@
|
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE. |
|
|
|
|
|
|
|
|
|
import sys, codecs |
|
|
|
|
from io import open |
|
|
|
|
|
|
|
|
|
# Force UTF-8 printing |
|
|
|
|
sys.stdout = codecs.getwriter('utf-8')(sys.stdout) |
|
|
|
|
|
|
|
|
|
def prettyPrinter(dictionary): |
|
|
|
|
# Convert everything to unicode for safe printing |
|
|
|
|
for key,value in dictionary.items(): |
|
|
|
|
if isinstance(dictionary[key], str): |
|
|
|
|
dictionary[key] = unicode(dictionary[key], 'utf-8') |
|
|
|
|
dictionary['size'] = anySizeToBytes(dictionary['size']) |
|
|
|
|
if dictionary.has_key('desc_link'): |
|
|
|
|
print u"%s|%s|%s|%s|%s|%s|%s"%(dictionary['link'],dictionary['name'].replace('|',' '),dictionary['size'],dictionary['seeds'],dictionary['leech'],dictionary['engine_url'],dictionary['desc_link']) |
|
|
|
|
else: |
|
|
|
|
print u"%s|%s|%s|%s|%s|%s"%(dictionary['link'],dictionary['name'].replace('|',' '),dictionary['size'],dictionary['seeds'],dictionary['leech'],dictionary['engine_url']) |
|
|
|
|
outtext = "|".join((dictionary["link"], dictionary["name"].replace("|", " "), str(dictionary["size"]), str(dictionary["seeds"]), str(dictionary["leech"]), dictionary["engine_url"])) |
|
|
|
|
if 'desc_link' in dictionary: |
|
|
|
|
outtext = "|".join((outtext, dictionary["desc_link"])) |
|
|
|
|
|
|
|
|
|
with open(1, 'w', encoding='utf-8', closefd=False) as utf8_stdout: |
|
|
|
|
utf8_stdout.write("".join((outtext, "\n"))) |
|
|
|
|
|
|
|
|
|
def anySizeToBytes(size_string): |
|
|
|
|
""" |
|
|
|
|