Skip to content

Commit

Permalink
allow manual seeking into aniskip timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixthrush committed Nov 17, 2024
1 parent 2c1397a commit 2fc0d69
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/aniworld/aniskip/skip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ local function skip()
return
end

if current_time >= options.op_start and current_time < options.op_end then
if current_time >= options.op_start and current_time < (options.op_start + 1) then
mp.set_property_number("time-pos", options.op_end)
end

if current_time >= options.ed_start and current_time < options.ed_end then
if current_time >= options.ed_start and current_time < (options.ed_start + 1) then
mp.set_property_number("time-pos", options.ed_end)
end
end
Expand Down
14 changes: 13 additions & 1 deletion src/aniworld/common/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,19 @@ def setup_aniskip() -> None:
skip_source_path = os.path.join(script_directory, 'aniskip', 'skip.lua')
skip_destination_path = os.path.join(mpv_scripts_directory, 'skip.lua')

if not os.path.exists(skip_destination_path):
if os.path.exists(skip_destination_path):
with open(skip_source_path, 'r', encoding="utf-8") as source_file:
source_content = source_file.read()

with open(skip_destination_path, 'r', encoding="utf-8") as destination_file:
destination_content = destination_file.read()

if source_content != destination_content:
logging.debug("Content differs, overwriting skip.lua")
shutil.copy(skip_source_path, skip_destination_path)
else:
logging.debug("skip.lua already exists and is identical, no overwrite needed")
else:
logging.debug("Copying skip.lua to %s", mpv_scripts_directory)
shutil.copy(skip_source_path, skip_destination_path)

Expand Down

0 comments on commit 2fc0d69

Please sign in to comment.