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

Magnet Link as Title #3

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

Magnet Link as Title #3

smhmd opened this issue Jan 26, 2020 · 12 comments
Labels
enhancement New feature or request

Comments

@smhmd
Copy link

smhmd commented Jan 26, 2020

image

Vanilla peerflix does a much worse job at providing a title for some magnets (I don't know what criteria for that happening) and more often than not, the title is http://localhost:8888. peerflix-hook on the other hand, always names the file with its magnet link. which makes it impossible to use subtitle solutions within mpv. I couldn't find a flag in the manual to change the file name (which would be helpful, tbh, with some streamed files named in Russian), but, hopefully, the Lua API has something.

@noctuid noctuid added the enhancement New feature or request label Jan 26, 2020
@noctuid
Copy link
Owner

noctuid commented Jan 26, 2020

Sometimes I get a title with certain links (but it's never right). Do you want it to show the actual title or just not the magnet link? Peerflix doesn't provide any good way for me to get the title, but I can probably add a hack to figure out which video file is streaming and set the title to the video name.

@smhmd
Copy link
Author

smhmd commented Jan 26, 2020

Yes, the currently played media file's title, not just not the magnet link, in order to let autosub search for subs automatically.

@noctuid
Copy link
Owner

noctuid commented Jan 26, 2020

I figured out how to get the video name/path, but it doesn't seem possible to change these properties. I opened an issue on the mpv tracker.

@smhmd
Copy link
Author

smhmd commented Jan 26, 2020

@noctuid I must have overlooked it --force-media-title. it does the job, but autosub does not use the forced media title. maybe that's an issue with mpv itself. I'll see to the devs with this.

noctuid added a commit that referenced this issue Feb 2, 2020
Also add missing local declarations.

Addresses #3.
@noctuid
Copy link
Owner

noctuid commented Feb 2, 2020

Well I went ahead and added my changes to set force-media-title to the name of the playing file. Let me know if I need to do anything else.

@smhmd
Copy link
Author

smhmd commented Feb 2, 2020

Let me know if I need to do anything else.

I'm very thankful.
I have but three points:

  • The scripts outputs bash: line 11: 0 * 0.2 : syntax error: invalid arithmetic operator (error token is ".2 ")
  • The script does not force title if you have opened it before you update the script (--no-resume-playback makes it work). Ex: fallback to the old version, run mpv 'magnet-link', update script, run mpv 'magnet-link' again, it'll have the magnet link as a title. This is unnecessary to fix as it is but I thought to let you know.
  • partial path in the name. Ex:
                          dir ↓ ↓ file
    image
    which would prove either useless (to user and scripts) or problematic.

@noctuid
Copy link
Owner

noctuid commented Feb 2, 2020

The scripts outputs bash: line 11: 0 * 0.2 : syntax error: invalid arithmetic operator (error token is ".2 ")

Fixed.

partial path in the name

Could you give me the full path of that file or some file that has this isuse (/tmp/torrent-stream/...)?

@smhmd
Copy link
Author

smhmd commented Feb 2, 2020

I tested with three torrents, btw.
Path:

/tmp/torrent-stream/d1e62f966ec76222e14ca180e8d12381b2949f80/Nameless Gangster Rules Of The Time (2012) [BluRay] [1080p] [YTS.LT]/Nameless.Gangster.Rules.Of.The.Time.2012.1080p.BluRay.x264-[YTS.LT].mp4

Command:

$  mpv 'magnet:?xt=urn:btih:D1E62F966EC76222E14CA180E8D12381B2949F80&dn=Nameless+Gangster%3A+Rules+of+the+Time+%282012%29+%5BBluRay%5D+%5B1080p%5D+%5BYTS%5D+%5BYIFY%5D&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2710%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com%3A1337&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A%2F%2Fcoppersurfer.tk%3A6969%2Fannounce'

noctuid added a commit that referenced this issue Feb 2, 2020
Torrents may not be a single video file but a directory with a video. Greedy
match to last / to get rid of all directories.

Addresses #3.
@noctuid
Copy link
Owner

noctuid commented Feb 2, 2020

Should work now.

@smhmd
Copy link
Author

smhmd commented Feb 2, 2020

very sorry for not making myself clear, but what I had in mind is having the filename as the title only. I think that would make the most sense for the user and the scripts since the file path is http://localhost: at the end of the day, and the absolute path can be retrieved but, otherwise, not very useful.

Nameless.Gangster.Rules.Of.The.Time.2012.1080p.BluRay.x264-[YTS.LT].mp4 #subliminal would have a field day with a filename like this.

as opposed to

image

If you have a reason to believe the absolute path is more useful, know that the path has an n/ thing in front of it.

noctuid added a commit that referenced this issue Feb 2, 2020
Also add missing local declarations.

Addresses #3.
@noctuid
Copy link
Owner

noctuid commented Feb 2, 2020

My bad. Don't have time right now to properly check all cases. Updated the script with something that may work, but I'll look at it later when I get a chance.

noctuid added a commit that referenced this issue Feb 2, 2020
Also add missing local declarations.

Addresses #3.
@noctuid
Copy link
Owner

noctuid commented Feb 16, 2020

I added some fixes for compatibility with lua 5.2. Everything is now working for me as expected. Let me know if you have any issues.

@noctuid noctuid closed this as completed Feb 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants