Fix issue with using pathlib

This commit is contained in:
Matthew Welch 2021-07-10 13:46:20 -07:00
parent 0d9615f52c
commit 6c544fd31d
2 changed files with 5 additions and 5 deletions

View File

@ -254,7 +254,7 @@ def get_tv_shows():
tv_url = "https://api.themoviedb.org/3/tv/"
current_app.logger.info("start loading tv shows")
for dir in sorted(TV_SHOWS_DIRECTORY.iterdir()):
dir_match = re.match(dir_pattern, str(dir))
dir_match = re.match(dir_pattern, dir.name)
if dir_match:
path = TV_SHOWS_DIRECTORY / dir
if not database.tv_show_path_in_db(str(path)):

View File

@ -64,7 +64,7 @@ MOBILE_DEVICES = ["android", "blackberry", "ipad", "iphone"]
def get_comics():
with app.app_context():
i = inotify.adapters.InotifyTree(func.COMICS_DIRECTORY)
i = inotify.adapters.InotifyTree(str(func.COMICS_DIRECTORY))
new_dirs = []
func.get_comics()
while True:
@ -85,7 +85,7 @@ def get_comics():
def get_movies():
with app.app_context():
i = inotify.adapters.InotifyTree(func.MOVIES_DIRECTORY)
i = inotify.adapters.InotifyTree(str(func.MOVIES_DIRECTORY))
func.get_movies()
@ -98,7 +98,7 @@ def get_movies():
def get_tv_shows():
with app.app_context():
i = inotify.adapters.InotifyTree(func.TV_SHOWS_DIRECTORY)
i = inotify.adapters.InotifyTree(str(func.TV_SHOWS_DIRECTORY))
func.get_tv_shows()
func.get_tv_episodes()
for event in i.event_gen(yield_nones=False):
@ -115,7 +115,7 @@ def get_games():
with app.app_context():
i = inotify.adapters.Inotify()
i.add_watch(func.GAMES_DIRECTORY)
for directory in os.listdir(func.GAMES_DIRECTORY):
for directory in os.listdir(str(func.GAMES_DIRECTORY)):
path = pathlib.Path(func.GAMES_DIRECTORY, directory)
if path.is_dir():
i.add_watch(str(path))