upload_btn

辅助脚本支持发布btn

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/427286/957817/upload_btn.js

  1. // ==UserScript==
  2. // @name upload_btn
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description help auto-feed support btn
  6. // @author tomorrow505
  7. // @match https://gf.qytechs.cn/zh-CN/script_versions/new
  8. // @icon https://www.google.com/s2/favicons?domain=gf.qytechs.cn
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. if (GM_getValue('btn_info') !== undefined) {
  13. raw_info = JSON.parse(GM_getValue('btn_info'));
  14. raw_info = fill_raw_info(raw_info);
  15. if ($('#post').parent().parent().parent().parent().css('display') != 'none') {
  16. $('#content').find('table').first().hide();
  17. $('td.label:contains(Actors)').parent().after($(`<tr><td class="label">IMDB</td>
  18. <td><input type="text" id="imdbid" name="imdbid" size="60" />
  19. <input id="fill" type="button" value="辅助填写">
  20. </td></tr>`));
  21. $('#imdbid').val(raw_info.url);
  22. $('#scenename').val(raw_info.name);
  23. $('#release_desc').val(raw_info.descr.replace(/\[.{3,15}\]/g, '').trim());
  24. setTimeout(function() {
  25. $('#fill').click(function(){
  26. var name = $('#scenename').val().trim();
  27. var title = $('#title').val().trim();
  28. if (title == name.replace(/ /g, '.')) {
  29. if (name.match(/E\d+/i) && !name.match(/S\d+E\d+/i)) {
  30. name = name.replace(/(E\d+)/, 'S01$1');
  31. $('#title').val('S01' + title.match(/E\d+/)[0])
  32. }
  33. }
  34. var tv_series = $('#artist').val();
  35. if (!tv_series.match(/(19|20)\d{2}/) && name.match(/(19|20)\d{2}[^pP]/)) {
  36. name = name.replace(/(19|20)\d{2}/, '').replace(/ +/, ' ');
  37. }
  38. try{
  39. var channels = raw_info.descr.match(/Channel.*?(\d).*?channels/)[1];
  40. var label = null;
  41. var label_str = '';
  42. if (channels == '1') {
  43. label = /1\.0/;
  44. label_str = '1.0';
  45. } else if (channels == '2') {
  46. label = /2\.0/;
  47. label_str = '2.0';
  48. } else if (channels == '6') {
  49. label = /5\.1/;
  50. label_str = '5.1';
  51. } else if (channels == '8') {
  52. label = /7\.1/;
  53. label_str = '7.1';
  54. }
  55. if (!name.match(label)) {
  56. name = name.replace(/(DDPA|AAC|DDP|FLAC|DTS|LPCM|TrueHD)/, `$1${label_str}`);
  57. }
  58.  
  59. if (name.match(/(H.265|H.264).(DDPA|AAC|DDP|FLAC|DTS|LPCM|TrueHD)(2\.0|1\.0|5\.1|7\.1)/)) {
  60. name = name.replace(/(H.265|H.264).(DDPA|AAC|DDP|FLAC|DTS|LPCM|TrueHD)(2\.0|1\.0|5\.1|7\.1)/, '$2 $3 $1')
  61. }
  62.  
  63. } catch(err) {alert(err)}
  64. $('#scenename').val(name.replace(/ /g, '.'));
  65. $('#origin').val('P2P');
  66.  
  67. var info = $('#album_desc').val();
  68. if (!info.match(/Season/)) {
  69. 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]`;
  70. console.log(name)
  71. try {
  72. info = info.format({'s': parseInt(name.match(/S(\d+)/)[1])});
  73. info = info.format({'e': parseInt(name.match(/E(\d+)/)[1])});
  74. $('#album_desc').val(info);
  75. } catch (err) {
  76. console.log(err)
  77. }
  78. }
  79.  
  80. var codec = name.codec_sel();
  81. if (codec == 'H264' || codec == 'X264') {
  82. $('#bitrate').val('H.264');
  83. } else if (codec == 'H265' || codec == 'X265') {
  84. $('#bitrate').val('H.265');
  85. }
  86. var medium = name.medium_sel();
  87. if (medium == 'HDTV') {
  88. $('#media').val('HDTV');
  89. } else if (medium == 'WEB-DL') {
  90. $('#media').val('WEB-DL');
  91. }
  92. var standard = name.standard_sel();
  93. if (standard == '720p') {
  94. $('#resolution').val('720p');
  95. } else if (standard == '1080p') {
  96. $('#resolution').val('1080p');
  97. } else if (standard == '1080i') {
  98. $('#resolution').val('1080i');
  99. } else if (standard == '4K') {
  100. $('#resolution').val('2160p');
  101. }
  102.  
  103. var mediainfo = $('#release_desc').val();
  104. if (mediainfo.match(/\.mp4/)) {
  105. $('#format').val('MP4');
  106. } else if (mediainfo.match(/\.mkv/)) {
  107. $('#format').val('MKV');
  108. }
  109. $('#international_box').attr('checked', true);
  110. var url = $('#imdbid').val();
  111. if (url.match(/tt\d+/)) {
  112. var imdb_url = 'https://www.imdb.com/title/' + url.match(/tt\d+/)[0];
  113. getDoc(imdb_url, null, function(doc) {
  114. var country = Array.from($('li.ipc-metadata-list__item:contains("Country")', doc).find('a')).map(function(e){
  115. return $(e).text();
  116. });
  117. var country_selected = false;
  118. country.map(function(e){
  119. if (e == "UK") { e = 'United Kingdom'} else if (e == 'USA') { e = 'United States of America'}
  120. if ($('#country').find(`option:contains(${e.trim()})`).length) {
  121. if (!country_selected){
  122. country_selected = true;
  123. $('#country').find(`option:contains(${e.trim()})`).attr('selected', true);
  124. }
  125. }
  126. });
  127. var language = $('li[data-testid="title-details-languages"]', doc).find('a').text().trim();
  128. if (language == 'English') {
  129. $('#international_box').attr('checked', false);
  130. }
  131. })
  132.  
  133. }
  134. });
  135. }, 500);
  136.  
  137. $('#album_desc').css({'width': '600px', 'height': '200px'});
  138. $('#release_desc').css({'width': '600px', 'height': '500px'});
  139. } else {
  140. if (raw_info.name.match(/e\d+/i)) {
  141. $('#categories').val('Episode');
  142. } else {
  143. $('#categories').val('Season');
  144. }
  145. $('#scene_yesno').val('Yes');
  146.  
  147. $('#autofill_scene_yes').css({'display': 'block'});
  148. $('#autofill').val(raw_info.name);
  149. }
  150. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址