diff --git a/Whatsapp_Chat_Exporter/__main__.py b/Whatsapp_Chat_Exporter/__main__.py index 216f4ca..e71e004 100644 --- a/Whatsapp_Chat_Exporter/__main__.py +++ b/Whatsapp_Chat_Exporter/__main__.py @@ -5,7 +5,7 @@ except ImportError: from Whatsapp_Chat_Exporter import extract, extract_iphone from Whatsapp_Chat_Exporter import extract_iphone_media from Whatsapp_Chat_Exporter.data_model import ChatStore -from Whatsapp_Chat_Exporter.utility import Crypt +from Whatsapp_Chat_Exporter.utility import Crypt, check_update from argparse import ArgumentParser import os import sqlite3 @@ -136,8 +136,20 @@ def main(): action='store_true', help="Do not output html files" ) + parser.add_argument( + "--check-update", + dest="check_update", + default=False, + action='store_true', + help="Check for updates" + ) args = parser.parse_args() + # Check for updates + if args.check_update: + exit(check_update()) + + # Sanity checks if args.android and args.iphone: print("You must define only one device type.") exit(1) diff --git a/Whatsapp_Chat_Exporter/utility.py b/Whatsapp_Chat_Exporter/utility.py index 6adcfde..960b8c4 100644 --- a/Whatsapp_Chat_Exporter/utility.py +++ b/Whatsapp_Chat_Exporter/utility.py @@ -38,6 +38,36 @@ def brute_force_offset(max_iv=200, max_db=200): for db in range(0, max_db): yield iv, iv + 16, db +def check_update(): + import urllib.request + import json + from sys import platform + from .__init__ import __version__ + + package_url_json = "https://pypi.org/pypi/whatsapp-chat-exporter/json" + try: + raw = urllib.request.urlopen(package_url_json) + except Exception: + print("Failed to check for updates.") + return 1 + else: + with raw: + package_info = json.load(raw) + latest_version = tuple(map(int, package_info["info"]["version"].split("."))) + current_version = tuple(map(int, __version__.split("."))) + if current_version < latest_version: + print("===============Update===============") + print("A newer version of WhatsApp Chat Exporter is available.") + print("Current version: " + __version__) + print("Latest version: " + package_info["info"]["version"]) + if platform == "win32": + print("Update with: pip install --upgrade whatsapp-chat-exporter") + else: + print("Update with: pip3 install --upgrade whatsapp-chat-exporter") + print("====================================") + else: + print("You are using the latest version of WhatsApp Chat Exporter.") + return 0 # iOS Specific diff --git a/setup.py b/setup.py index 89e49ac..48bbb8d 100644 --- a/setup.py +++ b/setup.py @@ -11,11 +11,19 @@ setuptools.setup( name="whatsapp-chat-exporter", version=version, author="KnugiHK", - author_email="info@knugi.com", + author_email="hello@knugi.com", description="A Whatsapp database parser that will give you the " "history of your Whatsapp conversations in HTML and JSON.", long_description=long_description, long_description_content_type="text/markdown", + license="MIT", + keywords=[ + "android", "ios", "parsing", "history","iphone", "whatsapp" + "customizable", "android-backup", "crypt12", "whatsapp-chat-exporter", + "whatsapp-export", "whatsapp-database", "whatsapp-database-parser", + "whatsapp-conversations", "iphone-backup", "crypt14", "crypt15" + ], + platforms=["any"], url="https://github.com/KnugiHK/Whatsapp-Chat-Exporter", packages=setuptools.find_packages(), package_data={