@@ -56,12 +56,10 @@ def __init__(self, lib, overwrite):
5656 else :
5757 self .overwrite = False
5858
59- self .scripts_dir = os .getenv ('HOME' ) + '/.games_nebula/scripts/' + self .lib
60-
61- mylib_has_new_scripts = self .get_scripts ()
59+ lib_has_new_scripts = self .get_scripts ()
6260
6361 # Ugly but works
64- if not mylib_has_new_scripts :
62+ if not lib_has_new_scripts :
6563 sys .exit (0 )
6664 else :
6765 sys .exit (2 )
@@ -83,8 +81,8 @@ def get_scripts(self):
8381 archive_file .write (archive_data )
8482 archive_file .close ()
8583
86- mylib_has_new_scripts = self .unpack (archive_path )
87- return mylib_has_new_scripts
84+ lib_has_new_scripts = self .unpack (archive_path )
85+ return lib_has_new_scripts
8886
8987 except urllib_urlerror as e :
9088
@@ -120,39 +118,46 @@ def get_scripts(self):
120118
121119 def unpack (self , archive_path ):
122120
123- os . system ( '7z x -aoa -o' + tmp + ' ' + archive_path )
124- os . system ( 'rm ' + tmp + '/games_nebula_ ' + self .lib + '_scripts-master/LICENSE > /dev/null 2>&1' )
121+ scripts_dir_0 = data_dir + '/scripts/ ' + self . lib
122+ scripts_dir_1 = nebula_dir + '/scripts/ ' + self .lib
125123
126- if not os .path .exists (self . scripts_dir ):
127- os .makedirs (self . scripts_dir )
124+ if not os .path .exists (scripts_dir_0 ):
125+ os .makedirs (scripts_dir_0 )
128126
129127 if self .lib == 'mylib' :
130128 new_scripts_dir = tmp + '/games_nebula_' + self .lib + '_scripts-master/free/'
131129 else :
132130 new_scripts_dir = tmp + '/games_nebula_' + self .lib + '_scripts-master/'
133131
132+ os .system ('7z x -aoa -o' + tmp + ' ' + archive_path )
133+ os .system ('rm ' + new_scripts_dir + 'LICENSE > /dev/null 2>&1' )
134+
134135 git_sctipts = os .listdir (new_scripts_dir )
135- existing_scripts = os .listdir (self .scripts_dir )
136+ existing_scripts_0 = os .listdir (scripts_dir_0 )
137+ existing_scripts_1 = os .listdir (scripts_dir_1 )
138+ existing_scripts = existing_scripts_0 + existing_scripts_1
136139
137140 new_scripts = []
138141 for script in git_sctipts :
139142 if script not in existing_scripts :
140143 new_scripts .append (script )
141- os .system ('mv ' + new_scripts_dir + script + ' ' + self . scripts_dir )
144+ os .system ('mv ' + new_scripts_dir + script + ' ' + scripts_dir_0 )
142145
143146 if self .overwrite == True :
144- os .system ('cp -r ' + new_scripts_dir + '* ' + self . scripts_dir )
147+ os .system ('cp -r ' + new_scripts_dir + '* ' + scripts_dir_0 )
145148
146- os .system ('rm -r ' + tmp + '/games_nebula_' + self . lib + '_scripts-master' )
147- os .system ('rm ' + tmp + '/' + self . lib + '_scripts.zip > /dev/null 2>&1' )
149+ os .system ('rm -r ' + new_scripts_dir )
150+ os .system ('rm ' + archive_path + ' > /dev/null 2>&1' )
148151
149152 new_scripts = sorted (new_scripts )
150153 n_new_scripts = len (new_scripts )
151154
152155 if self .lib == 'goglib' :
153156
154- goglib_names = goglib_get_data .games_info (data_dir )[1 ]
155- goglib_titles = goglib_get_data .games_info (data_dir )[2 ]
157+ goglib_data = goglib_get_data .games_info (data_dir )
158+
159+ goglib_names = goglib_data [1 ]
160+ goglib_titles = goglib_data [2 ]
156161
157162 name_to_title = {}
158163
@@ -166,8 +171,10 @@ def unpack(self, archive_path):
166171
167172 elif self .lib == 'mylib' :
168173
169- mylib_names = mylib_get_data .games_info (data_dir )[1 ]
170- mylib_titles = mylib_get_data .games_info (data_dir )[2 ]
174+ mylib_data = mylib_get_data .games_info (data_dir )
175+
176+ mylib_names = mylib_data [1 ]
177+ mylib_titles = mylib_data [2 ]
171178
172179 name_to_title = {}
173180
@@ -176,7 +183,7 @@ def unpack(self, archive_path):
176183
177184 for game_name in new_scripts :
178185 image_url = images_url + game_name + '.jpg'
179- banners_dir = os . getenv ( 'HOME' ) + '/.games_nebula /images/mylib/'
186+ banners_dir = data_dir + '/images/mylib/'
180187 get_banner .get_banner (game_name , image_url , banners_dir , self .lib )
181188
182189 message_dialog = Gtk .MessageDialog (
0 commit comments