diff --git a/plex_animes_export.py b/plex_animes_export.py index 5e63b8e..d485962 100644 --- a/plex_animes_export.py +++ b/plex_animes_export.py @@ -1,8 +1,8 @@ from plexapi.server import PlexServer from dotenv import load_dotenv from os import environ, path +from os.path import normpath, basename import re -import pathlib # Find .env file basedir = path.abspath(path.dirname(__file__)) @@ -23,8 +23,7 @@ if ( tvdbid ) : tvdb = str(tvdbid.group(1)) location = str(video.locations)[2:-2] - path = pathlib.PurePath(location) - folder = str(path.name) + folder = str(basename(normpath(location))) seasons = str(video.seasons()) seasonslist = re.findall("\-(\d*)\>", seasons) cleanseasonslist = ',' .join(seasonslist) diff --git a/plex_movies_export.py b/plex_movies_export.py index f4cdc5d..e4450eb 100644 --- a/plex_movies_export.py +++ b/plex_movies_export.py @@ -1,8 +1,8 @@ from plexapi.server import PlexServer from dotenv import load_dotenv from os import environ, path +from os.path import normpath, basename import re -import pathlib # Find .env file basedir = path.abspath(path.dirname(__file__)) @@ -23,8 +23,7 @@ if ( imdbid ) : imdb = str(imdbid.group(1)) location = str(video.locations)[2:-2] - path = pathlib.PurePath(location) - folder = str(path.parent.name) + folder = str(basename(normpath(location))) export=(imdb + "\t" + title + "\t" + folder + "\n") export_plex.write(export) else :