main
hashirama 2024-09-08 16:06:38 -04:00
parent f0233090d3
commit 838328efd3
No known key found for this signature in database
GPG Key ID: 53E62470A86BC185
24 changed files with 3507 additions and 22 deletions

View File

@ -9,6 +9,15 @@
#+ add ao-volume 2
#- add ao-volume -2
# Increase playback speed
UP add speed 0.1
# Decrease playback speed
DOWN add speed -2
# Reset playback speed to normal
R set speed 1.0
# Cycle video aspect ratios; "-1" is the container aspect
A cycle-values video-aspect "16:9" "16:10" "4:3" "2.35:1" "-1"
@ -46,7 +55,7 @@ A add sub-delay -152
X sub-step 1
x sub-step -1
Ctrl+r set sub-delay 0
Ctrl+x set sub-delay 0
o show-progress
@ -58,3 +67,7 @@ V script-binding visibility
Ctrl+b run "/bin/sh" "-c" "impd add '${=path}'"
Shift+Home seek 0 absolute

73
.config/mpv/input.conf~ Normal file
View File

@ -0,0 +1,73 @@
# mpv keybindings
# Increase / decrease subtitle font size
# https://www.reddit.com/r/mpv/comments/dg5yzj/trouble_decreasing_subtitles_size/
/ add sub-scale +0.1
? add sub-scale -0.1
# AO volume controls (numpad):
#+ add ao-volume 2
#- add ao-volume -2
# Increase playback speed
UP add speed 0.1
# Decrease playback speed
DOWN add speed -2
# Reset playback speed to normal
R set speed 1.0
# Cycle video aspect ratios; "-1" is the container aspect
A cycle-values video-aspect "16:9" "16:10" "4:3" "2.35:1" "-1"
# Vim-like seeking
l seek 5
h seek -5
j seek -60
k seek 60
# Cycle between subtitle files
K cycle sub
J cycle sub down
# Skip to previous/next subtitle line (disabled - use mpvacioius)
#H no-osd sub-seek -1
#L no-osd sub-seek 1
# Search sub-text on Jisho.org
# https://github.com/mpv-player/mpv/issues/4695#issuecomment-609876072
#Ctrl+j run "/bin/sh" "-c" "xdg-open 'https://jisho.org/search?keyword=${sub-text}'"
# skip to next/previous file
> playlist-next
< playlist-prev
# Add/subtract 50 ms delay from subs
Z add sub-delay +0.05
z add sub-delay -0.05
D add sub-delay -92.3
A add sub-delay -152
# Adjust timing to previous/next subtitle
X sub-step 1
x sub-step -1
Ctrl+x set sub-delay 0
o show-progress
V script-binding visibility
Ctrl+b run "/bin/sh" "-c" "impd add '${=path}'"
Shift+Home replay

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View File

@ -1,17 +1,5 @@
sub-font-size=30
sub-pos=13
sub-font="Calex Code JP"
sub-antialiasing=yes
sub-text-outline=0.5
ass-use-margins=yes
ass-top-margin=50
ass-bottom-margin=50
ass-left-margin=50
ass-right-margin=50
# screenshot
screenshot-template="%f_%p"
@ -37,10 +25,10 @@ ytdl-format=bestvideo[height<=?720p]+bestaudio/best
#####
framedrop=yes
display-fps=20
fps=20
vf-add=fps=20:round=near
#framedrop=yes
#display-fps=20
#fps=20
#vf-add=fps=20:round=near
#
@ -160,14 +148,60 @@ tscale=oversample
# Force 50 Hz refresh rate
refresh=50
############## end of "drowsy" config.
# Enable audio buffering
audio-buffer=100ms
audio-buffer=1000ms
# dont tie audio to video fps
no-sync=yes
audio-speed=1.0
audio-pitch-correction=no
async=yes
async=500
audio-threads=8
audio-threads=4
audio-pitch-correction=yes
vf=setpts=PTS/1
# 日本語
sub-lang=jpn,ja,jp,japanese,JA,JP,JPN,Japanese
sub-auto=no
audio-lang=jpn,ja,jp,japanese,JA,JP,JPN,Japanese
alang=jpn,ja,jp,japanese,JA,JP,JPN,Japanese
alang=ja,jp,jpn,japanese
slang=ja,jp,jpn,japanese
no-subtitles=no-japanese
no-audio=no-japanese
sub-forced-only=yes
# ------------------------------------------------
# test with hardware acceleration
ad=lavc:hwaccel=auto # faster audio decoding
vd=lavc:hwaccel=auto # video
vd-threads=32
cache-default=512
cache-initial=256
cache-seek=yes
cache-min=256
# increase volumn
script-opts=increase-volum.lua
# less bass
af=scaletempo=f=20:b=1.1,l=1.2 # Reduce bass, boost treble
af=add=haas # Enhance stereo imaging
af=lavcac # Apply loudness compensation
eq-pre=f=50:gw=1:b=-5 # Reduce low rumble
eq-pre=f=200:gw=1:b=-3 # Reduce mid-bass
eq-pre=f=4000:gw=1:b=1 # Boost high-mids
eq-pre=f=8000:gw=1:b=2 # Boost treble
# ---------------------------------------
fallback-sub-folder=/home/hashirama/Downloads/bleach/subs/
speed=1.0

204
.config/mpv/mpv.conf~ Normal file
View File

@ -0,0 +1,204 @@
# screenshot
screenshot-template="%f_%p"
screenshot-compression=1..10
screenshot-compression-level=10
screenshot-format=png
screenshot-high-bit-depth=yes
screenshot-png-compression=10 # this requires a lot of cpu
screenshot-directory=/mnt/Data/mpv-screenshots/
input-cursor=no
# then we gonna need this:
# Keybinding to cycle through available audio dubs
ALT+a cycle audio
# Keybinding to cycle through available subtitles
ALT+s cycle sub
# youtube
ytdl-format=bestvideo[height<=?720p]+bestaudio/best
#####
#framedrop=yes
#display-fps=20
#fps=20
#vf-add=fps=20:round=near
#
#sub-ass-styles='{\\pos(640,10)}'
Z add sub-delay +0.05
z add sub-delay -0.05
D add sub-delay -8900
gpu-api=vulkan
# Set cache to avoid lag
cache=yes
# Limit the amount of data demuxed (read from the file) ahead of playback
demuxer-max-bytes=700M
# shaders
#glsl-shader=~~/shaders/Anime4K_Deblur_Original.glsl
#glsl-shader=~~/shaders/ravu-r4.hook
# Set the desired window size
window-scale=2.0
# Force video to upscale to at least 2k
#vf=scale=w=2880:h=1620:flags=lanczos
# Set the desired window size (optional, adjust as needed)
geometry=2880x1620
# Enable video upscaling
#scale=ewa_lanczos
# Enable higher quality scaling when upscaling
#cscale=ewa_lanczos
# audio
# audio normalization
#af=lavfi=[dynaudnorm=f=75:g=25:p=0.55]
#lavfi=[loudnorm=I=-22:TP=-1.5:LRA=2]
# BGR
sub-font="Calex Code JP"
sub-antialiasing=yes
sub-text-outline=0.5
sub-font-size=35
sub-border-size=1.5
sub-color="#ffffff"
sub-border-color="#000000"
sub-align-y=24
sub-ass-override=force
sub-ass-force-style=FontName='Calex Code JP',FontSize=48,Outline=0.25,PrimaryColour=&H00FFFFFF&,OutlineColour=&H00000000&
#
cache-size=700000
cache-initial=20000
cache-pause=yes
demuxer-max-bytes=200000KiB
demuxer-readahead-secs=30
cache-backend=time
cache-time=300
cache=yes
cache-default=yes
#cache-seek-min=100
#cache-seek-max=1000
#cache-backbuffer=300
cache-size=1G!
cache-initial=50M
cache-min=20M
cache-seek-min=yes
cache-backend=yes
hwdec-codecs=all
vd-lavc-threads=32 # Adjust the number of threads based on your CPU
ad-lavc-threads=32
#framedrop=yes
# im a bit drowsy when the frame gets high
vf=framestep=4
# Frame skipping
framedrop=vo
# Display resample
video-sync=display-resample
# Adjust brightness and contrast
brightness=-10
contrast=-10
# Enable V-Sync
vsync=yes
# Enable interpolation
interpolation=yes
tscale=oversample
# Force 50 Hz refresh rate
refresh=50
# Enable audio buffering
audio-buffer=1000ms
# dont tie audio to video fps
no-sync=yes
audio-speed=1.0
async=yes
audio-threads=4
audio-pitch-correction=yes
vf=setpts=PTS/1
# 日本語
sub-lang=jpn,ja,jp,japanese,JA,JP,JPN,Japanese
sub-auto=no
audio-lang=jpn,ja,jp,japanese,JA,JP,JPN,Japanese
alang=jpn,ja,jp,japanese,JA,JP,JPN,Japanese
alang=ja,jp,jpn,japanese
slang=ja,jp,jpn,japanese
no-subtitles=no-japanese
no-audio=no-japanese
sub-forced-only=yes
# ------------------------------------------------
# test with hardware acceleration
ad=lavc:hwaccel=auto # faster audio decoding
vd=lavc:hwaccel=auto # video
vd-threads=32
cache-default=512
cache-initial=256
cache-seek=yes
cache-min=256
# increase volumn
script-opts=increase-volum.lua
# less bass
af=scaletempo=f=20:b=1.1,l=1.2 # Reduce bass, boost treble
af=add=haas # Enhance stereo imaging
af=lavcac # Apply loudness compensation
eq-pre=f=50:gw=1:b=-5 # Reduce low rumble
eq-pre=f=200:gw=1:b=-3 # Reduce mid-bass
eq-pre=f=4000:gw=1:b=1 # Boost high-mids
eq-pre=f=8000:gw=1:b=2 # Boost treble
# ---------------------------------------
fallback-sub-folder=/home/hashirama/Downloads/bleach/subs/

1490
.config/mpv/mpvHistory.log Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,299 @@
######----Settings For SimpleHistory 1.1.5----######
####------Script Settings-----####
#--Auto run the list when opening mpv and there is no video / file loaded. 'none' for disabled. Or choose between: all, recents, distinct, protocols, fileonly, titleonly, timeonly, keywords.
auto_run_list_idle=recents
#--The behavior when mpv launches and nothing is loaded. 'none' for disabled. 'resume' to automatically resume your last played item. 'resume-notime' to resume your last played item but starts from the beginning.
startup_idle_behavior=resume
#--hides OSC idle screen message when opening and closing menu (could cause unexpected behavior if multiple scripts are triggering osc-idlescreen off)
toggle_idlescreen=no
#--change to 0 so item resumes from the exact position, or decrease the value so that it gives you a little preview before loading the resume point
resume_offset=-0.65
#--yes is for displaying osd messages when actions occur. Change to no will disable all osd messages generated from this script
osd_messages=yes
#--none: for disabled. notification: a message to resume the previous reached time will be triggered. force: to forcefully resume last playback based on threshold
resume_option=notification
#--0 to always trigger the resume option when the same video has been played previously, a value such as 5 will only trigger the resume option if the last played time starts after 5% of the video and ends before completion by 5%
resume_option_threshold=2
#--yes is for marking the time as a chapter. no disables mark as chapter behavior.
mark_history_as_chapter=no
#--yes so that blacklist becomes a whitelist, resulting in stuff such as paths / websites that are added to history_blacklist to be saved into history
invert_history_blacklist=no
#--Paths / URLs / Websites / Files / Protocols / Extensions, that wont be added to history automatically, e.g.: ["c:\\users\\eisa01\\desktop", "c:\\users\\eisa01\\desktop\\*", "c:\\temp\\naruto-01.mp4", "youtube.com", "https://dailymotion.com/", "avi", "https://www.youtube.com/watch?v=e8YBesRKq_U", ".jpeg", "magnet:", "https://", "ftp"]
history_blacklist=[""]
#--Keybind that will be used to immediately load and resume last item when no video is playing. If video is playing it will resume to the last found position
history_resume_keybind=["ctrl+r", "ctrl+R"]
#--Keybind that will be used to immediately load the last item without resuming when no video is playing. If video is playing then it will add into playlist
history_load_last_keybind=["alt+r", "alt+R"]
#--Keybind that will be used to open the list along with the specified filter. Available filters: "all", "recents", "distinct", "protocols", "fileonly", "titleonly", "timeonly", "keywords".
open_list_keybind=[ ["h", "all"], ["H", "all"], ["r", "recents"], ["R", "recents"] ]
#--Keybind that is used while the list is open to jump to the specific filter (it also enables pressing a filter keybind twice to close list). Available filters: "all", "recents", "distinct", "protocols", "fileonly", "titleonly", "timeonly", "keywords".
list_filter_jump_keybind=[ ["h", "all"], ["H", "all"], ["r", "recents"], ["R", "recents"], ["d", "distinct"], ["D", "distinct"], ["f", "fileonly"], ["F", "fileonly"] ]
####------Incognito Settings-----####
#--yes to automatically start incognito mode when mpv launches, no disables this behavior
auto_run_incognito_mode=no
#--yes so that the file that had incognito mode triggered on gets removed from history automatically, no keeps the file in history that incognito mode triggered on
delete_incognito_entry=yes
#--"none" for disabled, "deleted-restore" so that the the file that was removed when entering incognito automtically gets restored, "always" so that exiting incognito_mode always immediately updates entry into history
restore_incognito_entry=always
#--Triggers incognito mode. When enabled files played wont be added to history until this mode is disabled.
history_incognito_mode_keybind=["ctrl+H"]
####------Logging Settings------####
#--Change to "/:dir%script%" for placing it in the same directory of script, OR change to "/:dir%mpvconf%" for mpv portable_config directory. OR write any variable using "/:var" then the variable "/:var%APPDATA%" you can use path also, such as: "/:var%APPDATA%\mpv" OR "/:var%HOME%/mpv" OR specify the absolute path , e.g.: 'C:\Users\Eisa01\Desktop\'
log_path=/:dir%mpvconf%
#--name+extension of the file that will be used to store the log data
log_file=mpvHistory.log
#--Date format in the log (see lua date formatting), e.g.:"%d/%m/%y %X" or "%d/%b/%y %X"
date_format=%A/%B %d/%m/%Y %X
#--Change between all, protocols, none. This option will store the media title in log file, it is useful for websites / protocols because title cannot be parsed from links alone
file_title_logging=protocols
#--add below (after a comma) any protocol you want its title to be stored in the log file. This is valid only for (file_title_logging = "protocols" or file_title_logging = "all")
logging_protocols=["https?://", "magnet:", "rtmp:"]
#--Prefers to use filename over filetitle. Select between local, protocols, all, and none. "local" prefer filenames for videos that are not protocols. "protocols" will prefer filenames for protocols only. "all" will prefer filename over filetitle for both protocols and not protocols videos. "none" will always use filetitle instead of filename
prefer_filename_over_title=local
#--Limit saving entries with same path: -1 for unlimited, 0 will always update entries of same path, e.g. value of 3 will have the limit of 3 then it will start updating old values on the 4th entry.
same_entry_limit=2
####------List Settings-------####
#--yes is for going up on the first item loops towards the last item and vise-versa. no disables this behavior.
loop_through_list=no
#--no is for more items to show, then u must reach the end. yes is for new items to show after reaching the middle of list.
list_middle_loader=yes
#--Show file paths instead of media-title
show_paths=no
#--Show the number of each item before displaying its name and values.
show_item_number=yes
#--Change to yes or no. Slices long filenames per the amount specified below
slice_longfilenames=no
#--Amount for slicing long filenames
slice_longfilenames_amount=55
#--Change maximum number to show items at once
list_show_amount=15
#--Keybind entries from 0 to 9 for quick selection when list is open (list_show_amount = 10 is maximum for this feature to work)
quickselect_0to9_keybind=yes
#--Will exit the list when double tapping the main list, even if the list was accessed through a different filter.
main_list_keybind_twice_exits=yes
#--To smartly set the search as not typing (when search box is open) without needing to press ctrl+enter.
search_not_typing_smartly=yes
#--"specific" to find a match of either a date, title, path / url, time. "any" to find any typed search based on combination of date, title, path / url, and time. "any-notime" to find any typed search based on combination of date, title, and path / url, but without looking for time (this is to reduce unwanted results).
search_behavior=any
####------Filter Settings-------####
##--available filters: "all" to display all the items. Or "recents" to display recently added items to log without duplicate. Or "distinct" to show recent saved entries for files in different paths. Or "fileonly" to display files saved without time. Or "timeonly" to display files that have time only. Or "keywords" to display files with matching keywords specified in the configuration. Or "playing" to show list of current playing file.
#--Jump to the following filters and in the shown sequence when navigating via left and right keys. You can change the sequence and delete filters that are not needed.
filters_and_sequence=["all", "recents", "distinct", "protocols", "playing", "fileonly", "titleonly", "keywords"]
#--Keybind that will be used to go to the next available filter based on the filters_and_sequence
next_filter_sequence_keybind=["RIGHT", "MBTN_FORWARD"]
#--Keybind that will be used to go to the previous available filter based on the filters_and_sequence
previous_filter_sequence_keybind=["LEFT", "MBTN_BACK"]
#--yes is for bypassing the last filter to go to first filter when navigating through filters using arrow keys, and vice-versa. no disables this behavior.
loop_through_filters=yes
#--Create a filter out of your desired "keywords", e.g.: youtube.com will filter out the videos from youtube. You can also insert a portion of filename or title, or extension or a full path / portion of a path. e.g.: ["youtube.com", "mp4", "naruto", "c:\\users\\eisa01\\desktop"]
keywords_filter_list=[""]
####------Sort Settings-------####
##--available sort: added-asc is for the newest added item to show first. Or added-desc for the newest added to show last. Or alphanum-asc is for A to Z approach with filename and episode number lower first. Or alphanum-desc is for its Z to A approach. Or time-asc, time-desc to sort the list based on time.
#--the default sorting method for all the different filters in the list. select between: added-asc, added-desc, time-asc, time-desc, alphanum-asc, alphanum-desc
list_default_sort=added-asc
#--Default sort for specific filters, e.g.: [ ["all", "alphanum-asc"], ["playing", "added-desc"] ]
list_filters_sort=[ ]
#--Keybind to cycle through the different available sorts when list is open
list_cycle_sort_keybind=["alt+s", "alt+S"]
####------List Design Settings------####
#--The alignment for the list, uses numpad positions choose from 1-9 or 0 to disable. e,g.:7 top left alignment, 8 top middle alignment, 9 top right alignment.
list_alignment=7
#--The time type for items on the list. Select between: duration, length, remaining.
text_time_type=duration
#--Time seperator that will be used before the saved time
time_seperator= 🕒
#--The text that indicates there are more items above. \N is for new line. \h is for hard space.
list_sliced_prefix=...\h\N\N
#--The text that indicates there are more items below
list_sliced_suffix=...
#--yes enables pre text for showing quickselect keybinds before the list. no to disable
quickselect_0to9_pre_text=no
#--Text color for list in BGR hexadecimal
text_color=ffffff
#--Font size for the text of list
text_scale=50
#--Black border size for the text of list
text_border=0.7
#--Text color of current cursor position in BGR
text_cursor_color=ffbf7f
#--Font size for text of current cursor position in list
text_cursor_scale=50
#--Black border size for text of current cursor position in list
text_cursor_border=0.7
#--Pre text for highlighted multi-select item
text_highlight_pre_text=✅
#--Search color when in typing mode
search_color_typing=ffffaa
#--Search color when not in typing mode and it is active
search_color_not_typing=00bfff
#--Header color in BGR hexadecimal
header_color=00bfff
#--Header text size for the list
header_scale=55
#--Black border size for the Header of list
header_border=0.8
#--Text to be shown as header for the list
#--Available header variables: %cursor%, %total%, %highlight%, %filter%, %search%, %listduration%, %listlength%, %listremaining%
#--User defined text that only displays if a variable is triggered: %prefilter%, %afterfilter%, %prehighlight%, %afterhighlight% %presearch%, %aftersearch%, %prelistduration%, %afterlistduration%, %prelistlength%, %afterlistlength%, %prelistremaining%, %afterlistremaining%
#--Variables explanation: %cursor: displays the number of cursor position in list. %total: total amount of items in current list. %highlight%: total number of highlighted items. %filter: shows the filter name, %search: shows the typed search. Example of user defined text that only displays if a variable is triggered of user: %prefilter: user defined text before showing filter, %afterfilter: user defined text after showing filter.
header_text=⌛ History [%cursor%/%total%]%prehighlight%%highlight%%afterhighlight%%prelistduration%%listduration%%afterlistduration%%prefilter%%filter%%afterfilter%%presort%%sort%%aftersort%%presearch%%search%%aftersearch%
#--Sort method that is hidden from header when using %sort% variable
header_sort_hide_text=added-asc
#--Text to be shown before or after triggered variable in the header
header_sort_pre_text= \{
header_sort_after_text=}
header_filter_pre_text= [Filter:
header_filter_after_text=]
header_search_pre_text=\h\N\N[Search=
header_search_after_text=..]
header_highlight_pre_text=✅
header_highlight_after_text=
header_list_duration_pre_text= 🕒
header_list_duration_after_text=
header_list_length_pre_text= 🕒
header_list_length_after_text=
header_list_remaining_pre_text= 🕒
header_list_remaining_after_text=
####-----Time Format Settings-----####
##--in the first parameter, you can define from the available styles: default, hms, hms-full, timestamp, timestamp-concise "default" to show in HH:MM:SS.sss format. "hms" to show in 1h 2m 3.4s format. "hms-full" is the same as hms but keeps the hours and minutes persistent when they are 0. "timestamp" to show the total time as timestamp 123456.700 format. "timestamp-concise" shows the total time in 123456.7 format (shows and hides decimals depending on availability).
##--in the second parameter, you can define whether to show milliseconds, round them or truncate them. Available options: 'truncate' to remove the milliseconds and keep the seconds. 0 to remove the milliseconds and round the seconds. 1 or above is the amount of milliseconds to display. The default value is 3 milliseconds.
##--in the third parameter you can define the seperator between hour:minute:second. "default" style is automatically set to ":", "hms", "hms-full" are automatically set to " ". You can define your own. Some examples: ["default", 3, "-"],["hms-full", 5, "."],["hms", "truncate", ":"],["timestamp-concise"],["timestamp", 0],["timestamp", "truncate"],["timestamp", 5]
osd_time_format=["default", "truncate"]
list_time_format=["default", "truncate"]
header_duration_time_format=["hms", "truncate", ":"]
header_length_time_format=["hms", "truncate", ":"]
header_remaining_time_format=["hms", "truncate", ":"]
####------List Keybind Settings------####
#--Add below (after a comma) any additional keybind you want to bind. Or change the letter inside the quotes to change the keybind
#--Example of changing and adding keybinds: --From ["b", "B"] To ["b"]. --From [""] to ["alt+b"]. --From [""] to ["a" "ctrl+a", "alt+a"]
#--Keybind that will be used to navigate up on the list
list_move_up_keybind=["UP", "WHEEL_UP"]
#--Keybind that will be used to navigate down on the list
list_move_down_keybind=["DOWN", "WHEEL_DOWN"]
#--Keybind that will be used to go to the first item for the page shown on the list
list_page_up_keybind=["PGUP"]
#--Keybind that will be used to go to the last item for the page shown on the list
list_page_down_keybind=["PGDWN"]
#--Keybind that will be used to navigate to the first item on the list
list_move_first_keybind=["HOME"]
#--Keybind that will be used to navigate to the last item on the list
list_move_last_keybind=["END"]
#--Keybind that will be used to highlight while pressing a navigational keybind, keep holding shift and then press any navigation keybind, such as: up, down, home, pgdwn, etc..
list_highlight_move_keybind=["SHIFT"]
#--Keybind that will be used to highlight all displayed items on the list
list_highlight_all_keybind=["ctrl+a", "ctrl+A"]
#--Keybind that will be used to remove all currently highlighted items from the list
list_unhighlight_all_keybind=["ctrl+d", "ctrl+D"]
#--Keybind that will be used to load entry based on cursor position
list_select_keybind=["ENTER", "MBTN_MID"]
#--Keybind that will be used to add entry to playlist based on cursor position
list_add_playlist_keybind=["CTRL+ENTER"]
#--Keybind that will be used to add all highlighted entries to playlist
list_add_playlist_highlighted_keybind=["SHIFT+ENTER"]
#--Keybind that will be used to close the list (closes search first if it is open)
list_close_keybind=["ESC", "MBTN_RIGHT"]
#--Keybind that will be used to delete the entry based on cursor position
list_delete_keybind=["DEL"]
#--Keybind that will be used to delete all highlighted entries from the list
list_delete_highlighted_keybind=["SHIFT+DEL"]
#--Keybind that will be used to trigger search
list_search_activate_keybind=["ctrl+f", "ctrl+F"]
#--Keybind that will be used to exit typing mode of search while keeping search open
list_search_not_typing_mode_keybind=["ALT+ENTER"]
#--Keybind thats are ignored when list is open
list_ignored_keybind=["B", "b", "k", "K", "c", "C"]
######----End of Settings----######

View File

@ -0,0 +1,271 @@
###
### Main mpvacious configuration file.
### Save this file to ~/.config/mpv/script-opts/subs2srs.conf
###
##
## General settings
##
# Anki deck for new cards. Subdecks are supported.
deck_name=Mining
# Model names are listed in `Tools -> Manage note types` menu in Anki.
# If you don't have a model for Japanese, get it from
# https://tatsumoto.neocities.org/blog/setting-up-anki.html#import-an-example-mining-deck
model_name=Japanese sentences
# Field names as they appear in the selected note type.
# If you set `audio_field` or `image_field` empty,
# the corresponding media file will not be created.
sentence_field=SentKanji
secondary_field=SentEng
audio_field=SentAudio
image_field=Image
# The tag(s) added to new notes. Spaces separate multiple tags.
# Leave nothing after `=` to disable tagging completely.
# The following substitutions are supported:
# %n - the name of the video
# %t - timestamp
# %d - episode number (if none, returns nothing)
# %e - SUBS2SRS_TAGS environment variable (if you have it set)
note_tag=subs2srs
#note_tag=%n %t %e
#note_tag=
# Size and name of the font used in the menu
menu_font_size=24
menu_font_name=Noto Serif CJK JP
##
## Toggleables.
## Possible values: `yes` or `no`.
##
# Use FFmpeg encoder instead of mpv encoder
# If mpvacious encounters problems creating audio and images for Anki cards,
# setting this to `yes` should fix them.
#
# You need to install ffmpeg and add it to the PATH first.
# https://wiki.archlinux.org/title/FFmpeg
# https://www.ffmpeg.org/download.html
#
# FFmpeg encoder is unable to create audio and images from remote content (like YouTube videos).
use_ffmpeg=no
# Automatically create the deck for new cards (see deck_name option)
create_deck=yes
# Allow making notes with the same sentence field.
allow_duplicates=no
# When mpv starts, automatically copy subs to the clipboard as they appear on screen.
# This option can be also toggled in the addon's OSD menu.
autoclip=yes
# Command to run when autoclip is triggered.
# If empty, just copies text to the clipboard.
# If set, calls the external program.
# E.g., even though GoldenDict can watch the system clipboard,
# if you send subtitles directly to GoldenDict, you don't pollute the clipboard as much.
autoclip_command=goldendict
#autoclip_command=goldendict
# Remove all spaces from the primary subtitle text.
# Set this to "yes" for languages without spaces like Japanese.
# However, if mpvacious detects any latin characters in the string, spaces will not be removed.
nuke_spaces=yes
# if set to `yes`, the volume of the outputted audio file
# depends on the volume of the player at the time of export
tie_volumes=no
# Remove text in parentheses and leading/trailing spaces or
# newlines that may interfere with Yomichan before copying
# subtitles to the clipboard
clipboard_trim_enabled=yes
# Add media to fields before or after existing data
append_media=yes
# Remove text in brackets before substituting %n into tag
tag_nuke_brackets=yes
# Remove text in brackets before substituting %n into tag
tag_nuke_parentheses=no
# Remove the episode number before substituting %n into tag
tag_del_episode_num=yes
# Remove everything after the episode number before substituting %n into tag
# Does nothing if the previous option tag_del_episode_num is disabled.
tag_del_after_episode_num=yes
# Convert filename to lowercase for tagging.
tag_filename_lowercase=no
# Lets you disable anki browser manipulation by mpvacious.
disable_gui_browse=no
# Play audio clip automatically in background
# after note creation (or note update) to ensure that the audio is correctly cut.
preview_audio=no
# When selecting subtitle lines, print them on the screen.
show_selected_text=yes
# For convenience, read config file from disk before a card is made.
# Useful if you change your config often since you won't have to restart mpv every time,
# but reading from disk takes some time.
reload_config_before_card_creation=yes
##
## Image settings
##
# Snapshot format.
# Do not switch to `jpg` unless your computer doesn't support `webp`.
snapshot_format=webp
#snapshot_format=jpg
# Quality of produced image files. 0 = lowest, 100=highest.
snapshot_quality=15
# Image dimensions
# If either (but not both) of the width or height parameters is -2,
# the value will be calculated preserving the aspect-ratio.
snapshot_width=-2
snapshot_height=200
# Screenshot (yes, no)
# Usually not required.
# When making Anki cards, create a screenshot (by calling 'screenshot-to-file') instead of a snapshot.
# If set to yes, image dimensions and quality cannot be controlled due to mpv limitations.
# 'snapshot_format' is still respected.
# When using this, a custom sync server is recommended, e.g. https://github.com/ankicommunity/anki-sync-server
screenshot=no
# The exact image template used when exporting to Anki's image field.
# Adding data-editor-shrink="true" makes the image smaller by default within the Anki viewer
# on versions 2.1.53+ (equivalent of double-clicking on the image).
# You likely would not want to change this unless you know what you are doing.
image_template=<img alt="snapshot" src="%s">
#image_template=<img alt="snapshot" data-editor-shrink="true" src="%s">
# Similar to image_template but with audio.
# Normally, the user doesn't need to change this setting,
# but it may be needed for audio files to be playable on AnkiWeb.
audio_template=[sound:%s]
#audio_template=<audio controls="" src="%s"></audio>
##
## Animated snapshots
## Animated snapshots will capture the video from the start to the end times selected when using mpvacious.
##
# If enabled, generates animated snapshots (something like GIFs) instead of static snapshots.
animated_snapshot_enabled=no
# Number of frame per seconds, a value between 0 and 30 (30 included)
# Higher values will increase both quality and file size, lower values will do the opposite
animated_snapshot_fps=10
# Animated snapshot dimensions
# If either (but not both) of the width or height parameters is -2,
# the value will be calculated preserving the aspect-ratio.
animated_snapshot_width=-2
animated_snapshot_height=200
# Quality of the produced animation, 0 = lowest, 100 = highest
animated_snapshot_quality=5
##
## Audio settings
##
# Audio format.
# Do not switch to `mp3` unless your computer doesn't support `opus`.
audio_format=opus
#audio_format=mp3
# Sane values are 16k-32k for opus, 64k-128k for mp3.
audio_bitrate=20k
# Set a pad to the dialog timings. 0.5 = half a second.
# Pads are never applied to manually set timings.
audio_padding=0.0
#audio_padding=0.5
##
## Forvo support (Yomichan users only)
##
# yes - fetch audio from Forvo if Yomichan couldn't find the audio (default)
# always - always fetch audio from Forvo and replace the audio added by Yomichan
# no - never use Forvo
use_forvo=yes
# Vocab field should be equal to {expression} field in Yomichan
vocab_field=VocabKanji
# Vocab Audio field should be equal to {audio} field in Yomichan
vocab_audio_field=VocabAudio
##
## Misc info
## Various context information that can be written on your cards in a specified field.
##
# yes to enable or no to disable.
miscinfo_enable=yes
# Field name
miscinfo_field=Notes
# Format string used to fill the misc info field.
# It supports the same substitutions as `note_tag`. HTML is supported.
miscinfo_format=%n EP%d (%t)
#miscinfo_format=From <b>mpvacious</b> %n at %t.
##
## Secondary subtitles
## Mpvacious can try automatically loading secondary subtitles that will appear at the top.
## For example, you may want to load English subs alongside Japanese subs.
##
## Secondary subtitles should be present in the container.
## But if you manually set secondary sid from the command line, mpvacious won't change it.
##
# Language of secondary subs.
# If you leave this parameter empty, no secondary subs will be automatically loaded.
secondary_sub_lang=eng,en,rus,ru,bel,be
#secondary_sub_lang=
# Hover area.
# Proportion of the top part of the mpv window where the secondary subtitles are visible when hovered over.
# Possible values: from 0.0 to 1.0
secondary_sub_area=0.15
# Visibility state
# Can be set to: 'auto', 'never', 'always'.
# If set to 'never' or 'always', secondary_sub_area has no effect.
# If set to 'auto', visibility behaves according to the value of secondary_sub_area.
# Default binding to cycle this value: Ctrl+v.
secondary_sub_visibility=auto
##
## Custom audio encoding arguments
## These arguments are added to the command line.
## `mpv` and `ffmpeg` accept slightly different parameters.
## Feel free to experiment for yourself, but be careful or media creation might stop working.
##
# Ffmpeg
ffmpeg_audio_args=-af loudnorm=I=-16:TP=-1.5:LRA=11
#ffmpeg_audio_args=-af silenceremove=1:0:-50dB
# mpv
# mpv accepts each filter as a separate argument, e.g. --af-append=1 --af-append=2
mpv_audio_args=--af-append=loudnorm=I=-16:TP=-1.5:LRA=11
#mpv_audio_args=--af-append=silenceremove=1:0:-50dB

View File

@ -0,0 +1,40 @@
# Absolute paths to the folders where generated clips will be placed.
# `~` or `$HOME` are not supported due to mpv limitations.
video_folder_path=/mnt/Zonai/Videos
# Menu size
font_size=16
# Clean filenames (remove special characters) (yes or no)
clean_filename=yes
# Video settings
video_width=-2
video_height=480
video_bitrate=1M
# Available video formats: mp4, vp9, vp8
video_format=mp4
# The range of the scale is 51, where 0 is lossless,
# 23 is the default, and 51 is worst quality possible.
# Insane values like 9999 still work but produce the worst quality.
video_quality=20
# Use the slowest preset that you have patience for.
# https://trac.ffmpeg.org/wiki/Encode/H.264
preset=faster
# FPS / framerate. Set to "auto" or a number.
video_fps=auto
#video_fps=60
# Audio settings
# Available formats: opus or aac
audio_format=opus
# Opus sounds good at low bitrates 32-64k, but aac requires 128-256k.
audio_bitrate=256k
# Catbox.moe upload settings
# Whether uploads should go to litterbox instead of catbox.
# catbox files are stored permanently, while litterbox is temporary
litterbox=yes
# If using litterbox, time until video expires
# Available values: 1h, 12h, 24h, 72h
litterbox_expire=72h0

View File

@ -0,0 +1,40 @@
# Absolute paths to the folders where generated clips will be placed.
# `~` or `$HOME` are not supported due to mpv limitations.
video_folder_path=/mnt/Zonai/Videos
# Menu size
font_size=20
# Clean filenames (remove special characters) (yes or no)
clean_filename=yes
# Video settings
video_width=-2
video_height=480
video_bitrate=1M
# Available video formats: mp4, vp9, vp8
video_format=mp4
# The range of the scale is 51, where 0 is lossless,
# 23 is the default, and 51 is worst quality possible.
# Insane values like 9999 still work but produce the worst quality.
video_quality=20
# Use the slowest preset that you have patience for.
# https://trac.ffmpeg.org/wiki/Encode/H.264
preset=faster
# FPS / framerate. Set to "auto" or a number.
video_fps=auto
#video_fps=60
# Audio settings
# Available formats: opus or aac
audio_format=opus
# Opus sounds good at low bitrates 32-64k, but aac requires 128-256k.
audio_bitrate=256k
# Catbox.moe upload settings
# Whether uploads should go to litterbox instead of catbox.
# catbox files are stored permanently, while litterbox is temporary
litterbox=yes
# If using litterbox, time until video expires
# Available values: 1h, 12h, 24h, 72h
litterbox_expire=72h0

View File

@ -0,0 +1,59 @@
local api = "alsa"
local deviceList = mp.get_property_native("audio-device-list")
local aid = 1
local function cycle_adevice(s, e, d)
mp.enable_messages("error")
while s ~= e + d do -- until the loop would cycle back to the number we started on
if string.find(mp.get_property("audio-device"), deviceList[s].name, 1, true) then
while true do
if s + d == 0 then --the device list starts at 1; 0 means we iterated to far
s = #deviceList + 1 --so lets restart at the last device
elseif s + d == #deviceList + 1 then --we iterated past the last device
s = 0 --then start from the beginning
end
s = s + d --next device
if string.find(deviceList[s].name, api, 1, true) then
mp.set_property("audio-device", deviceList[s].name)
deviceList[s]." .. string.match(deviceList[s].description, "[^%(]+")
local list = "AUDIO DEVICE:\n"
for i = 1, #deviceList do
if string.find(deviceList[i].name, api, 1, true) then
if deviceList[i].name ~= deviceList[s].name then list = " end
list = list .. string.match(deviceList[i].description, "[^%(]+") .. "\n"
end
end
if mp.get_property("vid") == "no" then
print("audio=" .. deviceList[s].description)
else
mp.osd_message(list, 3)
end
mp.set_property("aid", aid)
mp.command("seek 0 exact")
return
end
end
end
s = s + d
end
end
mp.observe_property("aid", function(id)
if id ~= "no" then aid = id end
end)
mp.register_event("log-message", function(event)
if event.text:find("Try unsetting it") then
mp.set_property("audio-device", "auto")
mp.set_property("aid", aid)
end
end)
mp.add_key_binding("A", "cycle_adevice", function()
deviceList = mp.get_property_native("audio-device-list")
cycle_adevice(1, #deviceList, 1) --'s'tart at device 1, 'e'nd at last device, iterate forward 'd'elta=1
end)
mp.add_key_binding("Ctrl+a", "cycleBack_adevice", function()
deviceList = mp.get_property_native("audio-device-list")
cycle_adevice(#deviceList, 1, -1) --'s'tart at last device, 'e'nd at device 1, iterate backward 'd'elta=-1
end)list .. "description = "

View File

@ -0,0 +1,46 @@
local api = ""
local deviceList = {}
local function cycle_adevice(s, e, d)
while s ~= e + d do -- until the loop would cycle back to the number we started on
if string.find(mp.get_property("audio-device"), deviceList[s].name, 1, true) then
while true do
if s + d == 0 then --the device list starts at 1; 0 means we iterated to far
s = #deviceList + 1 --so lets restart at the last device
elseif s + d == #deviceList + 1 then --we iterated past the last device
s = 0 --then start from the beginning
end
s = s + d --next device
if string.find(deviceList[s].name, api, 1, true) then
mp.set_property("audio-device",deviceList[s].name)
deviceList[s].description = ""..deviceList[s].description
local list = "AUDIO DEVICE:\n"
for i=1,#deviceList do
if string.find(deviceList[i].name, api, 1, true) then
if deviceList[i].name~=deviceList[s].name then list = list.."" end
list=list..deviceList[i].description.."\n"
end
end
if mp.get_property("vid")=="no" then
print("audio="..deviceList[s].description)
else
mp.osd_message(list, 3)
end
return
end
end
end
s = s + d
end
end
local function cycle_back()
deviceList = mp.get_property_native("audio-device-list")
cycle_adevice(#deviceList, 1, -1) --'s'tart at last device, 'e'nd at device 1, iterate backward 'd'elta=-1
end
local function cycle_forward()
deviceList = mp.get_property_native("audio-device-list")
cycle_adevice(1, #deviceList, 1) --'s'tart at device 1, 'e'nd at last device, iterate forward 'd'elta=1
end
mp.add_key_binding("A", "cycle_adevice", cycle_forward)
mp.add_key_binding("Ctrl+a", "cycleBack_adevice", cycle_back)

View File

@ -0,0 +1,60 @@
local preferred_alangs = {"jpn", "ja", "japanese"}
local preferred_slangs = {"jpn", "ja", "japanese"}
local phrases = {
"日本語オンリーで行こう!英語なんて大嫌い!",
"これで完全に日本語モードです!",
"やったね!日本語が優先されました!",
"日本語が一番!英語は嫌いだ!",
"今、完全に日本語です!英語はなし!"
}
function select_tracks()
local tracks = mp.get_property_native("track-list")
-- Disable all subtitles at the beginning
for _, track in ipairs(tracks) do
if track.type == "sub" then
mp.set_property("sid", "no", track.id)
end
end
local japanese_subtitle_tracks = {}
-- Enable Japanese subtitles if available
for _, track in ipairs(tracks) do
if track.type == "sub" and table.contains(preferred_slangs, track.lang) then
table.insert(japanese_subtitle_tracks, track.id)
end
end
if #japanese_subtitle_tracks > 0 then
mp.set_property("sid", japanese_subtitle_tracks[1])
end
-- Add a delay to ensure the tracks are loaded before displaying the phrase
mp.add_timeout(5, function()
show_phrase()
end)
end
function table.contains(table, value)
for _, v in ipairs(table) do
if v == value then
return true
end
end
return false
end
function show_phrase()
local phrase = phrases[math.random(#phrases)]
mp.osd_message(phrase, 2000)
end
mp.register_event("file-loaded", select_tracks)
-- Ensure the phrase shows up when MPV is not in idle mode
if not mp.get_property_native("idle") then
select_tracks()
end

View File

@ -0,0 +1,6 @@
mp.register_event("start-file", function()
mp.set_property("af", "volume=10")
mp.command("af-clear")
mp.command("af-add=volume=10:force")
mp.command("af-add=volume=10:force")
end)

View File

@ -0,0 +1,3 @@
-- volume.lua
mp.set_property("af-add", "volume=10", "force")

View File

@ -0,0 +1,88 @@
-- half_to_full_katakana.lua
-- Convert half-width Katakana to full-width Katakana
local function half_to_full_katakana(text)
print("Debug: Converting half-width Katakana to full-width Katakana...")
local result = ""
local dakuten = false
for char in utf8.gmatch(text, ".") do
local codepoint = utf8.codepoint(char)
if codepoint == 0x3099 then -- Dakuten marker
dakuten = true
print("Debug: Found dakuten marker")
elseif codepoint >= 0xFF61 and codepoint <= 0xFF9F then -- Half-width Katakana
if dakuten then
-- Convert half-width Katakana with dakuten to full-width
if codepoint == 0xFF8A then -- ハ
result = result.. utf8.char(0x30CA) -- バ
print("Debug: Converted ハ to バ")
elseif codepoint == 0xFF77 then -- き
result = result.. utf8.char(0x30B0) -- ギ
print("Debug: Converted き to ギ")
elseif codepoint == 0xFF78 then -- く
result = result.. utf8.char(0x30B1) -- グ
print("Debug: Converted く to グ")
elseif codepoint == 0xFF7C then -- し
result = result.. utf8.char(0x30B5) -- ジ
print("Debug: Converted し to ジ")
elseif codepoint == 0xFF7D then -- す
result = result.. utf8.char(0x30B6) -- ズ
print("Debug: Converted す to ズ")
elseif codepoint == 0xFF81 then -- ち
result = result.. utf8.char(0x30C1) -- チ
print("Debug: Converted ち to チ")
elseif codepoint == 0xFF82 then -- つ
result = result.. utf8.char(0x30C4) -- ヅ
print("Debug: Converted つ to ヅ")
elseif codepoint == 0xFF8B then -- ふ
result = result.. utf8.char(0x30D5) -- フ
print("Debug: Converted ふ to フ")
elseif codepoint == 0xFF8D then -- へ
result = result.. utf8.char(0x30D8) -- ヘ
print("Debug: Converted へ to ヘ")
elseif codepoint == 0xFF8E then -- ほ
result = result.. utf8.char(0x30DB) -- ホ
print("Debug: Converted ほ to ホ")
else
result = result.. utf8.char(codepoint - 0xFF61 + 0x30A1)
print("Debug: Converted half-width Katakana to full-width Katakana")
end
dakuten = false
else
result = result.. utf8.char(codepoint - 0xFF61 + 0x30A1)
print("Debug: Converted half-width Katakana to full-width Katakana")
end
else
result = result.. char
print("Debug: Copied non-Katakana character")
end
end
print("Debug: Conversion complete")
return result
end
-- Load the subtitle file
local sub_file = mp.get_property("sub-file")
if sub_file and sub_file ~= "" then
if not io.open(sub_file, "r") then
print("Error: Unable to open subtitle file")
return
end
local subtitle_file = io.open(sub_file, "r")
local subtitle_text = subtitle_file:read("*a")
subtitle_file:close()
-- Check if the subtitle text is empty
if not subtitle_text or subtitle_text == "" then
print("Error: Subtitle file is empty")
return
end
-- Convert half-width Katakana to full-width Katakana
local modified_text, err = pcall(half_to_full_katakana, subtitle_text)
if not modified_text then
print("Error: Conversion failed: ".. err)
return
end
-- Set the modified

View File

@ -0,0 +1,186 @@
-- half_to_full_katakana.lua
-- Convert half-width Katakana to full-width Katakana
local function half_to_full_katakana(text)
print("Debug: Converting half-width Katakana to full-width Katakana...")
local result = ""
local dakuten = false
for char in text:gmatch(".") do
local byte = string.byte(char)
if byte == 0xFF9E then -- Dakuten marker
dakuten = true
print("Debug: Found dakuten marker")
elseif byte >= 0xFF61 and byte <= 0xFF9F then -- Half-width Katakana
if dakuten then
-- Convert half-width Katakana with dakuten to full-width
if byte == 0xFF8A then -- ハ
result = result .. "\xEF\xBD\xA0" -- バ
print("Debug: Converted ハ to バ")
elseif byte == 0xFF77 then -- き
result = result .. "\xEF\xBD\xAE" -- ギ
print("Debug: Converted き to ギ")
elseif byte == 0xFF78 then -- く
result = result .. "\xEF\xBD\xB0" -- グ
print("Debug: Converted く to グ")
elseif byte == 0xFF7C then -- し
result = result .. "\xEF\xBD\xB8" -- ジ
print("Debug: Converted し to ジ")
elseif byte == 0xFF7D then -- す
result = result .. "\xEF\xBD\xBA" -- ズ
print("Debug: Converted す to ズ")
elseif byte == 0xFF81 then -- ち
result = result .. "\xEF\xBD\xC6" -- チ
print("Debug: Converted ち to チ")
elseif byte == 0xFF82 then -- つ
result = result .. "\xEF\xBD\xC5" -- ヅ
print("Debug: Converted つ to ヅ")
elseif byte == 0xFF8B then -- ふ
result = result .. "\xEF\xBD\xD5" -- フ
print("Debug: Converted ふ to フ")
elseif byte == 0xFF8D then -- へ
result = result .. "\xEF\xBD\xD8" -- ヘ
print("Debug: Converted へ to ヘ")
elseif byte == 0xFF8E then -- ほ
result = result .. "\xEF\xBD\xDB" -- ホ
print("Debug: Converted ほ to ホ")
else
result = result .. string.char(byte - 0xFF61 + 0x30A1)
print("Debug: Converted half-width Katakana to full-width Katakana")
end
dakuten = false
else
result = result .. string.char(byte - 0xFF61 + 0x30A1)
print("Debug: Converted half-width Katakana to full-width Katakana")
end
else
result = result .. char
print("Debug: Copied non-Katakana character")
end
end
print("Debug: Conversion complete")
return result
end
-- Load the subtitle file
local sub_file = mp.get_property("sub-file")
if sub_file and sub_file ~= "" then
if not io.exists(sub_file) then
print("Error: Subtitle file does not exist")
return
end
local subtitle_file = io.open(sub_file, "r")
if not subtitle_file then
print("Error: Unable to open subtitle file")
return
end
local subtitle_text = subtitle_file:read("*a")
subtitle_file:close()
-- Check if the subtitle text is empty
if not subtitle_text or subtitle_text == "" then
print("Error: Subtitle file is empty")
return
end
-- Convert half-width Katakana to full-width Katakana
local modified_text, err = pcall(half_to_full_katakana, subtitle_text)
if not modified_text then
print("Error: Conversion failed: " .. err)
return
end
-- Set the modified subtitle text
mp.set_property("sub-text", modified_text)
print("Debug: Set modified subtitle text")
else
print("Error: Subtitle file not set")
return
end-- half_to_full_katakana.lua
-- Convert half-width Katakana to full-width Katakana
local function half_to_full_katakana(text)
print("Debug: Converting half-width Katakana to full-width Katakana...")
local result = ""
local dakuten = false
for char in text:gmatch(".") do
local byte = string.byte(char)
if byte == 0xFF9E then -- Dakuten marker
dakuten = true
print("Debug: Found dakuten marker")
elseif byte >= 0xFF61 and byte <= 0xFF9F then -- Half-width Katakana
if dakuten then
-- Convert half-width Katakana with dakuten to full-width
if byte == 0xFF8A then -- ハ
result = result .. "\xEF\xBD\xA0" -- バ
print("Debug: Converted ハ to バ")
elseif byte == 0xFF77 then -- き
result = result .. "\xEF\xBD\xAE" -- ギ
print("Debug: Converted き to ギ")
elseif byte == 0xFF78 then -- く
result = result .. "\xEF\xBD\xB0" -- グ
print("Debug: Converted く to グ")
elseif byte == 0xFF7C then -- し
result = result .. "\xEF\xBD\xB8" -- ジ
print("Debug: Converted し to ジ")
elseif byte == 0xFF7D then -- す
result = result .. "\xEF\xBD\xBA" -- ズ
print("Debug: Converted す to ズ")
elseif byte == 0xFF81 then -- ち
result = result .. "\xEF\xBD\xC6" -- チ
print("Debug: Converted ち to チ")
elseif byte == 0xFF82 then -- つ
result = result .. "\xEF\xBD\xC5" -- ヅ
print("Debug: Converted つ to ヅ")
elseif byte == 0xFF8B then -- ふ
result = result .. "\xEF\xBD\xD5" -- フ
print("Debug: Converted ふ to フ")
elseif byte == 0xFF8D then -- へ
result = result .. "\xEF\xBD\xD8" -- ヘ
print("Debug: Converted へ to ヘ")
elseif byte == 0xFF8E then -- ほ
result = result .. "\xEF\xBD\xDB" -- ホ
print("Debug: Converted ほ to ホ")
else
result = result .. string.char(byte - 0xFF61 + 0x30A1)
print("Debug: Converted half-width Katakana to full-width Katakana")
end
dakuten = false
else
result = result .. string.char(byte - 0xFF61 + 0x30A1)
print("Debug: Converted half-width Katakana to full-width Katakana")
end
else
result = result .. char
print("Debug: Copied non-Katakana character")
end
end
print("Debug: Conversion complete")
return result
end
-- Load the subtitle file
local subtitle_file = io.open(mp.get_property("sub-file"), "r")
if not subtitle_file then
print("Error: Unable to open subtitle file")
return
end
local subtitle_text = subtitle_file:read("*a")
subtitle_file:close()
-- Check if the subtitle text is empty
if not subtitle_text or subtitle_text == "" then
print("Error: Subtitle file is empty")
return
end
-- Convert half-width Katakana to full-width Katakana
local modified_text, err = pcall(half_to_full_katakana, subtitle_text)
if not modified_text then
print("Error: Conversion failed: " .. err)
return
end
-- Set the modified subtitle text
mp.set_property("sub-text", modified_text)
print("Debug: Set modified subtitle text")

View File

@ -0,0 +1,36 @@
-- katakana_conversion.lua
-- Table mapping half-width katakana to full-width
local half_to_full = {
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', ['ソ'] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = ''
}
-- Function to convert half-width katakana to full-width
local function convert_halfwidth_to_fullwidth(text)
return text:gsub(".", function(c)
return half_to_full[c] or c
end)
end
-- Hook into the subtitle text before display
mp.register_event("file-loaded", function()
local sub = mp.get_property_native("sub-text")
if sub then
mp.msg.info("Original subtitle text: " .. sub)
local converted_sub = convert_halfwidth_to_fullwidth(sub)
mp.set_property("sub-text", converted_sub)
mp.msg.info("Converted subtitle text: " .. converted_sub)
end
end)

View File

@ -0,0 +1,35 @@
-- katakana_conversion.lua
-- Table mapping half-width katakana to full-width
local half_to_full = {
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', ['ソ'] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = '', [''] = '', [''] = '',
[''] = '', [''] = ''
}
-- Function to convert half-width katakana to full-width
local function convert_halfwidth_to_fullwidth(text)
return text:gsub(".", function(c)
return half_to_full[c] or c
end)
end
-- Hook into the subtitle text before display
mp.add_hook("on_sub_text", 50, function(subtitle)
if subtitle and subtitle.text then
mp.msg.info("Original subtitle text: " .. subtitle.text)
subtitle.text = convert_halfwidth_to_fullwidth(subtitle.text)
mp.msg.info("Converted subtitle text: " .. subtitle.text)
end
return subtitle
end)

View File

@ -0,0 +1,102 @@
--此lua脚本由软件No1编写并提供支持
--This lua script is written by www.rjno1.com
--此脚本可以把osd中显示的文字信息切换为本地语言
-- This script can switch the text information displayed in osd to the local language
--此脚本不仅对MPV-EASY Player有效对于mpv来说此脚本可以较好和较完全的解决语言本地化问题
-- This script is not only valid for MPV-EASY Player. For mpv, this script can solve the language localization problem better and more completely.
--此脚本中重复的命令对MPV-EASY Player中的语言本地化并不会造成冲突,只会有轻微干扰或者无干扰,能成为有效的补充,比如你按下快捷键激发命令时。
--如果你发现有些命令会对使用会造成干扰,那么注释对应部分即可
--此脚本中有些命令默认就是注释状态,造成这个的原因有:
----1、命令可能不会产生效果
----2、命令可能会对MPV-EASY Player造成较大的干扰对mpv则没有
----3、命令已经有了更好的写法
--如果你了解了这个脚本的功能那么可以尝试取消这些注释从而可以让播放器osd显示的语言本地化更加的完整。
local opts = require 'mp.options'
local osd_level_value = mp.get_property_osd("osd-level")
--默认设置
local settings = {
language = "ja" ,
}
--读取.conf设置文件中的设置
opts.read_options(settings, "local-language")
--loop-file的function
function loop_file_show_text(loop_file_fn, loop_file_fn_param)
if (loop_file_fn_param == "yes" or loop_file_fn_param == "inf") then
mp.command("show-text \"重复播放启用\"")
elseif( loop_file_fn_param == "no") then
mp.command("show-text \"重复播放禁用\"")
else
mp.command("show-text \"重复播放次数: ${loop-file}\"")
end
end
--loop-playlist的function
function loop_playlist_show_text(loop_playlist_fn, loop_playlist_fn_param)
if (loop_playlist_fn_param == "yes" or loop_playlist_fn_param == "inf") then
mp.command("show-text \"循环播放启用\"")
elseif( loop_playlist_fn_param == "no") then
mp.command("show-text \"循环播放禁用\"")
else
mp.command("show-text \"循环播放次数: ${loop-playlist}\"")
end
end
if settings.language =="zh-cn" and osd_level_value >= "1" then
--视频打开后延迟一会在加载,防止有时候会出现文字很大的问题
mp.add_timeout(2, function()
--注意mp.observe_property(name, type, fn)type通常不建议使用string建议使用none因为
--If the type is none or nil, sporadic property change events are possible. This means the change
--function fn can be called even if the property doesn't actually change.
--比如音量最大100%当音量100%时按下0音量不变依旧是100%
--如果是string显示volume:100%,如果是none依旧显示你修改后的
mp.observe_property("contrast", "none", function() mp.command("show-text \"对比度: ${contrast}\"") end)
mp.observe_property("brightness", "none", function() mp.command("show-text \"亮度: ${brightness}\"") end)
mp.observe_property("saturation", "none", function() mp.command("show-text \"饱和度: ${saturation}\"") end)
mp.observe_property("gamma", "none", function() mp.command("show-text \"伽马值: ${gamma}\"") end)
--下面这条可能无效
--mp.observe_property("speed", "none", function() mp.command("show-text \"播放倍速: ${speed}\"") end)
--mp.observe_property("ontop", "none", function() mp.command("show-text \"置顶: ${ontop}\"") end)
--mp.observe_property("sub", "none", function() mp.command("show-text \"字幕切换为: ${sub}\"") end)
--mp.observe_property("audio", "none", function() mp.command("show-text \"音轨切换为: ${audio}\"") end)
--mp.observe_property("panscan", "none", function() mp.command("show-text \"视频画面缩放: ${panscan}\"") end)
--mp.observe_property("sub-scale", "none", function() mp.command("show-text \"字体缩放: ${sub-scale}\"") end)
--下方3条会互相造成干扰 解决方式只开启其中一个或其中2个或者改进这段代码
--mp.observe_property("window-scale", "none", function() mp.command("show-text \"视频画面大小倍数 ${window-scale}\"") end)
--使用string可以避免下面2条之间的干扰
--mp.observe_property("video-aspect", "string", function() mp.command("show-text \"画面宽高比例 ${video-aspect}\"") end)
--mp.observe_property("video-rotate", "none", function() mp.command("show-text \"画面旋转角度: ${video-rotate}\"") end)
--mp.observe_property("loop-file", "string", loop_file_show_text)
--下方这条和上方这条相同和一样有效只是显示比较简单上方这条要用string不能用none
----mp.observe_property("loop-file", "none", function() mp.command("show-text \"重复播放: ${loop-file}\"") end)
--mp.observe_property("loop-playlist", "string", loop_playlist_show_text)
--下方这条和上方这条相同和一样有效只是显示比较简单上方这条要用string不能用none
----mp.observe_property("loop-playlist", "none", function() mp.command("show-text \"循环播放: ${loop-playlist}\"") end)
--注意:音量一定要写在最后一个,防止首次自动显示时出现非音量的文字信息,但有可能放在最后也不能解决问题
mp.observe_property("volume", "none", function() mp.command("show-text \"音量:${volume}%\"") end)
end)
end

View File

@ -0,0 +1,102 @@
--此lua脚本由软件No1编写并提供支持
--This lua script is written by www.rjno1.com
--此脚本可以把osd中显示的文字信息切换为本地语言
-- This script can switch the text information displayed in osd to the local language
--此脚本不仅对MPV-EASY Player有效对于mpv来说此脚本可以较好和较完全的解决语言本地化问题
-- This script is not only valid for MPV-EASY Player. For mpv, this script can solve the language localization problem better and more completely.
--此脚本中重复的命令对MPV-EASY Player中的语言本地化并不会造成冲突,只会有轻微干扰或者无干扰,能成为有效的补充,比如你按下快捷键激发命令时。
--如果你发现有些命令会对使用会造成干扰,那么注释对应部分即可
--此脚本中有些命令默认就是注释状态,造成这个的原因有:
----1、命令可能不会产生效果
----2、命令可能会对MPV-EASY Player造成较大的干扰对mpv则没有
----3、命令已经有了更好的写法
--如果你了解了这个脚本的功能那么可以尝试取消这些注释从而可以让播放器osd显示的语言本地化更加的完整。
local opts = require 'mp.options'
local osd_level_value = mp.get_property_osd("osd-level")
--默认设置
local settings = {
language = "zh-cn" ,
}
--读取.conf设置文件中的设置
opts.read_options(settings, "local-language")
--loop-file的function
function loop_file_show_text(loop_file_fn, loop_file_fn_param)
if (loop_file_fn_param == "yes" or loop_file_fn_param == "inf") then
mp.command("show-text \"重复播放启用\"")
elseif( loop_file_fn_param == "no") then
mp.command("show-text \"重复播放禁用\"")
else
mp.command("show-text \"重复播放次数: ${loop-file}\"")
end
end
--loop-playlist的function
function loop_playlist_show_text(loop_playlist_fn, loop_playlist_fn_param)
if (loop_playlist_fn_param == "yes" or loop_playlist_fn_param == "inf") then
mp.command("show-text \"循环播放启用\"")
elseif( loop_playlist_fn_param == "no") then
mp.command("show-text \"循环播放禁用\"")
else
mp.command("show-text \"循环播放次数: ${loop-playlist}\"")
end
end
if settings.language =="zh-cn" and osd_level_value >= "1" then
--视频打开后延迟一会在加载,防止有时候会出现文字很大的问题
mp.add_timeout(2, function()
--注意mp.observe_property(name, type, fn)type通常不建议使用string建议使用none因为
--If the type is none or nil, sporadic property change events are possible. This means the change
--function fn can be called even if the property doesn't actually change.
--比如音量最大100%当音量100%时按下0音量不变依旧是100%
--如果是string显示volume:100%,如果是none依旧显示你修改后的
mp.observe_property("contrast", "none", function() mp.command("show-text \"对比度: ${contrast}\"") end)
mp.observe_property("brightness", "none", function() mp.command("show-text \"亮度: ${brightness}\"") end)
mp.observe_property("saturation", "none", function() mp.command("show-text \"饱和度: ${saturation}\"") end)
mp.observe_property("gamma", "none", function() mp.command("show-text \"伽马值: ${gamma}\"") end)
--下面这条可能无效
--mp.observe_property("speed", "none", function() mp.command("show-text \"播放倍速: ${speed}\"") end)
--mp.observe_property("ontop", "none", function() mp.command("show-text \"置顶: ${ontop}\"") end)
--mp.observe_property("sub", "none", function() mp.command("show-text \"字幕切换为: ${sub}\"") end)
--mp.observe_property("audio", "none", function() mp.command("show-text \"音轨切换为: ${audio}\"") end)
--mp.observe_property("panscan", "none", function() mp.command("show-text \"视频画面缩放: ${panscan}\"") end)
--mp.observe_property("sub-scale", "none", function() mp.command("show-text \"字体缩放: ${sub-scale}\"") end)
--下方3条会互相造成干扰 解决方式只开启其中一个或其中2个或者改进这段代码
--mp.observe_property("window-scale", "none", function() mp.command("show-text \"视频画面大小倍数 ${window-scale}\"") end)
--使用string可以避免下面2条之间的干扰
--mp.observe_property("video-aspect", "string", function() mp.command("show-text \"画面宽高比例 ${video-aspect}\"") end)
--mp.observe_property("video-rotate", "none", function() mp.command("show-text \"画面旋转角度: ${video-rotate}\"") end)
--mp.observe_property("loop-file", "string", loop_file_show_text)
--下方这条和上方这条相同和一样有效只是显示比较简单上方这条要用string不能用none
----mp.observe_property("loop-file", "none", function() mp.command("show-text \"重复播放: ${loop-file}\"") end)
--mp.observe_property("loop-playlist", "string", loop_playlist_show_text)
--下方这条和上方这条相同和一样有效只是显示比较简单上方这条要用string不能用none
----mp.observe_property("loop-playlist", "none", function() mp.command("show-text \"循环播放: ${loop-playlist}\"") end)
--注意:音量一定要写在最后一个,防止首次自动显示时出现非音量的文字信息,但有可能放在最后也不能解决问题
mp.observe_property("volume", "none", function() mp.command("show-text \"音量:${volume}%\"") end)
end)
end

View File

@ -0,0 +1,28 @@
local cache_size
function on_load()
-- Get the system's total memory in MB
local mem_total = tonumber(io.popen("free -m | awk '/Mem:/ {print $2}'"):read())
-- Calculate the cache size based on total memory
cache_size = math.floor(mem_total / 32) -- 128MB for 4GB RAM, increase proportionally
-- Set initial cache properties
mp.set_property_number("demuxer-max-bytes", tostring(cache_size * 1024 * 1024)) -- Set cache size in bytes
mp.set_property("demuxer-readahead-secs", "20") -- Set read-ahead in seconds, adjust as needed
end
function on_pause_change(name, value)
if value then
-- Force caching when paused and free backwards cache
mp.set_property("demuxer-max-back-bytes", "0") -- Free backwards cache
mp.command("script-message-to cache flush")
mp.command("script-message-to cache prefill")
else
-- Reset cache properties when playback resumes
mp.set_property("demuxer-max-back-bytes", tostring(cache_size * 1024 * 1024)) -- Reset backwards cache size
end
end
mp.register_event("file-loaded", on_load)
mp.observe_property("pause", "bool", on_pause_change)

View File

@ -0,0 +1,269 @@
-- Usage:
-- i - subtitle mode on/off
-- ↑, ↓ (Space) - mode specific shortcuts
-- Note:
-- The script is inspired by voracious.app (https://github.com/rsimmons/voracious).
--
-- - Listening Practice:
-- "Subtitles are initially hidden. At the end of each subtitle, the video will pause automatically.
-- Could you hear what was said? Press ↑ to replay, if necessary.
-- Then press ↓ to reveal the subs, and check if you heard correctly.
-- Then press ↓ to unpause the video."
--
-- - Reading Practice:
-- "At the start of each new subtitle, the video will pause automatically.
-- Try reading the sub. Then press ↓ to unpause the video, and hear it spoken.
-- Did you read it correctly?"
--
----------------------------------
--------- Script Options ---------
srt_file_extensions = {".srt", ".en.srt", ".eng.srt"}
----------------------------------
sub_pad_start = 0.25
sub_pad_end = 0.2
----------------------------------
function srt_time_to_seconds(time)
major, minor = time:match("(%d%d:%d%d:%d%d),(%d%d%d)")
hours, mins, secs = major:match("(%d%d):(%d%d):(%d%d)")
return hours * 3600 + mins * 60 + secs + minor / 1000
end
function seconds_to_srt_time(time)
hours = math.floor(time / 3600)
mins = math.floor(time / 60) % 60
secs = math.floor(time % 60)
milliseconds = (time * 1000) % 1000
return string.format("%02d:%02d:%02d,%03d", hours, mins, secs, milliseconds)
end
function open_subtitles_file()
local video_path = mp.get_property("path")
local srt_filename = video_path:gsub('\\','/'):match("^(.+)/.+$") .. "/" .. mp.get_property("filename/no-ext")
for i, ext in ipairs(srt_file_extensions) do
local f, err = io.open(srt_filename .. ext, "r")
if f then
return f
end
end
return false
end
function read_subtitles()
local f = open_subtitles_file()
if not f then
return false
end
local data = f:read("*all")
data = string.gsub(data, "\r\n", "\n")
f:close()
subs = {}
subs_start = {}
subs_end = {}
for start_time, end_time, text in string.gmatch(data, "(%d%d:%d%d:%d%d,%d%d%d) %-%-> (%d%d:%d%d:%d%d,%d%d%d)\n(.-)\n\n") do
if not filter_subtitles(text) then
table.insert(subs, text)
table.insert(subs_start, srt_time_to_seconds(start_time))
table.insert(subs_end, srt_time_to_seconds(end_time))
end
end
return true
end
function filter_subtitles(text)
if string.match(text, "^%[(.*)%]$") then
return true
end
return false
end
function adjust_subtitles()
sub_id = 1
while sub_id < #subs do
if subs_start[sub_id + 1] - subs_end[sub_id] > sub_pad_end then
subs_end[sub_id] = subs_end[sub_id] + sub_pad_end
elseif subs_start[sub_id + 1] - subs_end[sub_id] > 0 then
subs_end[sub_id] = subs_end[sub_id] + (subs_start[sub_id + 1] - subs_end[sub_id]) / 2
end
if subs_start[sub_id + 1] - subs_end[sub_id] > sub_pad_start then
subs_start[sub_id + 1] = subs_start[sub_id + 1] - sub_pad_start
elseif subs_start[sub_id + 1] - subs_end[sub_id] > 0 then
subs_start[sub_id + 1] = subs_start[sub_id + 1] - (subs_start[sub_id + 1] - subs_end[sub_id]) / 2
end
sub_id = sub_id + 1
end
subs_start[1] = subs_start[1] - sub_pad_start
subs_end[#subs] = subs_end[#subs] + sub_pad_end
end
function update_sub_id()
local pos = mp.get_property_number("time-pos")
if pos == nil then
sub_id = nil
return
end
sub_id = 1
while sub_id < #subs and subs_end[sub_id] < pos do
sub_id = sub_id + 1
end
if subtitle_mode == "Reading Practice" and sub_id < #subs then
sub_id = sub_id + 1
end
end
function replay_sub_without_subtitles()
if sub_id ~= nil then
player_state = "replay"
mp.set_property("sub-visibility", "no")
mp.commandv("seek", subs_start[sub_id], "absolute+exact")
end
end
function on_seek()
if player_state ~= "replay" then
update_sub_id()
end
end
function on_playback_restart()
if player_state == "replay" then
mp.set_property("pause", "no")
player_state = nil
end
end
function on_up_arrow_key()
if subtitle_mode == "Listening Practice" then
replay_sub_without_subtitles()
end
end
function on_down_arrow_key()
if player_state == "pause" then
if mp.get_property("sub-visibility") == "no" then
mp.set_property("sub-visibility", "yes")
else
mp.set_property("sub-visibility", "no")
mp.set_property("pause", "no")
player_state = nil
if sub_id < #subs then
sub_id = sub_id + 1
else
sub_id = nil
end
end
end
end
function on_space_key()
if player_state == "pause" then
on_down_arrow_key()
else
mp.set_property_bool("pause", not mp.get_property_bool("pause"))
end
end
function subtitle_mode_timer()
local pos = mp.get_property_number("time-pos")
if pos ~= nil then
if sub_id ~= nil and mp.get_property("pause") ~= "yes" then
if subtitle_mode == "Listening Practice" and pos >= subs_end[sub_id] then
mp.set_property("pause", "yes")
player_state = "pause"
elseif subtitle_mode == "Reading Practice" then
if (pos + 0.25) >= subs_start[sub_id] then
mp.set_property("sub-visibility", "yes")
end
if pos >= subs_start[sub_id] then
mp.set_property("pause", "yes")
player_state = "pause"
end
end
end
end
end
function init_subtitle_mode()
default_sub_visibility = mp.get_property("sub-visibility")
mp.set_property("sub-visibility", "no")
timer = mp.add_periodic_timer(0.05, subtitle_mode_timer)
update_sub_id()
mp.add_key_binding("up", "up-arrow-key", on_up_arrow_key)
mp.add_key_binding("down", "down-arrow-key", on_down_arrow_key)
mp.add_key_binding("space", "space-arrow-key", on_space_key)
mp.register_event("seek", on_seek)
mp.register_event("playback-restart", on_playback_restart)
end
function release_subtitle_mode()
mp.set_property("sub-visibility", default_sub_visibility)
timer:kill()
mp.remove_key_binding("up-arrow-key")
mp.remove_key_binding("down-arrow-key")
mp.remove_key_binding("space-arrow-key")
mp.unregister_event(on_seek)
mp.unregister_event(on_playback_restart)
end
function toggle_subtitle_mode()
if subtitle_mode == nil then
subtitle_mode = "Listening Practice"
mp.set_property("sub-delay", sub_pad_end + 0.25)
elseif subtitle_mode == "Listening Practice" then
subtitle_mode = "Reading Practice"
mp.set_property("sub-delay", -sub_pad_start - 0.25)
else
mp.set_property("sub-delay", 0)
subtitle_mode = nil
end
if subtitle_mode ~= nil then
mp.osd_message("Subtitle Mode: " .. subtitle_mode)
init_subtitle_mode()
else
mp.osd_message("Subtitle Mode: " .. "Off")
release_subtitle_mode()
end
end
function init()
local ret = read_subtitles()
if ret == false or #subs == 0 then
return
end
adjust_subtitles()
mp.add_key_binding("i", "toggle-interactive-mode", toggle_subtitle_mode)
end
mp.register_event("file-loaded", init)

@ -0,0 +1 @@
Subproject commit aa86597d5e65c9c40b12841a945be7a3cd0fb7b3