Skip to content

Commit f9c5682

Browse files
committed
Fixed playlist not populating on /
1 parent 6f24e27 commit f9c5682

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

bin/miniplayer

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -764,20 +764,23 @@ class Player:
764764
return False
765765

766766

767-
def _maxCompletion(result, tag):
767+
def _maxCompletion(result, tag, query):
768768
"""
769769
Function that tries to find the biggest
770770
common string in the tag field of result
771771
"""
772772

773-
max_completion = None
773+
max_completion = None
774774

775775
# Iterate over result
776776
for r in result:
777777

778778
if tag in r.keys():
779779

780780
# Init max_completion if it hasn't been
781+
if r[tag][:len(query)].lower() != query.lower():
782+
continue
783+
781784
if max_completion is None:
782785
max_completion = r[tag]
783786
continue
@@ -856,7 +859,7 @@ class Player:
856859
return
857860

858861
# Find max completion
859-
max_completion = _maxCompletion(available_tags, top_tag)
862+
max_completion = _maxCompletion(available_tags, top_tag, tags[-1])
860863

861864
# Handle only one match
862865
if _checkIfOne(available_tags, top_tag):
@@ -918,13 +921,9 @@ class Player:
918921
while len(tags) > 0 and not tags[0]:
919922
tags = tags[1:]
920923

921-
last_tag = None
922924
while len(tags) > 0 and not tags[-1]:
923-
last_tag = tags[-1]
924925
tags = tags[:-1]
925926

926-
if last_tag is not None:
927-
tags.append(last_tag)
928927

929928
else:
930929
tags = None
@@ -959,7 +958,7 @@ class Player:
959958
A function to handle keypresses
960959
"""
961960

962-
anytime_keys = ["quit", "help", "select_up", "select_down", "select"]
961+
anytime_keys = ["quit", "help", "select_up", "select_down", "select", "command_line"]
963962

964963
playlist_keys = ["delete", "select_up", "select_down", "select", "move_up", "move_down"]
965964

0 commit comments

Comments
 (0)