diff --git a/CB/Core.py b/CB/Core.py index 0f613a6..567bd3f 100644 --- a/CB/Core.py +++ b/CB/Core.py @@ -98,6 +98,8 @@ def parse_url(self, url): raise NotImplementedError('Provided URL is not supported.') def add_addon(self, url): + if 'twitch://' in url: + url = url.split('/download-client')[0].replace('twitch://', 'https://').strip() addon = self.check_if_installed(url) if not addon: new = self.parse_url(url) @@ -238,4 +240,9 @@ def search(self, query): def create_reg(self): with open('CurseBreaker.reg', 'w') as outfile: outfile.write('Windows Registry Editor Version 5.00\n\n[HKEY_CLASSES_ROOT\.ccip\Shell\Open\Command]\n@="\\"' - + os.path.abspath(sys.executable).replace('\\', '\\\\') + '\\\" \\"%1\\""') + + os.path.abspath(sys.executable).replace('\\', '\\\\') + '\\\" \\"%1\\""\n[HKEY_CURRENT_USER' + '\Software\Classes\\twitch]\n"URL Protocol"="\\"\\""\n@="\\"URL:CurseBreaker Protocol\\""\n[H' + 'KEY_CURRENT_USER\Software\Classes\\twitch\DefaultIcon]\n@="\\"CurseBreaker.exe,1\\""\n[HKEY_' + 'CURRENT_USER\Software\Classes\\twitch\shell]\n[HKEY_CURRENT_USER\Software\Classes\\twitch\sh' + 'ell\open]\n[HKEY_CURRENT_USER\Software\Classes\\twitch\shell\open\command]\n@="\\"' + + os.path.abspath(sys.executable).replace('\\', '\\\\') + '\\" \\"%1\\""') diff --git a/CB/__init__.py b/CB/__init__.py index aef18a8..a11da36 100644 --- a/CB/__init__.py +++ b/CB/__init__.py @@ -1,4 +1,4 @@ -__version__ = '1.6.0' +__version__ = '1.6.1' __license__ = 'GPLv3' __copyright__ = '2019, Paweł Jastrzębski ' __docformat__ = 'restructuredtext en' diff --git a/CurseBreaker.py b/CurseBreaker.py index 3e06e76..70f84e4 100644 --- a/CurseBreaker.py +++ b/CurseBreaker.py @@ -53,6 +53,13 @@ def start(self): self.setup_completer() self.setup_table() # Curse URI Support + if len(sys.argv) == 2 and 'twitch://' in sys.argv[1]: + try: + self.c_install(sys.argv[1].strip()) + except Exception as e: + self.handle_exception(e) + os.system('timeout /t 5') + sys.exit(0) if len(sys.argv) == 2 and '.ccip' in sys.argv[1]: try: path = sys.argv[1].strip()