Skip to content

Commit

Permalink
Reimplement support for Twitch URI (close #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Aug 10, 2019
1 parent badda24 commit 57a23c0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion CB/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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\\""')
2 changes: 1 addition & 1 deletion CB/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '1.6.0'
__version__ = '1.6.1'
__license__ = 'GPLv3'
__copyright__ = '2019, Paweł Jastrzębski <[email protected]>'
__docformat__ = 'restructuredtext en'
Expand Down
7 changes: 7 additions & 0 deletions CurseBreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 57a23c0

Please sign in to comment.