GithubHelp home page GithubHelp logo

recent's Introduction

recent.lua

Recently played menu

Logs played files to a history log file with an interactive 'recently played' menu that reads from the log. Allows for automatic or manual logging if you want a file bookmark menu instead.

Menu controls:

  • Default display hotkey is `
  • Keyboard:
    • UP/DOWN to move selection
    • ENTER to load highlighted entry
    • DEL to delete highlighted entry
    • 0-9 for quick selection
    • ESC to exit
  • Mouse (if turned on):
    • WHEEL_UP/WHEEL_DOWN to move selection
    • MBTN_MID to load highlighted entry
    • MBTN_RIGHT to exit

Modify settings through script-opts/recent.conf

  • Log path is history.log inside whatever config directory mpv reads
  • Disabling auto_save makes it only save with a keybind
    • No save key is bound by default, see script-opts
  • See comments in the script for more info

Play most recent one.

KEY                 script-binding recent/play-last

uosc integration

tomasklaen/uosc is required.

Menu - add following to input.conf.

KEY                 script-binding recent/display-recent          #! Recently played

Controls - add following to uosc.conf#controls.

command:history:script-message-to recent display-recent?Recently played

mpv-menu-plugin integration

mpv-menu-plugin is required.

Menu - add following to input.conf.

KEY                 script-binding recent/display-recent        #! Recently played  #@recent

recent's People

Contributors

crendking avatar dyphire avatar hacel avatar keiviv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

recent's Issues

error: can't convert to number!

When I change key bind I get below errors.

error: can't convert to number!
script-opts/recent.conf:3 error converting value '' for key 'auto_save_skip_past'

I have done so far. Changed below lines in two files.

recent.lua

display_bind = "7",

recent.conf

display_bind=7

That would be really awesome if I am able to add

recent.lua after source removal

Dear developer(s),

Thank you very much for the recent.lua script! Very nice functionality! Thank you so much for making and sharing it!

I encountered a link to this plugin on the mpv user scripts github page and thought it was very useful functionality. Two circumstances that I encountered or can think of:

  1. The source file has been deleted/moved/renamed after the creation of the history.log file
  2. The source file has been deleted/moved/renamed after displaying the history.log onto the mpv OSD

For my setup this leads to a hard abort of the mpv player (crash?). To me it seems more desirable to in the mpv OSD omit those files from the history log that are no longer available (point 1) and to throw a message/warning onto the OSD when a file is selected that is no longer available (point 2). To achieve this behaviour in my copy of recent.lua I have added the following function (copied from stackoverflow):

function file_exists(name)
    local f=io.open(name,"r")
    if f~=nil then io.close(f) return true else return false end
end

and in the function read_log_table substituted return {title = t, path = p} with:

if file_exists(p) then return {title = t, path = p} else return nil end

and in the function load substituted mp.commandv("loadfile", list[#list-start-choice].path, "replace") with:

if file_exists(list[#list-start-choice].path) then mp.commandv("loadfile", list[#list-start-choice].path, "replace") else mp.osd_message("Failed loading file: "..list[#list-start-choice].title) end

My apologies for posting this comment here as technically it does not concern a script issue, but I just wanted to share this as perhaps you (the developer) or someone else may like this behaviour as well and like to incorporate it in their recent.lua script. If not, please feel free to ignore my comments ;)

Thanks again for sharing your great work!!

With kind regards,
Happy user

Streamings and Youtube videos won´t load

When a Youtube video or a magnet link or some streaming link is in the history, when loaded it gives an error "failed loading file". It works fine with local files and .torrent files (with webtorrent script).

Recent changes break path display.

@dyphire

52f6465 broke show_paths=true for osc. It only displays filename+extension, while uosc still shows full paths correctly:

1

2
 

Then next commit (584ac4d) broke displaying paths for both osc and uosc.

3

4

And current version just crashes when using show_paths with default osc

[recent] 
[recent] stack traceback:
[recent] 	...op/mpv-x86_64-v3-20240531-git-481e498/scripts/recent.lua:110: in function 'get_filename'
[recent] 	...op/mpv-x86_64-v3-20240531-git-481e498/scripts/recent.lua:278: in function 'draw_list'
[recent] 	...op/mpv-x86_64-v3-20240531-git-481e498/scripts/recent.lua:393: in function 'display_list'
[recent] 	...op/mpv-x86_64-v3-20240531-git-481e498/scripts/recent.lua:444: in function 'prop'
[recent] 	mp.defaults:410: in function 'handler'
[recent] 	mp.defaults:513: in function 'call_event_handlers'
[recent] 	mp.defaults:555: in function 'dispatch_events'
[recent] 	mp.defaults:506: in function <mp.defaults:505>
[recent] 	[C]: at 0x7ff681fa4e80
[recent] 	[C]: at 0x7ff681fa3ce0
[recent] Lua error: ...op/mpv-x86_64-v3-20240531-git-481e498/scripts/recent.lua:110: bad argument #1 to 'split_path' (string expected, got nil)

I didn't check how it behaves with mpv-menu-plugin, but probably not any better.

Script does not prompt OSD/ answer to the shortcut

The script prompts OSD properly only the first time after moved into the ~/.config/mpv/scripts directory, and then not anymore. Yet the history.log file keeps uploading. If I delete and readd it to the directory, it works again but still only the first time running.

I'm using IINA on macOS.

A shortcut is assigned to the script in the app's preferences:
script-binding display-recent

Besides, I appended this to the script:
mp.add_forced_key_binding(o.display_bind, "display-recent", display_list)

The other mpv scripts I installed don't have this issue.

mpv log:
[ 0.533][v][cplayer] Running hook: recent/on_unload
[ 0.534][w][recent]
[ 0.534][w][recent] stack traceback:
[ 0.534][w][recent] /Users/axzo51/.config/mpv/scripts/recent.lua:290: in function 'fn'
[ 0.534][w][recent] mp.defaults:544: in function 'handler'
[ 0.534][w][recent] mp.defaults:486: in function 'call_event_handlers'
[ 0.534][w][recent] mp.defaults:520: in function 'dispatch_events'
[ 0.534][w][recent] mp.defaults:479: in function <mp.defaults:478>
[ 0.534][w][recent] [C]: ?
[ 0.534][w][recent] [C]: ?
[ 0.534][f][recent] Lua error: /Users/axzo51/.config/mpv/scripts/recent.lua:290: attempt to compare nil with number
[ 0.535][d][recent] Exiting...

Blink and dissapear, when video is playing

It shows last videos only on start video. When video is playing, it blinks on ms and then dissapear when i press key binding. Probably it was not the last version. Is it fixed?

Creating another .log file

Hi, is it possible to add an option to create another log file?

For example, we will have history.log and favorites.log at the same time. History.log will log as usual. But favorites.log, with a different shortcut, will log whatever user chooses to log.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.