Skip to content

Commit cc55a35

Browse files
committed
Better logging for custom notification icon retrieval and improve file path output
1 parent cd3ed1d commit cc55a35

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

android_notify/sword.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -610,17 +610,23 @@ def callback(bitmap_):
610610
self.__builder.setSmallIcon(icon)
611611
else:
612612
if self.logs:
613-
print('Failed getting img for custom notification icon defaulting to app icon')
613+
app_folder=os.path.join(app_storage_path(),'app')
614+
img_absolute_path = os.path.join(app_folder, img_path)
615+
print(f'Failed getting img for custom notification icon defaulting to app icon\n absolute path {img_absolute_path}')
614616
self.__builder.setSmallIcon(context.getApplicationInfo().icon)
615617

616618
@staticmethod
617619
def __get_img_from_path(relative_path):
618620
app_folder=os.path.join(app_storage_path(),'app')
619621
output_path = os.path.join(app_folder, relative_path)
620622
if not os.path.exists(output_path):
621-
print(f"\nImage not found at path: {output_path}, (Local images gotten from App Path)")
622-
print("These are the existing files in your app Folder:")
623-
print('['+', '.join(os.listdir(app_folder)) + ']')
623+
print(f"\nImage not found at path: {app_folder}, (Local images gotten from App Path)")
624+
try:
625+
print("- These are the existing files in your app Folder:")
626+
print('['+', '.join(os.listdir(app_folder)) + ']')
627+
except Exception as e:
628+
print('Exception: ',e)
629+
print("Couldn't get Files in App Folder")
624630
return None
625631
# TODO test with a badly written Image and catch error
626632
Uri = autoclass('android.net.Uri')

0 commit comments

Comments
 (0)