Browse Source

Fix titles in anidb autofill

spaghetti 7 years ago
parent
commit
8e350738e9
2 changed files with 9 additions and 13 deletions
  1. 8
    2
      sections/ajax/anidb.php
  2. 1
    11
      static/functions/upload.js

+ 8
- 2
sections/ajax/anidb.php View File

@@ -25,10 +25,15 @@ if ($Cache->get_value('anidb_json_'.$aid)) {
25 25
     json_die("failure", $anidb_xml->xpath('/error')[0]."");
26 26
   }
27 27
 
28
-  $title = $anidb_xml->xpath('//titles/title[@type = "main"]')[0].'';
29
-  $title = (empty($title))?$anidb_xml->xpath('//titles/title[@xml:lang = "en" and @type = "official"]')[0].'':$title;
28
+  $title = $anidb_xml->xpath('//titles/title[@xml:lang = "en" and @type = "official"]')[0].'';
29
+  $title = (empty($title))?$anidb_xml->xpath('//titles/title[@xml:lang = "en"]')[0].'':$title;
30
+  $title = (empty($title))?$anidb_xml->xpath('//titles/title[@type = "main"]')[0].'':$title;
31
+
32
+  $title_rj = $anidb_xml->xpath('//titles/title[@xml:lang = "x-jat" and @type = "official"]')[0].'';
33
+  $title_rj = (empty($title_rj))?$anidb_xml->xpath('//titles/title[@xml:lang = "x-jat"]')[0].'':$title_rj;
30 34
 
31 35
   $title_jp = $anidb_xml->xpath('//titles/title[@xml:lang = "ja" and @type = "official"]')[0].'';
36
+  $title_jp = (empty($title_jp))?$anidb_xml->xpath('//titles/title[@xml:lang = "ja"]')[0].'':$title_jp;
32 37
 
33 38
   $artist = $anidb_xml->xpath('//creators/name[@type = "Animation Work"]')[0].'';
34 39
 
@@ -39,6 +44,7 @@ if ($Cache->get_value('anidb_json_'.$aid)) {
39 44
   $json_str = array(
40 45
     'id' => $aid,
41 46
     'title' => $title,
47
+    'title_rj' => $title_rj,
42 48
     'title_jp' => $title_jp,
43 49
     'artist' => $artist,
44 50
     'year' => $year,

+ 1
- 11
static/functions/upload.js View File

@@ -402,20 +402,10 @@ function ToggleUnknown() {
402 402
   }
403 403
 }
404 404
 
405
-function GroupRemaster() {
406
-  var remasters = json.decode($('#json_remasters').raw().value);
407
-  var index = $('#groupremasters').raw().options[$('#groupremasters').raw().selectedIndex].value;
408
-  if (index != "") {
409
-    $('#remaster_year').raw().value = remasters[index][1];
410
-    $('#remaster_title').raw().value = remasters[index][2];
411
-    $('#remaster_record_label').raw().value = remasters[index][3];
412
-    $('#remaster_catalogue_number').raw().value = remasters[index][4];
413
-  }
414
-}
415
-
416 405
 function AnidbAutofill() {
417 406
   var map = { artist: 'idols_0',
418 407
               title: 'title',
408
+              title_rj: 'title_rj',
419 409
               title_jp: 'title_jp',
420 410
               year: 'year',
421 411
               description: 'album_desc' }

Loading…
Cancel
Save