plexflow 0.0.109__py3-none-any.whl → 0.0.111__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.
@@ -1,6 +1,8 @@
1
1
  from plexflow.core.context.partial_context import PartialContext
2
2
  from typing import List, Tuple
3
3
  from qbittorrentapi.torrents import TorrentDictionary
4
+ from plexflow.core.subtitles.utils.plex_internal_subtitle import PlexInternalSubtitle
5
+ from plexflow.core.subtitles.utils.plex_external_subtitle import PlexExternalSubtitle
4
6
 
5
7
  class MovieAssets(PartialContext):
6
8
  def __init__(self, **kwargs) -> None:
@@ -12,6 +14,12 @@ class MovieAssets(PartialContext):
12
14
  def movie_path(self) -> str:
13
15
  return self.get("assets/movie/path")
14
16
 
17
+ def internal_subtitles(self) -> List[PlexInternalSubtitle]:
18
+ return self.get("assets/subtitles/internal")
19
+
20
+ def external_subtitles(self) -> List[PlexExternalSubtitle]:
21
+ return self.get("assets/subtitles/external")
22
+
15
23
  def subtitle_paths(self) -> List[str]:
16
24
  return self.get("assets/subtitle/path")
17
25
 
@@ -27,6 +35,12 @@ class MovieAssets(PartialContext):
27
35
  def update_subtitle_paths(self, paths: List[str]):
28
36
  self.set("assets/subtitle/path", paths)
29
37
 
38
+ def update_internal_subtitles(self, subtitles: List[PlexInternalSubtitle]):
39
+ self.set("assets/subtitles/internal", subtitles)
40
+
41
+ def update_external_subtitles(self, subtitles: List[PlexExternalSubtitle]):
42
+ self.set("assets/subtitles/external", subtitles)
43
+
30
44
  def update_embedded_subtitles(self, subtitles: List[Tuple[int, str]]):
31
45
  self.set("assets/embedded_subtitles", subtitles)
32
46
 
@@ -1,16 +1,15 @@
1
1
  from plexflow.core.context.partial_context import PartialContext
2
- from datetime import datetime as dt
3
- from plexflow.core.subtitles.providers.oss.oss_subtitle import OSSSubtitle
2
+ from plexflow.core.subtitles.utils.plex_external_subtitle import PlexExternalSubtitle
4
3
  from typing import List
5
4
 
6
5
  class Subtitles(PartialContext):
7
6
  def __init__(self, **kwargs) -> None:
8
7
  super().__init__(**kwargs)
9
8
 
10
- def all(self) -> List[OSSSubtitle]:
9
+ def all(self) -> List[PlexExternalSubtitle]:
11
10
  return self.get("subtitles/oss")
12
11
 
13
- def update(self, subtitles: List[OSSSubtitle]):
12
+ def update(self, subtitles: List[PlexExternalSubtitle]):
14
13
  if len(subtitles) == 0:
15
14
  return
16
15
  self.set("subtitles/oss", subtitles)
@@ -1,7 +1,7 @@
1
1
  import math
2
2
  from typing import List, Optional, Set
3
3
  from plexflow.core.torrents.results.universal import UniversalTorrent
4
- from plexflow.core.subtitles.results.subtitle import Subtitle
4
+ from plexflow.core.subtitles.utils.plex_external_subtitle import PlexExternalSubtitle
5
5
  from plexflow.utils.imdb.imdb_codes import IMDbCode
6
6
 
7
7
  class DownloadCandidate:
@@ -9,7 +9,7 @@ class DownloadCandidate:
9
9
  Represents a download candidate for a torrent with associated subtitles.
10
10
  """
11
11
 
12
- def __init__(self, torrent: UniversalTorrent, subtitles: List[Subtitle]):
12
+ def __init__(self, torrent: UniversalTorrent, subtitles: List[PlexExternalSubtitle]):
13
13
  """
14
14
  Initializes a new instance of the DownloadCandidate class.
15
15
 
@@ -197,7 +197,7 @@ class DownloadCandidate:
197
197
  """
198
198
  return any([
199
199
  self.has_native_dutch_subtitles,
200
- any(s.language == "nl" for s in self.subtitles),
200
+ any(s.oss_subtitle.language == "nl" for s in self.subtitles),
201
201
  ])
202
202
 
203
203
  @property
@@ -210,5 +210,5 @@ class DownloadCandidate:
210
210
  """
211
211
  return any([
212
212
  self.has_native_english_subtitles,
213
- any(s.language == "en" for s in self.subtitles),
213
+ any(s.oss_subtitle.language == "en" for s in self.subtitles),
214
214
  ])
@@ -1,16 +1,16 @@
1
1
  from typing import Iterable, List
2
2
  from plexflow.core.torrents.results.universal import UniversalTorrent
3
- from plexflow.core.subtitles.results.subtitle import Subtitle
3
+ from plexflow.core.subtitles.utils.plex_external_subtitle import PlexExternalSubtitle
4
4
  from plexflow.core.downloads.candidates.download_candidate import DownloadCandidate
5
5
 
6
- def create_download_candidates(torrents: Iterable[UniversalTorrent], subtitles: Iterable[Subtitle]) -> List[DownloadCandidate]:
6
+ def create_download_candidates(torrents: Iterable[UniversalTorrent], subtitles: Iterable[PlexExternalSubtitle]) -> List[DownloadCandidate]:
7
7
  """
8
- This function creates a list of DownloadCandidate objects from an iterable of UniversalTorrent and an iterable of Subtitle.
8
+ This function creates a list of DownloadCandidate objects from an iterable of UniversalTorrent and an iterable of PlexExternalSubtitle.
9
9
  All subtitles that are compatible with a torrent will become together a DownloadCandidate.
10
10
 
11
11
  Parameters:
12
12
  torrents (Iterable[UniversalTorrent]): An iterable of UniversalTorrent objects.
13
- subtitles (Iterable[Subtitle]): An iterable of Subtitle objects.
13
+ subtitles (Iterable[PlexExternalSubtitle]): An iterable of PlexExternalSubtitle objects.
14
14
 
15
15
  Returns:
16
16
  List[DownloadCandidate]: A list of DownloadCandidate objects.
@@ -23,7 +23,7 @@ def create_download_candidates(torrents: Iterable[UniversalTorrent], subtitles:
23
23
  if not isinstance(torrents, Iterable):
24
24
  raise ValueError("torrents should be an iterable of UniversalTorrent objects")
25
25
  if not isinstance(subtitles, Iterable):
26
- raise ValueError("subtitles should be an iterable of Subtitle objects")
26
+ raise ValueError("subtitles should be an iterable of PlexExternalSubtitle objects")
27
27
 
28
28
  download_candidates = []
29
29
 
@@ -32,7 +32,7 @@ def create_download_candidates(torrents: Iterable[UniversalTorrent], subtitles:
32
32
  if not isinstance(torrent, UniversalTorrent):
33
33
  raise ValueError("Each torrent should be an instance of UniversalTorrent")
34
34
 
35
- compatible_subtitles = [subtitle for subtitle in subtitles if torrent.is_compatible_with(subtitle)]
35
+ compatible_subtitles = [subtitle for subtitle in subtitles if torrent.is_compatible_with(subtitle.oss_subtitle)]
36
36
  download_candidate = DownloadCandidate(torrent, compatible_subtitles)
37
37
  download_candidates.append(download_candidate)
38
38
 
@@ -0,0 +1,11 @@
1
+ from plexflow.core.subtitles.providers.oss.oss_subtitle import OSSSubtitle
2
+ from plexflow.core.subtitles.utils.plex_subtitle import PlexSubtitle
3
+
4
+ class PlexExternalSubtitle(PlexSubtitle):
5
+ def __init__(self, path, name, subtitle: OSSSubtitle):
6
+ super().__init__(path, name)
7
+ self.subtitle = subtitle
8
+
9
+ @property
10
+ def oss_subtitle(self) -> OSSSubtitle:
11
+ return self.subtitle
@@ -0,0 +1,6 @@
1
+
2
+ from plexflow.core.subtitles.utils.plex_subtitle import PlexSubtitle
3
+
4
+ class PlexInternalSubtitle(PlexSubtitle):
5
+ def __init__(self, path, name):
6
+ super().__init__(path, name)
@@ -0,0 +1,21 @@
1
+
2
+ class PlexSubtitle:
3
+ def __init__(self, path: str, name: str):
4
+ self.path = path
5
+ self.name = name
6
+ self.detected_language = None
7
+
8
+ @property
9
+ def filepath(self) -> str:
10
+ return self.path
11
+
12
+ @property
13
+ def filename(self) -> str:
14
+ return self.name
15
+
16
+ def set_detected_language(self, lang):
17
+ self.detected_language = lang
18
+
19
+ @property
20
+ def language(self) -> str:
21
+ return self.detected_language
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: plexflow
3
- Version: 0.0.109
3
+ Version: 0.0.111
4
4
  Summary: A short description of the package.
5
5
  License: MIT
6
6
  Keywords: keyword1,keyword2,keyword3
@@ -30,9 +30,9 @@ plexflow/core/context/partials/completed_downloads.py,sha256=BM5apreKS9zeuFOT4Eq
30
30
  plexflow/core/context/partials/context.py,sha256=pFzpAFxwCJdqPuhXJqhs6j4Xyvf0GQtzPRMmL4fcjEA,314
31
31
  plexflow/core/context/partials/ids.py,sha256=QoQ6FbX1OIWrE-iuz-G6kSzBlTt1_I1jyfl2JgKge2o,913
32
32
  plexflow/core/context/partials/movie.py,sha256=VXQ2SspFgGSRgDefg4VlHrH2fns3KRuKlU72ps6527o,3861
33
- plexflow/core/context/partials/movie_assets.py,sha256=ZUgNpPDBDw_vjg3DcBP9OI2_zzbOh275GHkTBSuHbOc,1225
33
+ plexflow/core/context/partials/movie_assets.py,sha256=qjZTs-lpPfZkQQSKm6CB4aeECX5_YzOom51PxZzmnts,1913
34
34
  plexflow/core/context/partials/reports.py,sha256=0W58RwK3VSsVHbF0rhvMNNlZZr01eutwermyvdeEZIs,810
35
- plexflow/core/context/partials/subtitles.py,sha256=Eax0rdGeTqEHkt9KNiyv097X3I1Drt9xb19VDalyA4Q,542
35
+ plexflow/core/context/partials/subtitles.py,sha256=0NhKGkP-sArQswuSyA7puRSjjoobF-3Ah7Pd39QkgTU,535
36
36
  plexflow/core/context/partials/tgx_batch.py,sha256=TduB09oBOQ8CtmPYsHIeNe7AI-ypKw21zQAX-7qktEs,859
37
37
  plexflow/core/context/partials/tgx_context.py,sha256=_FuhOvKsFqi_uynHxgC9_QIR2CfYmz-uJCRFtGFJmXI,1641
38
38
  plexflow/core/context/partials/torrents.py,sha256=GtO4rlb7V2N-4QEWt-ODssEsdUlQ2o0lTo_BFI5i3lw,1109
@@ -67,13 +67,13 @@ plexflow/core/downloads/candidates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
67
67
  plexflow/core/downloads/candidates/__pycache__/__init__.cpython-312.pyc,sha256=rukNX00PSteBonRk-cayzNRk17ypWfE4noOAR3Ibjn0,170
68
68
  plexflow/core/downloads/candidates/__pycache__/download_candidate.cpython-312.pyc,sha256=f4h0U6Cue2z5QaU_Ik7zHTqITe0SLVSeNRLvIVwsB3c,9487
69
69
  plexflow/core/downloads/candidates/__pycache__/utils.cpython-312.pyc,sha256=Jwoj7R4TFzjoXc3uq_Wps3WitzFE9K_miKp9XuT_l8Y,2079
70
- plexflow/core/downloads/candidates/download_candidate.py,sha256=CUq56hnl624GvrXb5ET0-z1xnNGfbCdJu2MMPItkYnI,5927
70
+ plexflow/core/downloads/candidates/download_candidate.py,sha256=6lQbtNw8uGr5B8qrkOOCxxvCKGHvFoEq8JjHGNB5FN8,5989
71
71
  plexflow/core/downloads/candidates/filtered.py,sha256=HgUY0S3aWAeHASHTjND9hyjCtGNLhUzLOL90G2CDxKg,1842
72
72
  plexflow/core/downloads/candidates/rank/__pycache__/ranking.cpython-312.pyc,sha256=Wz8hGAtLZNT0ThAPwloLBek5wflI6DKFDhr5_b7TzPI,4045
73
73
  plexflow/core/downloads/candidates/rank/__pycache__/utils.cpython-312.pyc,sha256=5Q6q1kw62WCWlPVFpXgXYt6oqf2gWHK_DHaZ-CBADwk,426
74
74
  plexflow/core/downloads/candidates/rank/ranking.py,sha256=p86f3DQmXJNE53gPk9E5RcKA7dgXI4wPQsIh9ae1uxY,2490
75
75
  plexflow/core/downloads/candidates/rank/utils.py,sha256=R4Ai4KmZRONo9vd2rf32DdGxVkANHYFwSjrO5WVjX9U,100
76
- plexflow/core/downloads/candidates/utils.py,sha256=ahI6bvk7CHT_O0BEXsd7FtC180Swlt9Phj6_op1mhYA,1777
76
+ plexflow/core/downloads/candidates/utils.py,sha256=BnuDSRjU9mVYSh9ejKgfvlLi0bWEqc07uLyskC-bYhw,1874
77
77
  plexflow/core/downloads/qbit/__pycache__/interface.cpython-312.pyc,sha256=szUoTWpZNpHwJ0OnXer8ZLeAYIvHND-rX1lB2Juv-J4,3335
78
78
  plexflow/core/downloads/qbit/__pycache__/schedule.cpython-312.pyc,sha256=ESOLrk6sLpb1mtijuDGNKvAHaYopVQBwSDzdt8dFNow,1350
79
79
  plexflow/core/downloads/qbit/interface.py,sha256=26--RLSWYnI8nx4UThF2qu3Lm7hqpOxKw5Sp47qqg2o,2435
@@ -381,6 +381,9 @@ plexflow/core/subtitles/results/__pycache__/__init__.cpython-312.pyc,sha256=pbtC
381
381
  plexflow/core/subtitles/results/__pycache__/subtitle.cpython-311.pyc,sha256=CjeZEPM8DrolKN7eIIHM2kEN3gdc90yhdZssUN0ImdY,6400
382
382
  plexflow/core/subtitles/results/__pycache__/subtitle.cpython-312.pyc,sha256=kDLEfwKiTgKMvis6GQ19lXs8Ybz09KV8tgMLx6D1BhE,5984
383
383
  plexflow/core/subtitles/results/subtitle.py,sha256=1_xeg_l93b-gWRJEKrOSA8k1OlNOfJgotFWWsfgiUvM,3852
384
+ plexflow/core/subtitles/utils/plex_external_subtitle.py,sha256=LOhYDFZNgAhXROdJeqWwI1EeGLGpo5MQZtB0lwgIfbU,407
385
+ plexflow/core/subtitles/utils/plex_internal_subtitle.py,sha256=kFM789VRX7BuTldYmjCUG22E06xWgEej2L3U5Bp4JHI,185
386
+ plexflow/core/subtitles/utils/plex_subtitle.py,sha256=djARWfuKF7GXyeS0tm6yVtEtMATDoPl61_ja1NTWYUY,470
384
387
  plexflow/core/torrents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
385
388
  plexflow/core/torrents/__pycache__/__init__.cpython-311.pyc,sha256=Ak5TvWroVnHx7z-S-hqYzBrZyP5axDM85dpaSb4yI3o,172
386
389
  plexflow/core/torrents/__pycache__/__init__.cpython-312.pyc,sha256=Dh3-EcDVLfB2Sw6dG4fNzbkxJNbbXhby2kX0kE6VCdI,158
@@ -691,7 +694,7 @@ plexflow/utils/video/__pycache__/audio.cpython-312.pyc,sha256=vXBnJwWgTDFdixMBs-
691
694
  plexflow/utils/video/__pycache__/subtitle.cpython-312.pyc,sha256=PCjpCLydGXaRsQy6cikhgsEs8WlComfOoYPiLFqfVMA,2515
692
695
  plexflow/utils/video/audio.py,sha256=tJ_lNwcjVuBQYD5cYOlXpr__eh8-hnReIgNRgIYOpqo,3380
693
696
  plexflow/utils/video/subtitle.py,sha256=qPvvBjlPj0fynJJvGJgGeKt9ey26R-cF6EoLaYt9iXU,1333
694
- plexflow-0.0.109.dist-info/METADATA,sha256=6F1QRG0TQZ10hajMo70MMBTpcai9eWnCJwbb8l28ugM,3051
695
- plexflow-0.0.109.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
696
- plexflow-0.0.109.dist-info/entry_points.txt,sha256=SSLjrLcZa2880346VUIsCG9vcLsquf-RTX9pkdNaTO8,1498
697
- plexflow-0.0.109.dist-info/RECORD,,
697
+ plexflow-0.0.111.dist-info/METADATA,sha256=xdqWRniW9c6cTYuuE-0CQBNfJd2XERt8aEQuPJab8os,3051
698
+ plexflow-0.0.111.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
699
+ plexflow-0.0.111.dist-info/entry_points.txt,sha256=SSLjrLcZa2880346VUIsCG9vcLsquf-RTX9pkdNaTO8,1498
700
+ plexflow-0.0.111.dist-info/RECORD,,