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
     json_die("failure", $anidb_xml->xpath('/error')[0]."");
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
   $title_jp = $anidb_xml->xpath('//titles/title[@xml:lang = "ja" and @type = "official"]')[0].'';
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
   $artist = $anidb_xml->xpath('//creators/name[@type = "Animation Work"]')[0].'';
38
   $artist = $anidb_xml->xpath('//creators/name[@type = "Animation Work"]')[0].'';
34
 
39
 
39
   $json_str = array(
44
   $json_str = array(
40
     'id' => $aid,
45
     'id' => $aid,
41
     'title' => $title,
46
     'title' => $title,
47
+    'title_rj' => $title_rj,
42
     'title_jp' => $title_jp,
48
     'title_jp' => $title_jp,
43
     'artist' => $artist,
49
     'artist' => $artist,
44
     'year' => $year,
50
     'year' => $year,

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

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
 function AnidbAutofill() {
405
 function AnidbAutofill() {
417
   var map = { artist: 'idols_0',
406
   var map = { artist: 'idols_0',
418
               title: 'title',
407
               title: 'title',
408
+              title_rj: 'title_rj',
419
               title_jp: 'title_jp',
409
               title_jp: 'title_jp',
420
               year: 'year',
410
               year: 'year',
421
               description: 'album_desc' }
411
               description: 'album_desc' }

Loading…
Cancel
Save