fix: [gitignore]

This commit is contained in:
Terrtia 2021-02-10 15:27:31 +01:00
parent d941d8abb4
commit 056b6006f6
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 38 additions and 0 deletions

3
.gitignore vendored
View file

@ -19,6 +19,9 @@ DATA_ARDB
indexdir/
logs/
old/
pgpdump/
temp/
DEFAULT_PASSWORD

View file

@ -166,3 +166,38 @@ def add_map_obj_id_item_id(obj_id, item_id, obj_type):
# delete twitter id
##-- --##
## COMMON ##
def _get_dir_source_name(directory, source_name=None, l_sources_name=set()):
if source_name:
l_dir = os.listdir(os.path.join(directory, source_name))
else:
l_dir = os.listdir(directory)
# empty directory
if not l_dir:
return l_sources_name.add(source_name)
return l_sources_name
else:
for src_name in l_dir:
if len(src_name) == 4:
try:
int(src_name)
l_sources_name.add(os.path.join(source_name))
return l_sources_name
except:
pass
if source_name:
src_name = os.path.join(source_name, src_name)
l_sources_name = _get_dir_source_name(directory, source_name=src_name, l_sources_name=l_sources_name)
return l_sources_name
def get_all_items_sources():
res = _get_dir_source_name(PASTES_FOLDER)
print(res)
##-- --##
if __name__ == '__main__':
get_all_items_sources()