plexflow 0.0.106__py3-none-any.whl → 0.0.107__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plexflow/core/plex/library/folders/assets/plex_asset.py +22 -0
- plexflow/core/plex/library/folders/assets/plex_subtitle_asset.py +13 -0
- plexflow/core/plex/library/folders/assets/plex_video_asset.py +5 -0
- plexflow/core/plex/library/folders/plex_folder.py +15 -0
- plexflow/core/plex/library/folders/plex_movie_folder.py +32 -0
- {plexflow-0.0.106.dist-info → plexflow-0.0.107.dist-info}/METADATA +1 -1
- {plexflow-0.0.106.dist-info → plexflow-0.0.107.dist-info}/RECORD +9 -4
- {plexflow-0.0.106.dist-info → plexflow-0.0.107.dist-info}/WHEEL +0 -0
- {plexflow-0.0.106.dist-info → plexflow-0.0.107.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
import os
|
3
|
+
|
4
|
+
|
5
|
+
class PlexAsset:
|
6
|
+
def __init__(self, path: str, root: Path, title: str, year: int):
|
7
|
+
self.path = path
|
8
|
+
self.root = root
|
9
|
+
self.title = title
|
10
|
+
self.year = year
|
11
|
+
|
12
|
+
@property
|
13
|
+
def ext(self) -> str:
|
14
|
+
return os.path.splitext(self.path)[1]
|
15
|
+
|
16
|
+
@property
|
17
|
+
def source_path(self) -> Path:
|
18
|
+
return Path(self.path)
|
19
|
+
|
20
|
+
@property
|
21
|
+
def target_path(self) -> Path:
|
22
|
+
return self.root / Path(f"{self.title} ({self.year})" + self.ext)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
from plexflow.core.plex.library.folders.assets.plex_asset import PlexAsset
|
3
|
+
|
4
|
+
|
5
|
+
class PlexSubtitleAsset(PlexAsset):
|
6
|
+
def __init__(self, path: str, root: Path, title: str, year: int, lang: str, index: int = None):
|
7
|
+
super().__init__(path, root, title, year)
|
8
|
+
self.lang = lang
|
9
|
+
self.index = index
|
10
|
+
|
11
|
+
@property
|
12
|
+
def target_path(self) -> Path:
|
13
|
+
return self.root / Path(f"{self.title} ({self.year}){'.' + str(self.index) if self.index else ''}.{self.lang}" + self.ext)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
|
4
|
+
class PlexFolder:
|
5
|
+
def __init__(self, root: Path, title: str, year: int):
|
6
|
+
self.root = root
|
7
|
+
self.title = title
|
8
|
+
self.year = year
|
9
|
+
|
10
|
+
def path_from_root(self, suffix: Path) -> Path:
|
11
|
+
return self.root / Path(self.base_name) / suffix
|
12
|
+
|
13
|
+
@property
|
14
|
+
def base_name(self) -> str:
|
15
|
+
return f"{self.title} ({self.year})"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import shutil as sh
|
2
|
+
import logging
|
3
|
+
from typing import List
|
4
|
+
from plexflow.core.plex.library.folders.plex_folder import PlexFolder
|
5
|
+
from plexflow.core.plex.library.folders.assets.plex_asset import PlexAsset
|
6
|
+
from plexflow.core.plex.library.folders.assets.plex_video_asset import PlexVideoAsset
|
7
|
+
from plexflow.core.plex.library.folders.assets.plex_subtitle_asset import PlexSubtitleAsset
|
8
|
+
|
9
|
+
class PlexMovieFolder(PlexFolder):
|
10
|
+
def __init__(self, root, title, year):
|
11
|
+
super().__init__(root, title, year)
|
12
|
+
self.assets: List[PlexAsset] = []
|
13
|
+
self.subtitle_index = None
|
14
|
+
|
15
|
+
def add_video_path(self, path: str):
|
16
|
+
video_asset = PlexVideoAsset(path, root=self.path_from_root(""), title=self.title, year=self.year)
|
17
|
+
self.assets.append(video_asset)
|
18
|
+
|
19
|
+
def add_subtitle_path(self, path: str, lang: str):
|
20
|
+
subtitle_asset = PlexSubtitleAsset(path, root=self.path_from_root(""), title=self.title, year=self.year, lang=lang, index=self.subtitle_index)
|
21
|
+
self.assets.append(subtitle_asset)
|
22
|
+
self.subtitle_index = self.subtitle_index + 1 if self.subtitle_index else 1
|
23
|
+
|
24
|
+
def create(self):
|
25
|
+
for asset in self.assets:
|
26
|
+
source = asset.source_path
|
27
|
+
target = asset.target_path
|
28
|
+
|
29
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
30
|
+
|
31
|
+
logging.info(f"moving {source} to {target}")
|
32
|
+
sh.move(src=str(source), dst=str(target))
|
@@ -276,6 +276,11 @@ plexflow/core/plex/hooks/plexflow_database.py,sha256=ftdsrwT8AMogSqqfT_P1db5e69F
|
|
276
276
|
plexflow/core/plex/library/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
277
277
|
plexflow/core/plex/library/__pycache__/__init__.cpython-311.pyc,sha256=9m-aTcoSl9y-zVp2COTYRH3moEp_MXOGs8xnpfGyyP4,176
|
278
278
|
plexflow/core/plex/library/__pycache__/library.cpython-311.pyc,sha256=yL69reegO6xlOsd_QA2uLQU0Eo7By8gE4ldB_X-0IDc,4559
|
279
|
+
plexflow/core/plex/library/folders/assets/plex_asset.py,sha256=awY8vhg3KoU2uCB18y5MleE3aAUdVDTnN1OaTmm2oJc,530
|
280
|
+
plexflow/core/plex/library/folders/assets/plex_subtitle_asset.py,sha256=51itoIUbHco2HW0Mh9mGNddqwMrZA2ajwuyhVzPcXkI,521
|
281
|
+
plexflow/core/plex/library/folders/assets/plex_video_asset.py,sha256=F_7RtdtblYQJc_gp9nUVxIfS4BeHl0eZDgYmTMg2zos,208
|
282
|
+
plexflow/core/plex/library/folders/plex_folder.py,sha256=GZnyQO6bzcire-2mxPjIPJrq8J0S_4uVsOfVCiHo2E0,387
|
283
|
+
plexflow/core/plex/library/folders/plex_movie_folder.py,sha256=sT0FjpTwvsShi2ItDCyuRaxhsOiS_gw6tRXciaODgpQ,1426
|
279
284
|
plexflow/core/plex/library/library.py,sha256=-Tauzv2qYQ6k2RzEatHFYMNfkg0CHZaQAmTJs4M3dok,3211
|
280
285
|
plexflow/core/plex/token/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
281
286
|
plexflow/core/plex/token/__pycache__/__init__.cpython-311.pyc,sha256=trdQUL3OxH5EHEmWYV9U1xf7PK9ig9RDpauyqI7uh34,174
|
@@ -683,7 +688,7 @@ plexflow/utils/video/__pycache__/audio.cpython-312.pyc,sha256=vXBnJwWgTDFdixMBs-
|
|
683
688
|
plexflow/utils/video/__pycache__/subtitle.cpython-312.pyc,sha256=PCjpCLydGXaRsQy6cikhgsEs8WlComfOoYPiLFqfVMA,2515
|
684
689
|
plexflow/utils/video/audio.py,sha256=tJ_lNwcjVuBQYD5cYOlXpr__eh8-hnReIgNRgIYOpqo,3380
|
685
690
|
plexflow/utils/video/subtitle.py,sha256=qPvvBjlPj0fynJJvGJgGeKt9ey26R-cF6EoLaYt9iXU,1333
|
686
|
-
plexflow-0.0.
|
687
|
-
plexflow-0.0.
|
688
|
-
plexflow-0.0.
|
689
|
-
plexflow-0.0.
|
691
|
+
plexflow-0.0.107.dist-info/METADATA,sha256=dGqSMtLOAH92NnFU0WO3-ut0QmeHtmjRj2M_6tehN8g,3051
|
692
|
+
plexflow-0.0.107.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
693
|
+
plexflow-0.0.107.dist-info/entry_points.txt,sha256=uZc6ohXod3uudTgfeTqnkXBS4Cb7eajdjeqZc3P0PX4,1456
|
694
|
+
plexflow-0.0.107.dist-info/RECORD,,
|
File without changes
|
File without changes
|