44from platform import python_version
55from typing import Annotated , Final , Protocol , TypeVar
66
7+ from prompt_toolkit .styles import Style
78from questionary import Choice , select
89from typer import Abort , Argument , Context , Exit , Option , Typer
910
@@ -80,6 +81,7 @@ def setup(
8081
8182
8283class MediuxSet (Protocol ):
84+ id : int
8385 set_title : str
8486 username : str
8587
@@ -104,9 +106,18 @@ def filter_sets(
104106 if len (user_sets ) == 1 :
105107 yield user_sets .pop (0 )
106108 else :
107- choices = [Choice (title = x .set_title , value = x ) for x in user_sets ]
109+ choices = [
110+ Choice (
111+ title = [("class:dim" , f"{ x .id } | " ), ("class:title" , x .set_title )],
112+ description = f"{ Mediux .WEB_URL } /sets/{ x .id } " ,
113+ value = x ,
114+ )
115+ for x in user_sets
116+ ]
108117 selected = select (
109- f"Multiple sets found from '{ username } '" , choices = choices
118+ f"Multiple sets found from '{ username } '" ,
119+ choices = choices ,
120+ style = Style ([("dim" , "dim" )]),
110121 ).ask ()
111122 if selected :
112123 yield selected
@@ -129,10 +140,8 @@ def process_set_data(
129140 priority_usernames : list [str ],
130141 force : bool = False ,
131142 kometa_integration : bool = False ,
132- ) -> bool :
143+ ) -> None :
133144 should_log = True
134- if entry .all_posters_uploaded :
135- return False
136145
137146 def get_creator_rank (creator : str | None ) -> int :
138147 if creator and creator in priority_usernames :
@@ -300,7 +309,6 @@ def process_image(
300309 parent = slugify (value = movie .display_name ),
301310 filename = "backdrop.jpg" ,
302311 )
303- return True
304312
305313
306314@app .callback (invoke_without_command = True )
@@ -425,14 +433,15 @@ def sync_posters(
425433 interactive = interactive ,
426434 )
427435 for set_data in filtered_sets :
428- if not process_set_data (
436+ process_set_data (
429437 entry = entry ,
430438 set_data = set_data ,
431439 mediux = mediux ,
432440 service = service ,
433441 priority_usernames = settings .priority_usernames ,
434442 kometa_integration = settings .kometa_integration ,
435- ):
443+ )
444+ if entry .all_posters_uploaded :
436445 break
437446
438447
@@ -529,14 +538,15 @@ def media_posters(
529538 interactive = interactive ,
530539 )
531540 for set_data in filtered_sets :
532- if not process_set_data (
541+ process_set_data (
533542 entry = entry ,
534543 set_data = set_data ,
535544 mediux = mediux ,
536545 service = service ,
537546 priority_usernames = settings .priority_usernames ,
538547 kometa_integration = settings .kometa_integration ,
539- ):
548+ )
549+ if entry .all_posters_uploaded :
540550 break
541551
542552
0 commit comments