mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Merge branch 'master' of https://github.com/GRiker/calibre
This commit is contained in:
commit
a337fedffb
@ -403,13 +403,13 @@ class libiMobileDevice():
|
|||||||
self._log_location()
|
self._log_location()
|
||||||
return self._lockdown_get_value(requested_items)
|
return self._lockdown_get_value(requested_items)
|
||||||
|
|
||||||
def listdir(self, path):
|
def listdir(self, path, get_stats=True):
|
||||||
'''
|
'''
|
||||||
Return a list containing the names of the entries in the iOS directory
|
Return a list containing the names of the entries in the iOS directory
|
||||||
given by path.
|
given by path.
|
||||||
'''
|
'''
|
||||||
self._log_location("'%s'" % path)
|
self._log_location("'%s'" % path)
|
||||||
return self._afc_read_directory(path)
|
return self._afc_read_directory(path, get_stats=get_stats)
|
||||||
|
|
||||||
def load_library(self):
|
def load_library(self):
|
||||||
if islinux:
|
if islinux:
|
||||||
@ -1053,7 +1053,7 @@ class libiMobileDevice():
|
|||||||
|
|
||||||
return error
|
return error
|
||||||
|
|
||||||
def _afc_read_directory(self, directory=''):
|
def _afc_read_directory(self, directory='', get_stats=True):
|
||||||
'''
|
'''
|
||||||
Gets a directory listing of the directory requested
|
Gets a directory listing of the directory requested
|
||||||
|
|
||||||
@ -1062,7 +1062,8 @@ class libiMobileDevice():
|
|||||||
dir: (const char *) The directory to list (a fully-qualified path)
|
dir: (const char *) The directory to list (a fully-qualified path)
|
||||||
list: (char ***) A char list of files in that directory, terminated by
|
list: (char ***) A char list of files in that directory, terminated by
|
||||||
an empty string. NULL if there was an error.
|
an empty string. NULL if there was an error.
|
||||||
|
get_stats: If True, return full file stats for each file in dir (slower)
|
||||||
|
If False, return filename only (faster)
|
||||||
Result:
|
Result:
|
||||||
error: AFC_E_SUCCESS on success or an AFC_E_* error value
|
error: AFC_E_SUCCESS on success or an AFC_E_* error value
|
||||||
file_stats:
|
file_stats:
|
||||||
@ -1094,7 +1095,10 @@ class libiMobileDevice():
|
|||||||
path = '/' + this_item
|
path = '/' + this_item
|
||||||
else:
|
else:
|
||||||
path = '/'.join([directory, this_item])
|
path = '/'.join([directory, this_item])
|
||||||
|
if get_stats:
|
||||||
file_stats[os.path.basename(path)] = self._afc_get_file_info(path)
|
file_stats[os.path.basename(path)] = self._afc_get_file_info(path)
|
||||||
|
else:
|
||||||
|
file_stats[os.path.basename(path)] = {}
|
||||||
self.current_dir = directory
|
self.current_dir = directory
|
||||||
return file_stats
|
return file_stats
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user