@@ -25,7 +25,7 @@ def download_url(url, output_path):
2525
2626
2727# NOTE: this file is currently not working for this installer!
28- extension_url = "https://raw.githubusercontent.com/michael-mueller-git/Python-Funscript-Editor/main/contrib/OpenFunscripter/extensions/Funscript%20Generator%20Windows/main.lua"
28+ lua_extension_url = "https://raw.githubusercontent.com/michael-mueller-git/Python-Funscript-Editor/main/contrib/OpenFunscripter/extensions/Funscript%20Generator%20Windows/main.lua"
2929
3030if platform .system () != "Windows" :
3131 print ("ERROR: This installer only work on Windows" )
@@ -34,17 +34,22 @@ def download_url(url, output_path):
3434ofs_extension_dir = os .path .expandvars (r'%APPDATA%\OFS_data\extensions' )
3535
3636if not os .path .exists (ofs_extension_dir ):
37- print ("ERROR: OFS is not installed. Please download and install OFS. Befor running this installer open OFS once on your Computer " )
37+ print ("ERROR: OFS is not installed. Please download and install OFS. Befor running this installer open OFS once! " )
3838 print ("Cancel installation" )
3939 sys .exit ()
4040
4141release_url = "https://github.com/michael-mueller-git/Python-Funscript-Editor/releases"
4242html_text = requests .get (release_url ).text
43- download_urls = { version .parse (re .search (r'v[^/]*' , x ).group ().lower ().replace ("v" , "" )) : "https://github.com" + x \
44- for x in [link .get ('href' ) for link in BeautifulSoup (html_text , 'html.parser' ).find_all ('a' ) \
45- if link .get ('href' ).endswith (".zip" ) and "/releases/" in link .get ('href' )]
46- }
47- latest = max (download_urls )
43+ try :
44+ download_urls = { version .parse (re .search (r'v[^/]*' , x ).group ().lower ().replace ("v" , "" )) : "https://github.com" + x \
45+ for x in [link .get ('href' ) for link in BeautifulSoup (html_text , 'html.parser' ).find_all ('a' ) \
46+ if link .get ('href' ).endswith (".zip" ) and "/releases/" in link .get ('href' )]
47+ }
48+ latest = max (download_urls )
49+ except :
50+ print ("ERROR: download url not found" )
51+ sys .exit ()
52+
4853extension_dir = os .path .join (ofs_extension_dir , "Funscript Generator Windows" )
4954zip_file = os .path .join (extension_dir , "funscript-editor-v" + str (latest ) + ".zip" )
5055dest_dir = os .path .join (os .path .dirname (zip_file ), "funscript-editor" )
@@ -63,4 +68,4 @@ def download_url(url, output_path):
6368 zf .extract (member , dest_dir )
6469
6570with open (os .path .join (extension_dir , "main.lua" ), "wb" ) as f :
66- f .write (requests .get (extension_url ).content )
71+ f .write (requests .get (lua_extension_url ).content )
0 commit comments