Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peerflix #8

Open
smhmd opened this issue Jan 26, 2020 · 12 comments
Open

Peerflix #8

smhmd opened this issue Jan 26, 2020 · 12 comments

Comments

@smhmd
Copy link

smhmd commented Jan 26, 2020

Referencing: noctuid/mpv-peerflix-hook#3

  • peerflix does not display the file title properly (usually http://localhost:8888 or magnet link in mpv-peerflix-hook's case), thus making it impossible for autosub to download subs for said file.
  • --force-media-title can be used to mitigate this, but autosub does not seem to use this forced media title. which outside of this use case, can be very helpful with other files and their subs.
  • peerflix/mpv-peerflix-hook store the file in /tmp/torrent-stream, but mpv uses http://localhost:NNNN to stream the file, how can one include these in local includes array to automatically get subs?
@smhmd
Copy link
Author

smhmd commented Jan 26, 2020

to test:

 mpv --force-media-title="the lighthouse 2019" 'magnet:?xt=urn:btih:B764661DE937E0463C9B7CD39EE10F949E507F8D&tr=http%3A%2F%2Fbt4.t-ru.org%2Fann%3Fmagnet&dn=%D0%9C%D0%B0%D1%8F%D0%BA%20%2F%20The%20Lighthouse%20(%D0%A0%D0%BE%D0%B1%D0%B5%D1%80%D1%82%20%D0%AD%D0%B3%D0%B3%D0%B5%D1%80%D1%81%20%2F%20Robert%20Eggers)%20%5B2019%2C%20%D0%A1%D0%A8%D0%90%2C%20%D1%83%D0%B6%D0%B0%D1%81%D1%8B%2C%20%D1%84%D1%8D%D0%BD%D1%82%D0%B5%D0%B7%D0%B8%2C%20%D0%B4%D1%80%D0%B0%D0%BC%D0%B0%2C%20%D0%B4%D0%B5%D1%82%D0%B5%D0%BA%D1%82%D0%B8%D0%B2%2C%20WEB-DLRip%5D%20MVO%20(HDRezka%20Studio)'

set local settings = {... remove_files = false ...} in mpv-peerflix-hook to not have to wait everytime while testing 😊.

@noctuid
Copy link

noctuid commented Jan 27, 2020

Yeah, I can't change path for a video, so either mpv would have to allow that or this plugin would need to also look at the media title.

@davidde
Copy link
Owner

davidde commented Jan 28, 2020

The problem is that autosub is not intended to be used with the command line. Most users will simply start playback from a file explorer, so requiring them to set the media-title from the command line is a no-go.

I'm not familiar with peerflix or the torrenting use case, so let me know if there's anything I can do to help.

@smhmd
Copy link
Author

smhmd commented Jan 28, 2020

so requiring them to set the media-title from the command line is a no-go.

That would not be a requirement in the least, but rather a plus. You may stream a normal URL (by drag and drop) and the file name would be in Russian or complete gibberish, and subliminal would not be able to retrieve correct subs. so, you're forced to change the name (this happens to me all the time).

so let me know if there's anything I can do to help.

The idea is to fall back to the file title (or prioritize it, if it exists, through configuration), as opposed to the file name (as it is defined in its path). namely this https://mpv.io/manual/master/#options-force-media-title.
I'm sure @noctuid would know the right Lua API to retrieve --force-media-title.

$ mpv 'http://domain.stream/film/Маяк.2019.mkv'
# subliminal searches for english subtitles for Маяк.2019.mkv; fails.

$ mpv --force-media-title='the lighthouse (2019)' 'http://domain.stream/film/Маяк.2019.mkv'
# subliminal searches for english subtitles for the lighthouse (2019); successes.

@davidde
Copy link
Owner

davidde commented Jan 28, 2020

Yeah, retrieving it is trivial: the media-title property.

I remember using it at some point, but then reverting it because it didn't work in all cases ...

@smhmd
Copy link
Author

smhmd commented Jan 28, 2020

Yes, it does not always exist using some protocols.
can its existence be checked and thus loaded conditionally?

@davidde
Copy link
Owner

davidde commented Jan 28, 2020

If it does not exist it uses the filename instead: see https://mpv.io/manual/master/#command-interface-media-title.

I just checked the reverting commit, and it seems the reason was because the subtitle filename is then saved as the media-title, which prevents the subtitles from being picked up by MPV. Subliminal unfortunately does not have an option to set a custom subtitle filename.

@smhmd
Copy link
Author

smhmd commented Jan 28, 2020

Can Lua's OS package or something intervene? or since it's a bit of an edge case, force load subtitles to mpv each time until a more ideal solution is found? I'll happily open an issue about this in subliminal, but development seems a bit slow.

@davidde
Copy link
Owner

davidde commented Jan 28, 2020

I guess it might be possible to do a check if media-title == filename, and if not to force load the media-title subtitles.

@smhmd
Copy link
Author

smhmd commented Jan 28, 2020

Checking if there are subs with the same name as the media-title and load that to not have to download each time is a last resort.

@whtv
Copy link

whtv commented Mar 22, 2020

If you’re using peerlix I suggest switching to the fork webtorrent-cli. No idea how, but it’s many times faster than any other torrent client for me. mpv-peerlix-hook should use it too, IMO.
Anyway, with webtorrent-cli --mpv the filename is set to the actual filename of the file being streamed, while directory appears to be unset. Therefore, for autosub.lua to work you have to set the relevant subliminal argument to a directory on your filesystem and pass that to the mpv option sub-file-paths. The script works perfectly with torrent streams that way.

@noctuid
Copy link

noctuid commented Apr 11, 2020

If you’re using peerlix I suggest switching to the fork webtorrent-cli. No idea how, but it’s many times faster than any other torrent client for me. mpv-peerlix-hook should use it too, IMO.

Thanks for saving me from peerflix. I've created an initial script for using it: webtorrent-peerflix-hook. It was a lot easier to write than the peerflix version (still needs work though).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants