Forráskód Böngészése

fixed minor icon fetch bug due to incorrect path

control 3 éve
szülő
commit
1aae9ddbe1
4 módosított fájl, 12 hozzáadás és 4 törlés
  1. BIN
      app/database.db
  2. 9 1
      app/iconfetch.py
  3. 3 3
      app/logic.py
  4. BIN
      app/static/sitecons/google.com.ico

BIN
app/database.db


+ 9 - 1
app/iconfetch.py

@@ -8,6 +8,7 @@ import subprocess as sp
 import re, os
 
 def check_icon(sitename):
+    print('checking icon')##
     # checks for site icon in storage
     str1 = sitename.replace('/', '')
     sitename = f'{str1.replace(":", ".")}.ico'
@@ -17,11 +18,14 @@ def check_icon(sitename):
     result = [os.path.join(root, sitename) for root, dirs, files in os.walk(path) if sitename in files] 
 
     if result:
+        print('returning True')##
         return f'{sitename}'
     else:
+        print('returning False')##
         return False
 
 def fetch_icon(sitename):
+    print('fetching icon')##
     path = 'static/sitecons/'
 
     # search end of string for leading slash
@@ -37,6 +41,10 @@ def fetch_icon(sitename):
     str1 = sitename.replace('/', '')
     sitename = str1.replace(':', '.')
 
-    sp.run(f'wget {parsed_name} -O static/sitecons/{sitename}.ico', shell=True)
+    print(parsed_name)##
+    print(f'wget {parsed_name} -O {path}{sitename}.ico')
+    p1 = sp.run(f'wget {parsed_name} -O app/{path}{sitename}.ico', shell=True, capture_output=True, text=True)
+    print(p1.stdout)##
+    print('checking icon')##
 
     return f'{sitename}.ico'

+ 3 - 3
app/logic.py

@@ -9,7 +9,7 @@ from . import db
 import string, secrets
 import csv
 import subprocess as sp
-from .iconfetch import *
+from . import iconfetch as icof
 
 logic = Blueprint('logic', __name__)
 
@@ -131,9 +131,9 @@ def create():
         if wlink and wname and wstatus:
 
             # fetch/check icon
-            sitecon = check_icon(wlink)
+            sitecon = icof.check_icon(wlink)
             if not sitecon:
-                sitecon = fetch_icon(wlink)
+                sitecon = icof.fetch_icon(wlink)
 
             # add bookmark to database
             if wgroup == 'cng-555' and ngroup != '':

BIN
app/static/sitecons/google.com.ico