Release 0.0.6

This commit is contained in:
Nichlas Severinsen 2021-06-05 22:03:31 +02:00
parent 5e9bd4f257
commit f3e8132a37
8 changed files with 300 additions and 35 deletions

View file

@ -22,6 +22,7 @@
import os
import sys
import stat
import zlib
import shutil
import requests
from bs4 import BeautifulSoup
@ -89,13 +90,22 @@ def read_seven_bit_encoded_int(fileobj, order):
def error(msg):
"""Print fatal error message and terminate"""
print('ERROR: %s' % msg)
print('[ERROR] %s' % msg)
sys.exit(1)
def warning(msg):
"""Print a warning message"""
print('WARNING: %s. Continuing regardless.' % msg)
def warning(msg, args):
"""Print a warning message. Warning messages can be silenced with --quiet"""
if not args.quiet:
print('[WARNING] %s. Continuing regardless.' % msg)
def vprint(msg, args):
"""Vprint, verbose print, can be silenced with --quiet"""
if not args.quiet:
print('[*] ' + msg)
def download_ird(ird_name):
@ -136,6 +146,22 @@ def ird_by_game_id(game_id):
return(ird_name)
def crc32(filename):
"""Calculate crc32 for file"""
with open(filename, 'rb') as infile:
crc32 = 0
while True:
data = infile.read(65536)
if not data:
break
crc32 = zlib.crc32(data, crc32)
return "%08X" % (crc32 & 0xFFFFFFFF)
# Main functions