Merge pull request #1400 from auouymous/log-unwritable-sync-messages

Write to log when sync directory is not writable.
This commit is contained in:
Eric Le Lay 2022-09-24 19:19:43 +02:00 committed by GitHub
commit 1ecdbed0df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -458,16 +458,20 @@ class MP3PlayerDevice(Device):
self.destination.get_uri(), err.message)
return False
if info.get_file_type() != Gio.FileType.DIRECTORY:
logger.error('destination %s is not a directory', self.destination.get_uri())
return False
# open is ok if the target is a directory, and it can be written to
# for smb, query_info doesn't return FILE_ATTRIBUTE_ACCESS_CAN_WRITE,
# -- if that's the case, just assume that it's writable
if (info.get_file_type() == Gio.FileType.DIRECTORY and (
not info.has_attribute(Gio.FILE_ATTRIBUTE_ACCESS_CAN_WRITE) or
info.get_attribute_boolean(Gio.FILE_ATTRIBUTE_ACCESS_CAN_WRITE))):
if (not info.has_attribute(Gio.FILE_ATTRIBUTE_ACCESS_CAN_WRITE) or
info.get_attribute_boolean(Gio.FILE_ATTRIBUTE_ACCESS_CAN_WRITE)):
self.notify('status', _('MP3 player opened'))
self.tracks_list = self.get_all_tracks()
return True
logger.error('destination %s is not writable', self.destination.get_uri())
return False
def get_episode_folder_on_device(self, episode):