upload_btn

辅助脚本支持发布btn

Tính đến 31-05-2021. Xem phiên bản mới nhất.

Script này sẽ không được không được cài đặt trực tiếp. Nó là một thư viện cho các script khác để bao gồm các chỉ thị meta // @require https://update.greasyfork.org/scripts/427286/936246/upload_btn.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

if (GM_getValue('btn_info') !== undefined) {
    raw_info = JSON.parse(GM_getValue('btn_info'));
    raw_info = fill_raw_info(raw_info);
    if ($('#post').parent().parent().parent().parent().css('display') != 'none') {
       
        $('#content').find('table').first().hide();
        $('td.label:contains(Tech Specs)').parent().after($(`<tr><td class="label">IMDB</td>
            <td><input type="text" id="imdbid" name="imdbid" size="60" />
            <input id="fill" type="button" value="辅助填写">
            </td></tr>`));
        $('#imdbid').val(raw_info.url);
        $('#scenename').val(raw_info.name);
        $('#release_desc').val(raw_info.descr.replace(/\[.{3,15}\]/g, '').trim());
        setTimeout(function() {
            $('#fill').click(function(){
                var name = $('#scenename').val().trim();
                var title = $('#title').val().trim();
                if (title == name.replace(/ /g, '.')) {
                    if (name.match(/E\d+/i) && !name.match(/S\d+E\d+/i)) {
                        name = name.replace(/(E\d+)/, 'S01$1');
                        $('#title').val('S01' + title.match(/E\d+/)[0])
                    }
                }
                var tv_series = $('#artist').val();
                if (!tv_series.match(/(19|20)\d{2}/) && name.match(/(19|20)\d{2}[^pP]/)) {
                    name = name.replace(/(19|20)\d{2}/, '').replace(/ +/, ' ');
                }
                try{
                    var channels = raw_info.descr.match(/Channel.*?(\d).*?channels/)[1];
                    var label = null;
                    var label_str = '';
                    if (channels == '1') {
                        label = /1\.0/;
                        label_str = '1.0';
                    } else if (channels == '2') {
                        label = /2\.0/;
                        label_str = '2.0';
                    } else if (channels == '6') {
                        label = /5\.1/;
                        label_str = '5.1';
                    } else if (channels == '8') {
                        label = /7\.1/;
                        label_str = '7.1';
                    }
                    if (!name.match(label)) {
                        name = name.replace(/(DDPA|AAC|DDP|FLAC|DTS|LPCM|TrueHD)/, `$1${label_str}`);
                    }
                } catch(err) {alert(err)} 
                $('#scenename').val(name.replace(/ /g, '.'));
                $('#origin').val('P2P');

                var info = $('#album_desc').val();
                if (!info.match(/Season/)) {
                    info = `[b]Episode Name: [/b]\n[b]Season: {s} [/b]\n[b]Episode: {e} [/b]\n[b]Aired: [b/]\n\n[b]Episode Overview: [/b]`;
                    console.log(name)
                    try {
                        info = info.format({'s': parseInt(name.match(/S(\d+)/)[1])});
                        info = info.format({'e': parseInt(name.match(/E(\d+)/)[1])});
                        $('#album_desc').val(info);
                    } catch (err) {
                        console.log(err)
                    }
                }

                var codec = name.codec_sel();
                if (codec == 'H264' || codec == 'X264') {
                    $('#bitrate').val('H.264');
                } else if (codec == 'H265' || codec == 'X265') {
                    $('#bitrate').val('H.265');
                }
                var medium = name.medium_sel();
                if (medium == 'HDTV') {
                    $('#media').val('HDTV');
                } else if (medium == 'WEB-DL') {
                    $('#media').val('WEB-DL');
                }
                var standard = name.standard_sel();
                if (standard == '720p') {
                    $('#resolution').val('720p');
                } else if (standard == '1080p') {
                    $('#resolution').val('1080p');
                } else if (standard == '1080i') {
                    $('#resolution').val('1080i');
                } else if (standard == '4K') {
                    $('#resolution').val('2160p');
                }

                var mediainfo = $('#release_desc').val();
                if (mediainfo.match(/\.mp4/)) {
                    $('#format').val('MP4');
                } else if (mediainfo.match(/\.mkv/)) {
                    $('#format').val('MKV');
                }
                $('#international_box').attr('checked', true);
                var url = $('#imdbid').val();
                if (url.match(/tt\d+/)) {
                    var imdb_url = 'https://www.imdb.com/title/' + url.match(/tt\d+/)[0];
                    getDoc(imdb_url, null, function(doc) {
                        var country = Array.from($('div.txt-block:contains("Country")', doc).find('a')).map(function(e){
                            return $(e).text();
                        });
                        var country_selected = false;
                        country.map(function(e){
                            if ($('#country').find(`option:contains(${e.trim()})`).length) {
                                if (!country_selected){
                                    country_selected = true;
                                    $('#country').find(`option:contains(${e.trim()})`).attr('selected', true);
                                }
                            }
                        });
                        var language = $('div.txt-block:contains("Language")', doc).find('a').text().trim();
                        if (language == 'English') {
                            $('#international_box').attr('checked', false);
                        }
                    })

                }
            });
        }, 500);

        $('#album_desc').css({'width': '600px', 'height': '200px'});
        $('#release_desc').css({'width': '600px', 'height': '500px'});
    } else {
        if (raw_info.name.match(/e\d+/i)) {
            $('#categories').val('Episode');
        } else {
            $('#categories').val('Season');
        }
        $('#scene_yesno').val('Yes');

        $('#autofill_scene_yes').css({'display': 'block'});
        $('#autofill').val(raw_info.name);
    }
}