Last active
January 29, 2020 14:07
-
-
Save gabrielfern/566f4676417d7aa2eb3136de0cfdabf3 to your computer and use it in GitHub Desktop.
Revisions
-
gabrielfern revised this gist
Jan 29, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,7 +32,7 @@ end function remove_current() local pos = mp.get_property_number('playlist-pos') local count = mp.get_property_number('playlist-count') local title = mp.get_property('media-title') if pos == count - 1 and count > 1 then mp.set_property('playlist-pos', pos - 1) @@ -41,8 +41,8 @@ function remove_current() mp.commandv('playlist-remove', 'current') end mp.osd_message('Removed '..title..' from playlist') mp.msg.info('Removed '..title..' from playlist') end mp.add_key_binding('f1', 'move_up', move_up) -
gabrielfern renamed this gist
Jan 29, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,6 +45,6 @@ function remove_current() mp.msg.info('Removed '..filename..' from playlist') end mp.add_key_binding('f1', 'move_up', move_up) mp.add_key_binding('f2', 'move_down', move_down) mp.add_key_binding('ctrl+d', 'remove_current', remove_current) -
gabrielfern created this gist
Jan 28, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ function notify_new_pos(pos, count) mp.osd_message('New position in playlist ['.. pos ..'/'..count..']') mp.msg.info('New position in playlist ['.. pos ..'/'..count..']') end function move_up() local pos = mp.get_property_number('playlist-pos') local count = mp.get_property_number('playlist-count') if pos >= 1 then mp.commandv('playlist-move', pos, pos - 1) notify_new_pos(pos, count) else --mp.commandv('playlist-move', pos, count) In case you wanna cycle playlist --notify_new_pos(count, count) end end function move_down() local pos = mp.get_property_number('playlist-pos') local count = mp.get_property_number('playlist-count') if pos + 2 <= count then mp.commandv('playlist-move', pos, pos + 2) notify_new_pos(pos + 2, count) else --mp.commandv('playlist-move', pos, 0) In case you wanna cycle playlist --notify_new_pos(1, count) end end function remove_current() local pos = mp.get_property_number('playlist-pos') local count = mp.get_property_number('playlist-count') local filename = mp.get_property('playlist/'..pos..'/filename') if pos == count - 1 and count > 1 then mp.set_property('playlist-pos', pos - 1) mp.commandv('playlist-remove', pos) else mp.commandv('playlist-remove', 'current') end mp.osd_message('Removed '..filename..' from playlist') mp.msg.info('Removed '..filename..' from playlist') end mp.add_key_binding('\\', 'move_up', move_up) mp.add_key_binding('x', 'move_down', move_down) mp.add_key_binding('z', 'remove_current', remove_current)