PowderPlayer icon indicating copy to clipboard operation
PowderPlayer copied to clipboard

[OpenSubtitles] Manual Search

Open samukets opened this issue 9 years ago • 7 comments

Button to navigate on OpenSubtitle will be a good feature:

image

Magnetlink to justify the necessity:

magnet:?xt=urn:btih:8CFA725050F0050B92E57CA0A010BAE0A0F104A8

samukets avatar Mar 06 '16 19:03 samukets

Test trying to load Portuguese subtitle...

samukets avatar Mar 06 '16 19:03 samukets

A search form? Like VLSub?

vlsub_2

jaruba avatar Mar 06 '16 20:03 jaruba

Or just a link to the search on the OpenSubtitles site that already includes filename and file hash?

jaruba avatar Mar 06 '16 21:03 jaruba

A search form like VLsub is a good idea with title using file name pré-loaded... Good ideia

samukets avatar Mar 06 '16 22:03 samukets

@vankasteelj any thoughts on this? :)

jaruba avatar Mar 06 '16 23:03 jaruba

Using filename is useless, it's already what happens when querying the api with opensubtitles-api

If you absolutely want a search input for OpenSubtitles: what I'm using with OpenSubtitles-Uploader is a trick to prefill the search bar:

    var clearName = function(name) {
        var title = require('path').parse(name).name;
        return title
            .replace(/(400|480|720|1080)[pix]/gi, '') // quality clean
            .replace(/[xh]26\d|hevc|xvid|divx|aac/gi, '') // codecs
            .replace(/bluray|bdrip|brrip|dsr|dvdrip|dvd\Wrip|hdtv|\Wts\W|telesync|\Wcam\W/gi, '') // source
            .replace(/\Wextended\W|\Wproper/ig, '') // specials
            .replace(/[\.]/g, ' ') // has '.'
            .replace(/^\[.*\]/, '') // starts with brackets
            .replace(/\[(\w|\d)+\]/g, '') // remove brackets
            .replace(/\((\w|\d)+\)/g, '') // remove parenthesis
            .replace(/_/g, ' ') // has '_'
            .replace(/-/g, ' ') // has '-'
            .replace(/\-$/, '') // ends with '-'
            .replace(/\s.$/, '') // ends with ' '
            .replace(/^\./, '') // starts with '.'
            .replace(/^\-/, '') // starts with '-'
            .replace(/ +/g, ' '); // has multiple spaces
    };

    var getTitle = function (filename) {
        var begin_title = [],
            clean_title = [],
            count = 0,
            toPush = 0,
            title = clearName(filename).split(' ');

        for (var t in title) {
            if (!title[t].match(/^(the|an|19\d{2}|20\d{2}|a|of|in)$/i)) {
                clean_title.push(title[t]);
                toPush++;
            }
        }
        for (var u in clean_title) {
            if (count < (toPush > 5 ? 4 : toPush - 1) ) {
                begin_title.push(clean_title[u]);
                count++;
            }
        }
        return begin_title.join(' ');
    };

then:

getTitle('The.Hateful.Eight.2015.1080p.BluRay.H264.AAC-RARBG.mp4');

returns Hateful Eight


But in general, if OpenSubtitles can't match your file with the things already being used in Powder, there's little chance a manual search will do any good. You'd better look at, maybe, automating a Google request (for example: open in browser 'https://google.com/?q=' + getTitle(filename) + ' ' + i18n.__('subtitle') + ' ' + i18n.getLocale();). Because I'm not aware of other good apis for subtitles, so this would probably lead to addic7ed as first result 80% of the time, and other like tvsubtitles the rest of the time.

IMO, if you create an entire search feature for OpenSubtitles, you won't get better results than with the actual search.


Note: I'm basing myself on how powder-react is currently behaving, with the imdb and such, I'm not sure what 0.97 knows about file metadatas.

vankasteelj avatar Mar 07 '16 00:03 vankasteelj

@vankasteelj Powder v0.98 (released today), searches for everything that react-powder does except imdb id. (and in the same way too)

As your module merges imdb and hash searches, I see how it may be lacking the entire subtitle list. You made very good points about this though.

jaruba avatar Mar 07 '16 01:03 jaruba