CogentRedTester / mpv-sub-select

An advanced conditional subtitle track selector for mpv player
MIT License
89 stars 8 forks source link

Issue blacklisting a subtitle #7

Closed Anskrevy closed 2 years ago

Anskrevy commented 2 years ago

I've got a video with two subtitles. One has the name "English" and the other has the name "English (Translation Only)". The default sub is the latter which is akin to signs/songs in terms of actually being useful when watching something with an audio track in another language.

I have this in my sub-select.json

    {
        "alang": [ "j[ap]n?" ],
        "slang": [ "eng?", "und", "jpn?" ],
        "blacklist": [ "Sings/Songs", "signs", "songs", "sign", "song", "English (Translation Only)" ]
    },

Despite that I can't seem to blacklist this sub for some reason. I tried escaping the parentheses with one and two backslashes but to no avail.

Any idea what might be going on?

Here is the output from mkvinfo in case I missed something.

+ EBML head
|+ EBML version: 1
|+ EBML read version: 1
|+ Maximum EBML ID length: 4
|+ Maximum EBML size length: 8
|+ Document type: matroska
|+ Document type version: 2
|+ Document type read version: 2
+ Segment: size 3114128818
|+ Seek head (subentries will be skipped)
|+ EBML void: size 4029
|+ Segment information
| + Timestamp scale: 1000000
| + Multiplexing application: libebml v1.2.1 + libmatroska v1.1.1
| + Writing application: mkvmerge v4.9.1 ('Ich will') built on Jul 11 2011 23:53:15
| + Duration: 00:24:10.474000000
| + Date: 2021-01-23 07:57:15 UTC
| + Segment UID: 0xbb 0x81 0xbd 0x1c 0x01 0x0d 0x3a 0xad 0x91 0x8b 0x20 0xe6 0x02 0x54 0x1c 0x24
|+ Tracks
| + Track
|  + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
|  + Track UID: 1209811604
|  + Track type: video
|  + "Lacing" flag: 0
|  + Minimum cache: 1
|  + Codec ID: V_MPEG4/ISO/AVC
|  + Codec's private data: size 41 (H.264 profile: High @L4.1)
|  + Default duration: 00:00:00.041708333 (23.976 frames/fields per second for a video track)
|  + Language: und
|  + Name: ENCODED BY DARKDREAM
|  + Video track
|   + Pixel width: 1920
|   + Pixel height: 1080
|   + Display width: 1920
|   + Display height: 1080
| + Track
|  + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
|  + Track UID: 1103072181
|  + Track type: audio
|  + Codec ID: A_AAC
|  + Codec's private data: size 5
|  + Default duration: 00:00:00.021333333 (46.875 frames/fields per second for a video track)
|  + Name: English
|  + Audio track
|   + Sampling frequency: 48000
|   + Channels: 6
| + Track
|  + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
|  + Track UID: 1610248080
|  + Track type: audio
|  + "Default track" flag: 0
|  + Codec ID: A_AAC
|  + Codec's private data: size 5
|  + Default duration: 00:00:00.021333333 (46.875 frames/fields per second for a video track)
|  + Language: jpn
|  + Name: Japanese
|  + Audio track
|   + Sampling frequency: 48000
|   + Channels: 6
| + Track
|  + Track number: 4 (track ID for mkvmerge & mkvextract: 3)
|  + Track UID: 1675229328
|  + Track type: subtitles
|  + "Lacing" flag: 0
|  + Codec ID: S_TEXT/ASS
|  + Codec's private data: size 823
|  + Name: English (Translation Only)
| + Track
|  + Track number: 5 (track ID for mkvmerge & mkvextract: 4)
|  + Track UID: 1537904289
|  + Track type: subtitles
|  + "Default track" flag: 0
|  + "Lacing" flag: 0
|  + Codec ID: S_TEXT/ASS
|  + Codec's private data: size 823
|  + Name: English
|+ EBML void: size 1189
|+ Attachments
| + Attached
|  + File name: OpenSans-Semibold_0.ttf
|  + MIME type: application/x-truetype-font
|  + File data: size 221328
|  + File UID: 123114646
|+ Cluster
CogentRedTester commented 2 years ago

The Lua pattern escape character is % not \. You could also just blacklist translation only

Anskrevy commented 2 years ago

The Lua pattern escape character is % not \.

Thanks for the tip. It didn't seem to work in this case but that is good to know.

You could also just blacklist translation only

Solved. I tried Translation Only, but that didn't work. Should blacklist or other items be kept lower case? Anyways thank you for the help.

CogentRedTester commented 2 years ago

Oh yes, the script will convert the titles of the tracks to lowercase for more consistent matching, but the whitelist/blacklist don't get converted so as not to break Lua patterns, so if you include capitals in the strings it won't work. I should mention that in the README.

CogentRedTester commented 2 years ago

I imagine that english %(translation only%) would probably have worked.