Skip to content

Commit f1d2910

Browse files
committed
Ignore subfolders other than thumbnails in system
1 parent b293089 commit f1d2910

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/calibre/devices/mtp/driver.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,36 +100,39 @@ def is_folder_ignored(self, storage_or_storage_id, path,
100100
storage_id = str(getattr(storage_or_storage_id, 'object_id',
101101
storage_or_storage_id))
102102
lpath = tuple(icu_lower(name) for name in path)
103+
if self.is_kindle and lpath and lpath[-1].endswith('.sdr'):
104+
return True
103105
if ignored_folders is None:
104106
ignored_folders = self.get_pref('ignored_folders')
105107
if storage_id in ignored_folders:
106108
# Use the users ignored folders settings
107109
return '/'.join(lpath) in {icu_lower(x) for x in ignored_folders[storage_id]}
108-
if self.is_kindle and lpath and lpath[-1].endswith('.sdr'):
109-
return True
110110

111111
# Implement the default ignore policy
112112

113113
# Top level ignores
114114
if lpath[0] in {
115-
'alarms', 'dcim', 'movies', 'music', 'notifications',
115+
'alarms', 'dcim', 'movies', 'music', 'notifications', 'screenshots',
116116
'pictures', 'ringtones', 'samsung', 'sony', 'htc', 'bluetooth', 'fonts',
117117
'games', 'lost.dir', 'video', 'whatsapp', 'image', 'com.zinio.mobile.android.reader'}:
118118
return True
119119
if lpath[0].startswith('.') and lpath[0] != '.tolino':
120120
# apparently the Tolino for some reason uses a hidden folder for its library, sigh.
121121
return True
122122
if lpath[0] == 'system' and not self.is_kindle:
123-
# on Kindles we need the system folder for the amazon cover bug workaround
123+
# on Kindles we need the system/thumbnails folder for the amazon cover bug workaround
124124
return True
125125

126-
if len(lpath) > 1 and lpath[0] == 'android':
127-
# Ignore everything in Android apart from a few select folders
128-
if lpath[1] != 'data':
129-
return True
130-
if len(lpath) > 2 and lpath[2] != 'com.amazon.kindle':
131-
return True
132-
126+
if len(lpath) > 1:
127+
if lpath[0] == 'android':
128+
# Ignore everything in Android apart from a few select folders
129+
if lpath[1] != 'data':
130+
return True
131+
if len(lpath) > 2 and lpath[2] != 'com.amazon.kindle':
132+
return True
133+
elif lpath[0] == 'system':
134+
if lpath[1] != 'thumbnails':
135+
return True
133136
return False
134137

135138
def configure_for_kindle_app(self):

0 commit comments

Comments
 (0)