aniyomiorg / aniyomi

An app for manga and anime
https://aniyomi.org
Apache License 2.0
4.53k stars 283 forks source link

Mpv scrips not working in android 13 and 14 #1579

Closed P0bo closed 1 month ago

P0bo commented 1 month ago

Steps to reproduce

I have been using this script in my android 10 Lenovo tablet to skip openings of untracked local animes, however when I tried this in android 14 OnePlus tablet it doesnt seem to work , both devices are running r7540

local opts = {
    skip_min_length = 80,  -- Minimum chapter length to skip (in seconds)
    skip_max_length = 90,  -- Maximum chapter length to skip (in seconds)
}
-- No need for options.read_options(opts) since we define them here

function get_chapter_time(index)
    return mp.get_property_number("chapter-list/" .. index .. "/time")
end

function skip_chapters()
    local current_chapter = mp.get_property_number("chapter")
    local chapter_count = mp.get_property_number("chapter-list/count")

    if not current_chapter or not chapter_count then return end

    local current_chapter_time = get_chapter_time(current_chapter)
    local next_chapter_time = get_chapter_time(current_chapter + 1)

    if not current_chapter_time or not next_chapter_time then return end

    local chapter_length = next_chapter_time - current_chapter_time

    if chapter_length >= opts.skip_min_length and chapter_length <= opts.skip_max_length then
        local chapter_title = mp.get_property("chapter-list/" .. current_chapter .. "/title") or "Unknown"
        mp.set_property_number("chapter", current_chapter + 1)
        mp.osd_message("Skipped chapter: " .. chapter_title, 2)  -- Display message for 2 seconds
    end
end

mp.observe_property("chapter", "number", function(name, value)
    if value then
        skip_chapters()
    end
end) 

I have placed the script file in aniyomi scripts folder in both devices and used same video file for testing.

Screenshot_2024-05-17-01-20-41-96_e24af01bec3189413074866d0f854b7c

Expected behavior (Lenovo tablet) video

Version info

  • Lenovo tab (script working) App version: 0.15.3.0-7540 (standard, 9c30b3633, 123, 2024-05-15T00:59Z) Android version: 10 (SDK 29; build TB-8505F_S301106_230914_BMP) Android build ID: TB-8505F_S301106_230914_BMP Device brand: Lenovo Device manufacturer: LENOVO Device name: 8505F (LenovoTB-8505F) Device model: Lenovo TB-8505F WebView: Android System WebView 122.0.6261.119 MPV version: 4d32db2 Libplacebo version: v7.349.0 FFmpeg version: n7.0

Expected behavior

The script should work on all three devices

Actual behavior

Not Working on 2 Devices

Crash logs

No response

Aniyomi version

0.15.3.0-7540

Android version

Android 10 (Lenovo tab),Android 13 (Poco X3 pro),Android 14 (OnePlus Pad))

Device

Lenovo tab M10 HD,OnePlus Pad,Poco X3 pro

Other details

No response

Acknowledgements

jmir1 commented 1 month ago

Can you try it with r7493?

P0bo commented 1 month ago

@jmir1 r7493 also doesnt work

Bubblekey commented 1 month ago

Yep same , please look into this , i have been trying to find a solution from last month after i changed my phone ,i thought it was my phones fault 😞. The scripts save a lot of time for me .

Luffyirl commented 1 month ago

I think it may have something to do with the file access changes that Google made in Android 12(iirc) .

Luffyirl commented 1 month ago

I myself have been troubled by the fact that scripts doesn't work anymore but i remember i somehow made them work some versions before . A fix would be really appreciated.

jmir1 commented 1 month ago

I think it may have something to do with the file access changes that Google made in Android 12(iirc) .

That's true, what I can't figure out is why scripts used to work for me like 3 months ago but not now, also on android 13...

Ripl0gic commented 1 month ago

I think it may have something to do with the file access changes that Google made in Android 12(iirc) .

That's true, what I can't figure out is why scripts used to work for me like 3 months ago but not now, also on android 13...

I remember some guy asking in discord server like 3 months ago for blur-edges.lua . It was working for u or prolly quicky (i dont remember correctly) but the guy couldn't get it to work . In the end he gave up

Ripl0gic commented 1 month ago

Is this issue gonna get a fix or is it like a low priority feature ? I also use scripts on my tablet (android 11) but I'm thinking of buying a new one , it will be really inconvenient if I can't use scripts.

jmir1 commented 1 month ago

Is this issue gonna get a fix or is it like a low priority feature ? I also use scripts on my tablet (android 11) but I'm thinking of buying a new one , it will be really inconvenient if I can't use scripts.

I definitely want to fix it

cauxar commented 1 month ago

I definitely want to fix it

Damn u were dev , i thought u were some guy who got frustrated that ur scripts were not working anymore like me .

Fix will be really appreciated ♥️

jmir1 commented 1 month ago

Okay, so I managed to get scripts working by adding a new permission to manage all external files. What you need to do is:

  1. Download and install the latest prerelease from here
  2. Adjust you folder structure: Move your "scripts", "script-opts" and "fonts" directories into a directory called "mpv-config"
  3. Go to Settings -> Player -> Advanced player settings, switch on "Enable MPV scripts" and allow the permission
  4. Profit (hopefully)

Please tell me if this works for you all.

sBaydin commented 1 month ago

@jmir1 is a hero 🦸

jmir1 commented 1 month ago

Didn't get much feedback but the fix worked for the person who opened the issue, so closing this for now.

Luffyirl commented 1 month ago

Didn't get much feedback but the fix worked for the person who opened the issue, so closing this for now.

Actually this was really helpful for me too , thankyou very much for the fix .

cauxar commented 1 month ago

Didn't get much feedback but the fix worked for the person who opened the issue, so closing this for now.

It worked for me to , really appreciate ur work . Love u ♥️♥️♥️