@@ -183,15 +183,11 @@ def spider(args, paths: list):
183183 link = web .remove_apache_sorting_params (link_dict .pop ("link" ))
184184
185185 if link in traversed_paths or link in paths :
186- continue
187- if web .is_index (link ):
188- if web .is_subpath (path , link ):
189- paths .append (link )
190- continue
191-
192- if db_media .exists (args , link ):
186+ pass
187+ elif web .is_subpath (path , link ):
188+ paths .append (link )
189+ elif db_media .exists (args , link ):
193190 known_paths .add (link )
194- continue
195191 else :
196192 new_paths [link ] = objects .merge_dict_values_str (new_paths .get (link ) or {}, link_dict )
197193 else : # not HTML page
@@ -263,6 +259,9 @@ def web_add(args=None) -> None:
263259
264260 args = parse_args (consts .SC .web_add , usage = usage .web_add )
265261
262+ db_playlists .create (args )
263+ db_media .create (args )
264+
266265 if args .insert_only :
267266 media_new = set ()
268267 media_known = set ()
@@ -300,7 +299,7 @@ def web_update(args=None) -> None:
300299
301300 web_playlists = db_playlists .get_all (
302301 args ,
303- sql_filters = " extractor_key = 'WebFolder'" ,
302+ sql_filters = [ "AND extractor_key = 'WebFolder'"] ,
304303 order_by = """length(path)-length(REPLACE(path, '/', '')) desc
305304 , random()
306305 """ ,
@@ -320,9 +319,9 @@ def web_update(args=None) -> None:
320319 new_media = spider (args_env , [playlist ["path" ]])
321320
322321 if new_media > 0 :
323- db_playlists .decrease_update_delay (args , playlist ["path" ])
322+ db_playlists .update_more_frequently (args , playlist ["path" ])
324323 else :
325- db_playlists .increase_update_delay (args , playlist ["path" ])
324+ db_playlists .update_less_frequently (args , playlist ["path" ])
326325
327326 if playlist_count > 3 :
328327 time .sleep (random .uniform (0.05 , 2 ))
0 commit comments