Giter Site home page Giter Site logo

mpv-scripts's Introduction

Introduction

This repository contain scripts I have made for mpv media player. To add scripts from this repository, download the desired script in your mpv/scripts/ directory, for user customizable settings download the related conf file in your mpv/script-opts/ directory.

Scripts available in this repository: SmartSkip, SmartCopyPaste, SmartCopyPaste_II, SimpleHistory, SimpleBookmark, SimpleUndo, UndoRedo

SmartSkip

You think Netflix is good at binge-watching? Yes, it is.. :) But give SmartSkip a try! Automatically or manually skip opening, intro, outro, and preview, like never before. Jump to next file, previous file, and save your chapter changes!

SmartSkip Demo

Click for more details!

Default Keybinds

Below default keybinds can be changed using the script conf file, or through script-opts by referring to the names that do not contain spaces.

Keybind Name Description
> smart-next Skips using silence-skip > chapter-next > playlist-next, based on configurable variables
< smart-prev Jumps to beginning > previous chapter > previous playlist, based on configurable variables
? silence-skip Skips until a silence is detected based on configurable variables
ctrl+right chapter-next Jumps to next chapter > to next playlist
ctrl+left chapter-prev Jumps to previous chapter > to beginning > to previous playlist
smart-next, enter, y Proceed Auto-Skip Proceeds Auto-Skip when countdown is started
smart-prev, pause, esc, n Cancel Auto-Skip Cancels Auto-Skip when countdown is started
ctrl+. toggle-autoskip Enables or disables Auto-Skip during playback for the current mpv session
alt+. toggle-category-autoskip Enables or disables a chapter for Auto-Skip during playback for the current mpv session
toggle-autoload Enables or disables autoload during playback for the current mpv session
n add-chapter Add a chapter for the reached position
alt+n remove-chapter Removes the current chapter
ctrl+n write-chapters jumps to the previous available filter based on configured filters
alt+s / alt+S edit-chapter Renames the current chapter (requires user-input-module )
bake-chapters Merge the changes of chapters for the file inside mkv file

Main Features

  • Smart Next / Prev: Automatically triggers Skip to Silence, Chapter Next/ Prev, or Playlist Next/ Prev based on configurable parameters.
  • Skip to Silence: If the file you are watching is not chaptered, skipping to silence will attempt to skip the intro and outro by finding the silence in the file (optionally: chapter automatically created).
  • Auto Skip: If the file you are watching has organized chapters, any opening, ending sound can be automatically skipped after your preferred countdown time.
  • Chapters Modification: Create, remove, edit chapters, and then save changes into an external file or bake them into the mkv file.
  • Chapter Next / Prev: Go to next chapter, if no chapters available go to next playlist, and vise-versa (like the good times with MPC-HC).
  • Autoload: Basically, if you are not using mpv's autoload script, this is bundled along for convenience and for the possibility to add more features in the future.
  • Customization: Tons of user customizable settings that can even change the behavior and priority of smart-next, smart-prev, auto-skip, and more!
  • OSD (On Screen Display): Displays a proper OSD for the actions preformed through SmartSkip.
  • More: This is not all! Explore the conf file to learn more about the possibilities you are missing out...

Compatibility

  • Works on all of mpv supported platforms.

SmartCopyPaste

Gives mpv the capability to copy and paste while being smart and customizable...

SmartCopyPaste Demo

Click for more details!

Default Keybinds

The following are the default keybinds, they can be changed in the conf file of the script or using script-opts by referring to the name.

Keybind Name Description
ctrl+c / ctrl+C / meta+c / meta+C copy copies file path / URI with resume time using the configured smart behavior.
ctrl+v / ctrl+V / meta+v / meta+V paste pastes and run into mpv from the clipboard using the configured smart behavior.
ctrl+alt+c / ctrl+alt+C / meta+alt+c / meta+alt+C copy-specific copies the file path without the reached time or based on the configured specific copy behavior.
ctrl+alt+v / ctrl+alt+V / meta+alt+v / meta+alt+V paste-specific pastes and appends the video file into playlist or based on the configured specific paste behavior.

Main Features

  • Copy and Paste: Adds copy and paste to mpv for any file, like (urls, torrents, images, subtitles, audio files, video paths)
  • Multi-Paste: Capability to paste a list of supported items seperated by new line to generate a playlist and conduct different actions depending on the files pasted.
  • youtube-dl Extension Support: Immediately paste links without finding exact video address for youtube and any other youtube-dl extension supported sites.
  • Peerflix / WebTorrent Extension Support: Immediately paste torrent links or magnet links when proper extensions are installed.
  • Customization: Tons of user customizable settings that can even change the behavior and priority of copy and paste actions.
  • OSD (On Screen Display): Displays any SmartCopyPaste action within mpv.
  • More: This is not all! Explore the conf file to learn more about the possibilities you are missing out...

Compatibility

  • Windows OS (default powershell, customizable / can be changed in the settings inside the script).
  • MAC OS (default pbcopy and pbpaste, customizable / can be changed in the settings inside the script).
  • Linux OS (default xclip, customizable / can be changed in the settings inside the script).

SmartCopyPaste_II

Just like SmartCopyPaste but logs your clipboard and makes use of it...

SmartCopyPaste_II Demo

Click for more details!

Default Keybinds

The following are the default keybinds, they can be changed in the conf file of the script or using script-opts by referring to the name.

Keybind Name Description
ctrl+c / ctrl+C / meta+c / meta+C copy copies file path / URI with resume time using the configured smart behavior.
ctrl+v / ctrl+V / meta+v / meta+V paste pastes and run into mpv from the clipboard using the configured smart behavior.
ctrl+alt+c / ctrl+alt+C / meta+alt+c / meta+alt+C copy-specific copies the file path without the reached time or based on the configured specific copy behavior.
ctrl+alt+v / ctrl+alt+V / meta+alt+v / meta+alt+V paste-specific pastes and appends the video file into playlist or based on the configured specific paste behavior.
c / C open-list opens Clipboard list (LogManager)

Main Features

  • Copy and Paste: Adds copy and paste to mpv for any file, like (urls, torrents, images, subtitles, audio files, video paths)
  • Multi-Paste: Capability to paste a list of supported items seperated by new line to generate a playlist and conduct different actions depending on the files pasted.
  • youtube-dl Extension Support: Immediately paste links without finding exact video address for youtube and any other youtube-dl extension supported sites.
  • Peerflix / WebTorrent Extension Support: Immediately paste torrent links or magnet links when proper extensions are installed.
  • Saves Clipboard to a Log File: The copies from mpv, and the pastes into mpv will be kept in a log file; log file location is mpv config directory, default for Windows OS: %APPDATA%\mpv\mpvClipboard.log, for Linux OS and MAC OS: ~\.config\mpv\mpvClipboard.log.
  • LogManager: Reads the log file directly in mpv, giving access to navigate, play files, add to playlist, delete, search, and filter the content.
  • Customization: Tons of user customizable settings that can even change the behavior and priority of copy and paste actions, as well as everything about LogManager.
  • OSD: Displays any SmartCopyPaste_II action within mpv.
  • More: This is not all! Explore the conf file to learn more about the possibilities you are missing out...

Compatibility

  • Windows OS (default powershell, customizable / can be changed in the settings inside the script).
  • MAC OS (default pbcopy and pbpaste, customizable / can be changed in the settings inside the script).
  • Linux OS (default xclip, customizable / can be changed in the settings inside the script).

SimpleHistory

Stores whatever you open in a history file and abuses it with features! Continue watching your last played or resume previously played videos, manage and play from your history, and more...

SimpleHistory Demo

Click for more details!

Default Keybinds

The following are the default keybinds, they can be changed in the conf file of the script or using script-opts by referring to the name.

Keybind Name Description
ctrl+r / ctrl+R history-resume File Loaded: Resumes in any previously closed video. / Idle: Loads and resumes the last played videos.
alt+r / alt+R history-load-last File Loaded: Adds last closed video into playlist. / Idle: Loads last closed video without resuming.
ctrl+H history-incognito-mode Triggeres a customizable incognito mode that stops saving history. To resume saving history press ctrl+H again
h / H open-list opens History list (LogManager)
r / R NA opens History list - filtered with recent items (LogManager)

Main Features

  • Last Played: Immediately jumps to your last played video so you continue watching
  • Video Resume: It saves the position of all videos you are watching so you can easily resume
  • Saves History to a Log File: The files and position of files played will be kept in a log file; log file location is mpv config directory, default for Windows OS: %APPDATA%\mpv\mpvHistory.log, for Linux OS and MAC OS: ~\.config\mpv\mpvHistory.log.
  • Incognito Mode: A highly customizable incognito mode that can also be set to auto_run with mpv. It stops history logging when triggered until it is disabled by triggering it again.
  • Blacklist/Whitelist: A very smart blacklist option that can understand inputted text to blacklist certain websites, urls, files, file paths, and protocols from saving into history. It can also be inverted into a whitelist so only defined files / urls / websites are saved into history.
  • LogManager: Reads the log file directly in mpv, giving access to navigate, play files, add to playlist, delete, search, and filter the content. (I personally like the distinct filter). It lists the last episode played of each different show.
  • Customization: Tons of user customizable settings, you can change almost everything. Hate the resume notification? Then just disable it. Hate recents list automatically loading? Then just disable it, and so on so forth...
  • OSD: Displays any SimpleHistory action within mpv.
  • More: This is not all! Explore the conf file to learn more about the possibilities you are missing out...

Compatibility

  • Works on all of mpv supported platforms.

SimpleBookmark

Bookmark with a key, then list and access your bookmarks with a key. Assign your favorites to a keybind then access your favorites with that same keybind. Simple as that...

SimpleBookmark Demo

Click for more details!

Default Keybinds

The following are the default keybinds, they can be changed in the conf file of the script or using script-opts by referring to the name.

Keybind Name Description
ctrl+b / ctrl+B bookmark-save bookmarks file along with time reached.
alt+b / alt+B bookmark-fileonly bookmarks file only without the reached time.
b / B open-list opens Bookmark list (LogManager)
k / K NA opens Bookmark list - filtered with entries assigned to keybinds (LogManager)
alt+1-alt+9 NA List is open: assigns entry to a keybind. / List is closed: loads the assigned entry.
alt+shift+1-alt+shift+9 NA override a corresponding assigned keybind entry based on the pressed number.
alt+- keybind-slot-remove when list is open it removes the assigned keybind from the bookmarked entry based on cursor position.
alt+shift+- keybind-slot-remove-highlight when list is open it removes all the highlighted assigned keybinds from the bookmarked entries.

Main Features

  • Bookmark: Adds bookmark functionality to mpv, simply press the bookmark keybind and you are done.
  • Assign Bookmark to Keybind: Press the keybind slot when displaying bookmarks will assign the bookmark to a keybind, making it easy to jump to the bookmark at anytime when pressing the same keybind.
  • LogManager: Reads the log file directly in mpv, giving access to navigate, play files, add to playlist, delete, search, and filter the content.
  • Saves Bookmark to a Log File: The bookmarks will be kept in a log file; log file location is mpv config directory, default for Windows OS: %APPDATA%\mpv\mpvBookmark.log, for Linux OS and MAC OS: ~\.config\mpv\mpvBookmark.log.
  • Customization: Tons of user customizable settings that can even change the behavior of bookmarking, assigning video to a keybind, and the LogManager itself.
  • OSD: Displays any SimpleBookmark action within mpv.
  • More: This is not all! Seriously I am too lazy to write down all the features neatly ;) Explore the conf file to learn more about the possibilities you are missing out...

Compatibility

  • Works on all of mpv supported platforms.

SimpleUndo

Accidentally seeked? No worries, simply undo..

SimpleUndo Demo

Click for more details!

Default Keybinds

The following are the default keybinds, they can be changed in the script or using script-opts by referring to the name.

Keybind Name Description
ctrl+z / ctrl+Z undo / undoCaps undo accidental seek by returning to previous time and vise-versa.

Main Features

  • Simple Undo: Undo accidental time jumps in videos by pressing undo keybind and press again to return to previous position.
  • OSD: Displays any SimpleUndo action within mpv.

Compatibility

  • Works on all of mpv supported platforms.

UndoRedo

Undo is not enough to fix your accidental seek? Well now you can redo as well..

UndoRedo Demo

Click for more details!

Default Keybinds

The following are the default keybinds, they can be changed in the script or using script-opts by referring to the name.

Keybind Name Description
ctrl+z / ctrl+Z undo / undoCaps undo by returning to previous time.
ctrl+y / ctrl+Y redo / redoCaps redo by restoring the undo time.
ctrl+alt+z / ctrl+alt+Z undoLoop / undoLoopCaps undo accidental seek by returning to previous time and vise-versa.

Main Features

  • Undo and Redo: Undo any accident time jumps in the video by pressing the undo keybind and redo the jumps by pressing the redo keybind.
  • Simple Undo: Undo accidental time jumps in videos by pressing Simple Undo keybind and press again to return to previous position.
  • OSD: Displays any UndoRedo action within mpv.

Compatibility

  • Works on all of mpv supported platforms.

LogManager

A highly customizable GUI to list and manage the logged items for SimpleHistory, SimpleBookmark, SmartCopyPaste_II; it is already integrated with the scripts.

Bookmarks (Keybinds Filter and Sort) Clipboard (Highlighted 3 Items) History (Search for Naruto in April 2022)
LogManager Demo1 LogManager Demo2 LogManager Demo3
Click for more details!

Default Keybinds

The following are the default keybinds, they can be changed in the conf file of the scripts or using script-opts by referring to the name.

Keybind Name Description
UP / WHEEL_UP move-up navigates up on the log list
DOWN / WHEEL_DOWN move-down navigates down on the log list
PGUP page-up navigates to the first item of current shown page on the log list
PGDWN page-down navigates to the last item of current shown page on the log list
HOME move-first navigates to the first item on the log list
END move-last navigates to the last item on the log list
SHIFT NA highlights the items on the list to manage and take action on multiple items. Keep holding SHIFT, then press any navigation keybind, e.g.: SHIFT+UP/SHIFT+PGDWN to highlight the items navigated towards
ctrl+a / ctrl+A list-highlight-all highlights all the displayed items on the log list
ctrl+d / ctrl+D list-unhighlight-all cancels the highlight of all highlighted items shown on the log list
RIGHT / MBTN_FORWARD list-filter-next jumps to the next available filter based on configured filters
LEFT / MBTN_BACK list-filter-previous jumps to the previous available filter based on configured filters
alt+s / alt+S list-cycle-sort cycles through the different available sorts on the log list
ENTER / MBTN_MID list-select loads an entry based on cursor position
ctrl+ENTER list-add-playlist add entry to playlist based on cursor position
SHIFT+ENTER list-add-playlist-highlight adds all highlighted entries to playlist
0-9 NA quick-select an entry from 0th to 9th position
DEL list-delete deletes an entry from the log file based on cursor position
SHIFT+DEL list-delete-highlight deletes all highlighted entries from the log file
ctrl+f / ctrl+F list-search-activate triggers search to quickly find an item on the log list
ALT+ENTER search_string_not_typing forcefully exit typing mode of search while keeping search open
Depends on the script ignore Keybinds that will be ignored when the log list is open (mainly to avoid opening another log list from a different script while current one is active)
ESC / MBTN_RIGHT NA close the log list (closes search first if it is open)

Main Features

  • Log Manage: List the log entries and manage them using mpv
  • Log Search: Search for any specific entries in the list using a simplified search engine
  • Log Filter: Apply a filter to the list depending on various built-in filters or build your own keywords filter
  • Log Multi-Select: Multi-select the items to load / manage multiple entries easily
  • Customization: LogManager is highly customizable in terms of anything that has to do with it, such as, keybinds, GUI with tons of built-in variables, the list of entries, and more.
  • OSD: Displays any LogManager action within mpv.

Compatibility

  • Intergrated with SmartCopyPaste-II, SimpleHistory, SimpleBookmark

Misc

MPV.net Support

MPV.net users must change the option input-default-bindings = no to input-default-bindings = yes located in MPV.net/mpv.conf

Special Thanks

Below is list of contributors/ honorable mentions. Without the below contributions these scripts would not exist today.

  • SmartCopyPaste Script: For the handlers that are used inside the script, which added compatibility for newer mpv versions, the method was originally forked and edited from @jonniek appendURL script. Special thanks for his work.
  • LogManager: @jonniek mpv-playlistmanager script and @hacel recents script, both scripts were forked and modified to help me in developing the LogManager which is used inside the script. Specials thanks for their work.
  • UndoRedo Script: Credits and special thanks to my friend @Banz99 for forking SimpleUndo script and enhance it by a table to store undo and redo values.
  • SmartSkip Script: skiptosilence.lua by @detuur, chapters.lua by @mar04, chapterskip.lua by @po5, and autoload.lua by @mpv team. The following scripts were forked and modified in order to develop SmartSkip. Specials thanks for their work.

mpv-scripts's People

Contributors

cherti avatar dyphire avatar eisa01 avatar gsbabil avatar renr3n avatar snowman avatar xfzv 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mpv-scripts's Issues

Toggling pause when idle causes error

When mpv is idle, if pause got touched just by pressing SPACE unconsciously, it will report errors like this

[SimpleUndo]
[SimpleUndo] stack traceback:
[SimpleUndo]    mp.defaults:397: in function 'handler'
[SimpleUndo]    mp.defaults:500: in function 'call_event_handlers'
[SimpleUndo]    mp.defaults:534: in function 'dispatch_events'
[SimpleUndo]    mp.defaults:493: in function <mp.defaults:492>
[SimpleUndo]    [C]: at 0x00f82de0
[SimpleUndo]    [C]: at 0x00f817f0
[SimpleUndo] Lua error: [string ".../mpv/portable_config/..."]:64: attempt to index global 'timer' (a nil value)

I tried editing script, seems working for now

mp.observe_property('pause', 'bool', function(name, value)
	if timer ~= nil then

	if value then
		timer:stop()
		pause = true
	else
		-- if timer ~= nil then
			timer:resume()
		-- end
		pause = false
	end
end
end)

Please check and fix it up, thanks!

SimpleHistory - old log file - conflict

The script doesn't read the log file anymore, and I think this issue comes from text month to numeric month.

log_path=C:\Users\Max\AppData\Roaming\mpv\_ZZZ
log_file=mpvHistory.log

UndoRedo-1.5.1 lua table.insert error

Dear developer,

Thank you very much for the UndoRedo script! Very nice functionality! Bravo!

I tried using UndoRedo-1.5.1.lua, but the code table.insert(seekTable,0,0) was giving me the following error:

[UndoRedo_1_5_1] Lua error: /home/ubuntu/.config/mpv/scripts/UndoRedo-1.5.1.lua:22: bad argument #2 to 'insert' (position out of bounds)

I think that this error may have to do with the lua version (5.1 versus 5.2 & 5.3?).

On my setup I was able to fix this by replacing the two occurrences of the table.insert code with:
seekTable[0] = 0

I am writing this comment to propose one of the following options:

  1. Either in the script switch on the lua version with an if-else statement
  2. or use a 'try-except' construct with pcall
  3. or (simplest option) make a comment about this in the README.md file and/or a code comment in the script itself (to safe troubleshooting time for future users)

Kind regards,
Grateful user

[BUG] Delete while filtered causes a very weird behavior

Whenever I try to delete elements from the history by searching or filtering, the second I delete the last element on display the hotkey for opening history stops working. I have to reopen MPV to get it working. But the thing is when I do that all of the elements, even the ones I didn't want to clear get removed from history.

Paste multiple urls at once

Hey! Thanks for the awesome scripts.

I tried the paste multiple urls at once but looks like doesn't work. I am using SmartCopyPaste Can you add this feature if it already does not exists?

When I paste the urls into mpv, it shows all the urls on osd as the following message:

Pasted Into Playlist:
https://www.youtube.com/watch?v=ID1
https://www.youtube.com/watch?v=ID2
https://www.youtube.com/watch?v=ID3

But in reality it only adding the first URL into the playlist.

Sorry about my language :P

Smartcopypaste Not Accepting Paste

Hi, smart copy paste was working simply great before I guess. But now it doesn't paste URLs I copied from browser. It just remembers URLs I copied from MPV and pastes them.

Is there a version that just pastes any URL from clipboard?

SmartHistory-1.5.2 not resuming

First of all, thank you for sharing your handy scripts! Unfortunately I ran into a problem:

Running mpv 0.32.0 on Arch Linux, I cannot resume videos using ctrl+r. Opening the last video with ctrl+l works just fine.
There are no errors or warnings in the shell output or osd and I disabled other scripts and configs for testing.

steps to reproduce

mpv example.mp4  #skip to the middle and exit
grep example.mp4 ~/.config/mpv/mpvHistory.log #the file has been logged correctly
mpv example.mp4 #pressing ctrl+r, nothing happens

Option to change log file location

Portable mpv installation uses portable_config folder in the root of mpv installation for storing personal data.When using multiple mpv, scripts are required to adapt the portability configuration, such as using mpv and mpv.net at the same time.Thanks in advance.

SimpleUndo-2.5.lua:68: attempt to index global 'timer' (a nil value)

Hello,

just tried SimpleUndo 2.5 and it worked once. Can't get it working again now. mpv 0.29.1 says:

[SimpleUndo_2_5]
[SimpleUndo_2_5] stack traceback:
[SimpleUndo_2_5] 	mp.defaults:459: in function 'call_event_handlers'
[SimpleUndo_2_5] 	mp.defaults:496: in function 'dispatch_events'
[SimpleUndo_2_5] 	mp.defaults:452: in function <mp.defaults:451>
[SimpleUndo_2_5] 	[C]: at 0x55925d44bb00
[SimpleUndo_2_5] 	[C]: at 0x55925d44d170
[SimpleUndo_2_5] Lua error: /home/haarp/.config/mpv/scripts/SimpleUndo-2.5.lua:68: attempt to index global 'timer' (a nil value)

Thanks!

Smartcopypaste with nircmd

Can you make modification of SmartCopyPaste-1.5 script to work with nircmd? I have Windows which doesn't have powershell, so it can't work with clipboard.

Save log to user profile directory

The config file of SimpleHistory.lua currently didn't offer a variable of user profile directory to save log, making it inconvenient to use absolute path instead.

It would be very helpful if such variable exists, please consider adding it in the future. Thanks!

Lua script file name should not include version number

description

When using require("SCRIPT_NAME-VERSION") to load Lua script, it'll first replace version
number with "directory separator" in the modname, for example:

-- FILE: MPV_CONFIG_DIR/scripts/loader.lua
local smart_history = require "SmartHistory-1.7.1"
-- the same as
local smart_history = require "SmartHistory-1/7/1"

require (modname) document: https://www.lua.org/manual/5.1/manual.html#5.3

The second searcher looks for a loader as a Lua library, using the
path stored at package.path.

A path is a sequence of templates separated by semicolons.

For each template, the searcher will change each interrogation mark in
the template by filename, which is the module name with each dot
replaced by a "directory separator" (such as "/" in Unix); then it
will try to open the resulting file name.

So, for instance, if the Lua path is the string

 "./?.lua;./?.lc;/usr/local/?/init.lua"

the search for a Lua file for module foo will try to open the files

  1. ./foo.lua
  2. ./foo.lc
  3. /usr/local/foo/init.lua

in that order.

What's expected?

Strip version number from the script file name, for example,
SmartHistory-1.7.1.lua should be renamed into SmartHistory.lua

SimpleBookmark - Force SimpleBookmark to be left-aligned

I have set the OSD alignment to the right, but I need SimpleBookmark to be left-aligned.
Is it possible to do it?

Where have I tried to fix it? (Unfortunately, I didn't make it happen by myself.)

  • SimpleBookmark.lua
  • SimpleBookmark.conf

SimpleBookmark: Total duration for videos that are bookmarked - Feature Request

I had the same idea as from this issue #34, but with a different application for SimpleBookmark script. Instead of logging time, it calculates everything that gets bookmarked and shows you the total time at the top it will take to complete the bookmarked elements. I thought it would be really neat and a nice way to see how much time it will take for you to go through the priority list with a total calculation, so you can plan your watch list more comfortably.

Difficulties in configuring the script

Without a configuration file, it is very difficult to customize the behavior of the script (for example, change the path to save the history file) if you have no knowledge of programming. Please make a config file.

The history list does not print escape sequences

When a directory starts with "h" on windows, the path is should contain "\h", for example "temp\home". Instead, the "\h" is transformed into whitespace and "temp ome" is printed:

image

Note: I have show_paths=yes in my config file.

Use clipboard on linux

xclip -o gives the primary selection, which is the last highlighted/selected text. I think the clipboard should be used by default (i.e. xclip -selection clipboard -o and xclip -selection clipboard -in) maybe with an option to use the primary selection instead. Currently the script does not work if text copied to the clipboard was not not done with highlighting/selection (and most copying I do does not affect the primary selection). Also if you highlight some text, C-c it, and then highlight some other text without copying it, the script will currently use the last highlighted text instead of what you actually copied last.

SmartCopyPaste: Absolute path copy

Feature request

I found the relative path copy quite useless in real scenarios and replaced the function with an absolute path one. I think this could be a valuable addition/modification

Something along these lines:

local function copy_path()
    local filePath = mp.get_property_native('path')
	if (filePath ~= nil) then

        local handle = io.popen("readlink -f "..filePath)
        local result = handle:read("*a")
        handle:close()

        local text = result:sub(1,-2)

		set_clipboard(text)
		mp.osd_message("Copied Video Only:\n"..text)
	else
		return false
	end
end

SmartCopyPaste 3.0: Option to Paste into Playlist by default?

Before I upgraded to SCP 3.0, anything I pasted into MPV would be pasted into the playlist by default, which I like. In SCP 3.0 however, the default behavior is to override the current video. I can customize behavior when a video is playing, and when using ctrl+alt+v, but if I have a video paused and use just ctrl+v, it will override my current playlist.

SimpleHistory: Auto Delete logs if File(s) Does not Exist

Would it be possible to auto-delete logs if the file is not in your system? It may be best if it was based on the file path, as if it is based on media-name or file-name it could cause problems.

For example...
Say there was a file in C:\Users\Me\Videos, and I delete/move the file, then when I start MPV up again that log will be deleted.

However, if that same file was in another directory C:\Users\Me\Downloads, it would run normally with no auto-deletion.

SmartCopyPaste Option to disable copying time

I don't prioritize copying the time-stamp that much. Typically I only want to copy the link. I'd prefer to use the CTRL+C command to just copy the video link instead of CTRL+ALT+C.

There doesn't seem to be an option in the lua script to change these configurations. I could edit the imput.config file, but I'm uncertain how to appropriately do that without breaking something.

FYI: the played video time could get from `on_unload` hook

SmartHistory.lua code can be refactor by NOT using boilerplate code like mp.add_periodic_timer and pause and end-file event.

Instead, by using on_unload hook.

document:

on_unload

    Run before closing a file, and before actually
    uninitializing everything.

    It's not possible to resume playback in this state.

    Ordered BEFORE end-file.

    Will also happen in the error case (then after on_load_fail).

sample code:

mp.add_hook('on_unload', 50, function()
   local path = mp.get_property('path')
   local time = mp.get_property('time-pos')

   local historyLog = io.open("mpvHistory.log", 'a+')
   historyLog:write(('%s%s\n'):format(path, '#time=' .. tostring(math.floor(time))))
   historyLog:close()
end)

see mpv-player/mpv#9148 for more details

Paste multiple links into MPV as different playlist entries?

Using the Foxytab extension, I can mass copy the links for youtube videos I have open in different tabs, and hypothetically paste them into MPV. Unfortunately, the player only loads the first link.

While it is understandable that this might be an unavoidable consequence of working with MPV and otherwise unresolvable, I'd still appreciate a way to paste multiple links at once into MPV and have the player recognize them all as different links instead of a single link.

Bad release

In the 2.2 release you uploaded github html pages instead of the actual scripts.

SmartHistory_1_5 sometimes throws an error

It seems that sometimes (on youtube playlists for example) SmartHistory 1.5 throws an error.

Here is an example:


[SmartHistory_1_5] 
[SmartHistory_1_5] stack traceback:
[SmartHistory_1_5] 	...uy-bartstan/.config/mpv/scripts/SmartHistory-1.5.lua:48: in function 'handler'
[SmartHistory_1_5] 	mp.defaults:460: in function 'call_event_handlers'
[SmartHistory_1_5] 	mp.defaults:494: in function 'dispatch_events'
[SmartHistory_1_5] 	mp.defaults:453: in function <mp.defaults:452>
[SmartHistory_1_5] 	[C]: ?
[SmartHistory_1_5] 	[C]: ?
[SmartHistory_1_5] Lua error: ...uy-bartstan/.config/mpv/scripts/SmartHistory-1.5.lua:48: attempt to concatenate global 'filePath' (a nil value)

Total duration for video played in history + filtering - Feature Request

I thought this would be a cool idea, so I thought I'll let you know in hope of maybe seeing it implemented. What if the history section with all the episodes could show the total time spent on all things in total. That would mean all videos with the accurate time as shown by when you stopped noted by the clock icon and time. Another thing would be if you say wanted to know time spent on a certain playlist, say Breaking Bad season 1 you can just search that up, and the duration counted will adjust to those elements and ignore everything else that doesn't fit. Time will only be counted if the video is playing from a continuation or if you decide to go back and play but not when you're paused. Hopefully, It makes any sense. I hope to hear from you soon. Thank you so much for all these awesome scripts :)

SimpleUndo: Deprecation warning for 'pause' and 'unpause' events

mpv from (at least) version 0.33 onwards reports

[SimpleUndo_2_5_1] The 'pause' event is deprecated and will be removed.
[SimpleUndo_2_5_1] The 'unpause' event is deprecated and will be removed.

Currently SimpleUndo still works without issues, but given the deprecation warning this might not be the case forever anymore.

Can't paste YouTube links after updating to mpv 0.34.0-14-g662c793a55

Previously, I was able to copy YouTube links with SmartCopyPaste-II and just paste them into mpv. Ever since I upgraded to mpv 0.34.0-14-g662c793a55, I just get the message

Failed to Paste
Pasted Unsupported Item:

and nothing else happens. I would like to provide more information but I don't really know what kind of information would be helpful and where to get it. I am on the Arch-based distro EndeavourOS, if that's important.

SmartCopyPaste Compatibility with MacOS X

Good script. Would be really cool to get SmartCopyPaste to also work on MacOS X.
Access to the clipboard on MacOS X from the command line can be done with pbcopy and pbpaste.
This should allow you to adapt your script for MacOS X too.

Support user-added link types

I'm using another script that adds support for magnet links, for example. It would be nice if there was setting where you could provide a string to match against (e.g. magnet:). If the clipboard contents match, it would just take the default behavior instead of failing (mp.commandv('loadfile', videoFile, 'append-play') for paste-playlist).

Keybind overlap

Just wanted to let you know that the keybind 'r' and 'R' overlap with default mpv keyboards (for moving subtitles up and down). I changed these to 'y' and 'Y', but would recommend changing them so as not to have them overlapping.

SimpleHistory: Along with the recent keybind, include all the files if it is in a playlist - Feature Request

I was just wondering if there is a way to include all the files in the playlist and the recent file. So, in initial use when you quit a video from a playlist and open MPV again, once you press the keybind to resume the file, it will only show the file you were last on and none of the remaining files of the playlist, which made me think if it is possible to include all the files in the playlist along with the recent file.

Why auto-resume to last position not work?

function on_filename_change(name, value)
   if value then
      resume()
   end
end

mp.observe_property("filename", "native", on_filename_change)

Copied the above script before the following lines:

---------------------------KEYBINDS CUSTOMIZATION SETTINGS---------------------------------
mp.add_key_binding("ctrl+r", "resume", resume)
mp.add_key_binding("ctrl+R", "resumeCaps", resume)
mp.add_key_binding("ctrl+l", "lastPlay", lastPlay)
mp.add_key_binding("ctrl+L", "lastPlayCaps", lastPlay)
---------------------END OF KEYBINDS CUSTOMIZATION SETTINGS---------------------------------

when runs, it shows 'Resumed Last Position' but always current position is 0

SimpleHistory.lua not backwards compatible with old mpvHistory.log

When replacing the old smarthistory.lua with the new SimpleHistory.lua, the new version won't work if the old mpvHistory.log is still located in /.config/mpv/. It doesn't even throw an error message.

Moreover, because my old version mentions "Version: 1.7.1" and the new version mentions "Version: 1.1", I incorrectly assumed that the new one was a deprecated old version.

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.