@@ -40,6 +40,7 @@ def load_config():
40
40
"JACKETT_API_KEY" : "" ,
41
41
"JACKETT_URL" : "http://127.0.0.1:9117" ,
42
42
"TIMEOUT" : "30" ,
43
+ "REMOVE_PLAYED_FROM_LIST" : "False" ,
43
44
}
44
45
45
46
config = CaseSensitiveConfigParser ()
@@ -584,8 +585,8 @@ def main():
584
585
mountpoint_removed = [m .replace (mountpoint , "" ) for m in media ]
585
586
file_paths = [last_created_dir + "/files" + m for m in mountpoint_removed ]
586
587
587
- for file_path in file_paths :
588
- print (file_path )
588
+ # for file_path in file_paths:
589
+ # print(file_path)
589
590
590
591
read_log (log )
591
592
@@ -613,8 +614,32 @@ def main():
613
614
# For other players, just use original command.
614
615
player_with_options = list (player )
615
616
616
- if media :
617
+
618
+
619
+ if len (media ) == 1 :
620
+ print (f"Playing: { os .path .basename (media [0 ])} " )
617
621
status = subprocess .call (player_with_options + media , stdin = sys .stdin )
622
+ elif len (media ) > 1 :
623
+ while media :
624
+ selection_list = "\n " .join (f"{ index } : { os .path .basename (path )} " for index , path in enumerate (media ))
625
+ process = subprocess .Popen (['fzf' , '--with-nth' , '2..' ], stdin = subprocess .PIPE , stdout = subprocess .PIPE )
626
+ selected , _ = process .communicate (input = selection_list .encode ('utf-8' ))
627
+ if process .returncode == 0 :
628
+ selected_index = int (selected .decode ('utf-8' ).split (':' )[0 ])
629
+ selected_file = media [selected_index ]
630
+
631
+ print (f"Playing: { os .path .basename (selected_file )} " )
632
+ status = subprocess .call (player_with_options + [selected_file ], stdin = sys .stdin )
633
+
634
+ if REMOVE_PLAYED_FROM_LIST :
635
+ media .pop (selected_index )
636
+ else :
637
+ print ("Exiting." )
638
+ break
639
+
640
+
641
+ # if media:
642
+ # status = subprocess.call(player_with_options + media, stdin=sys.stdin)
618
643
else :
619
644
print ("No video media found" , file = sys .stderr )
620
645
status = 3
0 commit comments