diff --git a/ankisyncd/collection.py b/ankisyncd/collection.py index 19b8a8e..a6df739 100644 --- a/ankisyncd/collection.py +++ b/ankisyncd/collection.py @@ -16,6 +16,7 @@ class CollectionWrapper: def __init__(self, path, setup_new_collection=None): self.path = os.path.realpath(path) + self.username = os.path.basename(os.path.dirname(self.path)) self.setup_new_collection = setup_new_collection self.__col = None diff --git a/ankisyncd/thread.py b/ankisyncd/thread.py index 4ac9aaf..87fd77c 100644 --- a/ankisyncd/thread.py +++ b/ankisyncd/thread.py @@ -3,7 +3,7 @@ from ankisyncd.collection import CollectionWrapper, CollectionManager from threading import Thread from queue import Queue -import time, logging, os.path +import time, logging class ThreadingCollectionWrapper: """Provides the same interface as CollectionWrapper, but it creates a new Thread to @@ -12,8 +12,6 @@ class ThreadingCollectionWrapper: def __init__(self, path, setup_new_collection=None): self.path = path self.wrapper = CollectionWrapper(path, setup_new_collection) - # FIXME: this might not work for other collection wrappers, introduce self.wrapper.name? - self._name = os.path.basename(os.path.dirname(self.wrapper.path)) self.logger = logging.getLogger("ankisyncd." + str(self)) self._queue = Queue() @@ -24,7 +22,7 @@ class ThreadingCollectionWrapper: self.start() def __str__(self): - return "CollectionThread[{}]".format(self._name) # TODO: self.wrapper.name? + return "CollectionThread[{}]".format(self.wrapper.username) @property def running(self):