Ignore subfolders other than thumbnails in system

This commit is contained in:
Kovid Goyal 2025-01-24 10:50:24 +05:30
parent b293089ba3
commit f1d2910e73
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -100,19 +100,19 @@ class MTP_DEVICE(BASE):
storage_id = str(getattr(storage_or_storage_id, 'object_id', storage_id = str(getattr(storage_or_storage_id, 'object_id',
storage_or_storage_id)) storage_or_storage_id))
lpath = tuple(icu_lower(name) for name in path) lpath = tuple(icu_lower(name) for name in path)
if self.is_kindle and lpath and lpath[-1].endswith('.sdr'):
return True
if ignored_folders is None: if ignored_folders is None:
ignored_folders = self.get_pref('ignored_folders') ignored_folders = self.get_pref('ignored_folders')
if storage_id in ignored_folders: if storage_id in ignored_folders:
# Use the users ignored folders settings # Use the users ignored folders settings
return '/'.join(lpath) in {icu_lower(x) for x in ignored_folders[storage_id]} return '/'.join(lpath) in {icu_lower(x) for x in ignored_folders[storage_id]}
if self.is_kindle and lpath and lpath[-1].endswith('.sdr'):
return True
# Implement the default ignore policy # Implement the default ignore policy
# Top level ignores # Top level ignores
if lpath[0] in { if lpath[0] in {
'alarms', 'dcim', 'movies', 'music', 'notifications', 'alarms', 'dcim', 'movies', 'music', 'notifications', 'screenshots',
'pictures', 'ringtones', 'samsung', 'sony', 'htc', 'bluetooth', 'fonts', 'pictures', 'ringtones', 'samsung', 'sony', 'htc', 'bluetooth', 'fonts',
'games', 'lost.dir', 'video', 'whatsapp', 'image', 'com.zinio.mobile.android.reader'}: 'games', 'lost.dir', 'video', 'whatsapp', 'image', 'com.zinio.mobile.android.reader'}:
return True return True
@ -120,16 +120,19 @@ class MTP_DEVICE(BASE):
# apparently the Tolino for some reason uses a hidden folder for its library, sigh. # apparently the Tolino for some reason uses a hidden folder for its library, sigh.
return True return True
if lpath[0] == 'system' and not self.is_kindle: if lpath[0] == 'system' and not self.is_kindle:
# on Kindles we need the system folder for the amazon cover bug workaround # on Kindles we need the system/thumbnails folder for the amazon cover bug workaround
return True return True
if len(lpath) > 1 and lpath[0] == 'android': if len(lpath) > 1:
# Ignore everything in Android apart from a few select folders if lpath[0] == 'android':
if lpath[1] != 'data': # Ignore everything in Android apart from a few select folders
return True if lpath[1] != 'data':
if len(lpath) > 2 and lpath[2] != 'com.amazon.kindle': return True
return True if len(lpath) > 2 and lpath[2] != 'com.amazon.kindle':
return True
elif lpath[0] == 'system':
if lpath[1] != 'thumbnails':
return True
return False return False
def configure_for_kindle_app(self): def configure_for_kindle_app(self):