Repository navigation
player: normalize paths for resuming playback - #12303
Conversation
|
Will result of |
No, it affects the paths that determine the hashes of watch later config files. |
Could you add a |
That's fine if maintainers think it's worth adding, but it should be in a later PR. |
12d79a4 to
65b49fb
Compare
|
I made this Unix only since there is no interest in fixing it on Windows. |
|
Download the artifacts for this pull request: |
N-R-K
left a comment
There was a problem hiding this comment.
Untested, but seems fine code wise.
65b49fb to
bc44c93
Compare
|
I also relate the same problem because I mount some video files in different locations, depending on the machine I am using. Because my user name differ, even if I mount my files in ~/foo, it ends up in /home/stacy/foo, or /home/willow/foo depending on the installation. What about ignoring the path while building the hash? We could just use metadata, and/or file name? |
|
|
|
I was aware of this argument. But both with or without have pros and cons. I would prefer relying on a md5 of the complete file, rather than it's file name and/or path. |
|
mpv compares the watch later path of every playlist entry to determine what file to resume from, and it would be too slow to calculate the hash of the content of thousands of playlist entries, which can even be network URLs. |
|
Fair points. Sorry for debating on this MR o/ |
|
What would be the computational considerations regarding MD5 hashing the first 4096 [1] bytes of every file the player loads? Tested with around ~900 matroskas I have laying around and found no hash collisions, and performace was acceptable disregarding OS|HW caching mechanics. Super fast on Winblows using busybox-w32 built-in utils (head|md5sum), and I can only speculate that C code doing the same would be even less demanding. Just hide it behind an option or something. Totally OT for this PR I know. [1]: random bytes pulled from my a**. |
|
There are also redirect entries for directory paths which don't have any content to hash. But I guess it would be fine as an alternative option, maybe limited to current file. It would also fix mpv-android/mpv-android#542. |
bc44c93 to
8b19a00
Compare
1c58f56 to
f822c5a
Compare
|
Please add a test for |
7714a2e to
d1b9fca
Compare
Paths like foo.mkv, ./foo.mkv .//foo.mkv, ../"$(basename "$PWD")"/foo.mkv, and C:\foo.mkv and C:/foo.mkv on Windows, use different config files for resuming playback, so if you quit-watch-later and later play the same file with a different path, mpv does not resume playback. This commit normalizes the paths on Unix to fix this.
d1b9fca to
4640537
Compare
2603f79 to
4b2310b
Compare
Paths like foo.mkv, ./foo.mkv .//foo.mkv, ../"$(basename "$PWD")"/foo.mkv, and C:\foo.mkv and C:/foo.mkv on Windows, use different config files for resuming playback, so if you quit-watch-later and later play the same file with a different path mpv does not resume playback. This commit normalizes the paths to fix this.
References #495
Someone needs to fix the code for Windows, and also test if the performance impact of calling
GetFullPathNameWon thousands of playlist entries is acceptable. On Linuxrealpathis actually much slower than this normalizing function. The loop inmp_check_playlist_resumewith 2330 images takes 0.012 seconds before this patch, 0.014 with it, and if I make it userealpathwith/dir/../dir/*it takes 0.038 seconds.