10
10
import MB from '../../../../common/MB' ;
11
11
import * as flags from '../../../flags' ;
12
12
import * as utils from '../../../utils' ;
13
+ import input from '../Input' ;
14
+ import output from '../Output' ;
13
15
14
16
MB . GuessCase = ( MB . GuessCase ) ? MB . GuessCase : { } ;
15
17
MB . GuessCase . Handler = ( MB . GuessCase . Handler ) ? MB . GuessCase . Handler : { } ;
@@ -25,31 +27,31 @@ MB.GuessCase.Handler.Artist = function (gc) {
25
27
*/
26
28
self . checkSpecialCase = function ( is ) {
27
29
if ( is ) {
28
- if ( ! gc . re . ARTIST_EMPTY ) {
30
+ if ( ! gc . regexes . ARTIST_EMPTY ) {
29
31
// Match empty
30
- gc . re . ARTIST_EMPTY = / ^ \s * $ / i;
32
+ gc . regexes . ARTIST_EMPTY = / ^ \s * $ / i;
31
33
// Match "unknown" and variants
32
- gc . re . ARTIST_UNKNOWN = / ^ [ \( \[ ] ? \s * U n k n o w n \s * [ \) \] ] ? $ / i;
34
+ gc . regexes . ARTIST_UNKNOWN = / ^ [ \( \[ ] ? \s * U n k n o w n \s * [ \) \] ] ? $ / i;
33
35
// Match "none" and variants
34
- gc . re . ARTIST_NONE = / ^ [ \( \[ ] ? \s * n o n e \s * [ \) \] ] ? $ / i;
36
+ gc . regexes . ARTIST_NONE = / ^ [ \( \[ ] ? \s * n o n e \s * [ \) \] ] ? $ / i;
35
37
// Match "no artist" and variants
36
- gc . re . ARTIST_NOARTIST = / ^ [ \( \[ ] ? \s * n o [ \s - ] + a r t i s t \s * [ \) \] ] ? $ / i;
38
+ gc . regexes . ARTIST_NOARTIST = / ^ [ \( \[ ] ? \s * n o [ \s - ] + a r t i s t \s * [ \) \] ] ? $ / i;
37
39
// Match "not applicable" and variants
38
- gc . re . ARTIST_NOTAPPLICABLE = / ^ [ \( \[ ] ? \s * n o t [ \s - ] + a p p l i c a b l e \s * [ \) \] ] ? $ / i;
40
+ gc . regexes . ARTIST_NOTAPPLICABLE = / ^ [ \( \[ ] ? \s * n o t [ \s - ] + a p p l i c a b l e \s * [ \) \] ] ? $ / i;
39
41
// Match "n/a" and variants
40
- gc . re . ARTIST_NA = / ^ [ \( \[ ] ? \s * n \s * [ \\ \/ ] \s * a \s * [ \) \] ] ? $ / i;
42
+ gc . regexes . ARTIST_NA = / ^ [ \( \[ ] ? \s * n \s * [ \\ \/ ] \s * a \s * [ \) \] ] ? $ / i;
41
43
}
42
- if ( is . match ( gc . re . ARTIST_EMPTY ) ) {
44
+ if ( is . match ( gc . regexes . ARTIST_EMPTY ) ) {
43
45
return self . SPECIALCASE_UNKNOWN ;
44
- } else if ( is . match ( gc . re . ARTIST_UNKNOWN ) ) {
46
+ } else if ( is . match ( gc . regexes . ARTIST_UNKNOWN ) ) {
45
47
return self . SPECIALCASE_UNKNOWN ;
46
- } else if ( is . match ( gc . re . ARTIST_NONE ) ) {
48
+ } else if ( is . match ( gc . regexes . ARTIST_NONE ) ) {
47
49
return self . SPECIALCASE_UNKNOWN ;
48
- } else if ( is . match ( gc . re . ARTIST_NOARTIST ) ) {
50
+ } else if ( is . match ( gc . regexes . ARTIST_NOARTIST ) ) {
49
51
return self . SPECIALCASE_UNKNOWN ;
50
- } else if ( is . match ( gc . re . ARTIST_NOTAPPLICABLE ) ) {
52
+ } else if ( is . match ( gc . regexes . ARTIST_NOTAPPLICABLE ) ) {
51
53
return self . SPECIALCASE_UNKNOWN ;
52
- } else if ( is . match ( gc . re . ARTIST_NA ) ) {
54
+ } else if ( is . match ( gc . regexes . ARTIST_NA ) ) {
53
55
return self . SPECIALCASE_UNKNOWN ;
54
56
}
55
57
}
@@ -61,9 +63,9 @@ MB.GuessCase.Handler.Artist = function (gc) {
61
63
* in the common word handlers.
62
64
*/
63
65
self . doWord = function ( ) {
64
- gc . o . appendSpaceIfNeeded ( ) ;
65
- gc . i . capitalizeCurrentWord ( ) ;
66
- gc . o . appendCurrentWord ( ) ;
66
+ output . appendSpaceIfNeeded ( ) ;
67
+ input . capitalizeCurrentWord ( ) ;
68
+ output . appendCurrentWord ( ) ;
67
69
68
70
flags . resetContext ( ) ;
69
71
flags . context . number = false ;
@@ -80,16 +82,16 @@ MB.GuessCase.Handler.Artist = function (gc) {
80
82
var append = '' ;
81
83
82
84
// Strip Jr./Sr. from the string, and append at the end.
83
- if ( ! gc . re . SORTNAME_SR ) {
84
- gc . re . SORTNAME_SR = / , \s * S r [ \. ] ? $ / i;
85
- gc . re . SORTNAME_JR = / , \s * J r [ \. ] ? $ / i;
85
+ if ( ! gc . regexes . SORTNAME_SR ) {
86
+ gc . regexes . SORTNAME_SR = / , \s * S r [ \. ] ? $ / i;
87
+ gc . regexes . SORTNAME_JR = / , \s * J r [ \. ] ? $ / i;
86
88
}
87
89
88
- if ( artist . match ( gc . re . SORTNAME_SR ) ) {
89
- artist = artist . replace ( gc . re . SORTNAME_SR , '' ) ;
90
+ if ( artist . match ( gc . regexes . SORTNAME_SR ) ) {
91
+ artist = artist . replace ( gc . regexes . SORTNAME_SR , '' ) ;
90
92
append = ', Sr.' ;
91
- } else if ( artist . match ( gc . re . SORTNAME_JR ) ) {
92
- artist = artist . replace ( gc . re . SORTNAME_JR , '' ) ;
93
+ } else if ( artist . match ( gc . regexes . SORTNAME_JR ) ) {
94
+ artist = artist . replace ( gc . regexes . SORTNAME_JR , '' ) ;
93
95
append = ', Jr.' ;
94
96
}
95
97
var names = artist . split ( ' ' ) ;
@@ -99,23 +101,23 @@ MB.GuessCase.Handler.Artist = function (gc) {
99
101
* are sorted at the end.
100
102
*/
101
103
var reorder = false ;
102
- if ( ! gc . re . SORTNAME_DJ ) {
103
- gc . re . SORTNAME_DJ = / ^ D J $ / i; // match DJ
104
- gc . re . SORTNAME_THE = / ^ T h e $ / i; // match The
105
- gc . re . SORTNAME_LOS = / ^ L o s $ / i; // match Los
106
- gc . re . SORTNAME_DR = / ^ D r \. $ / i; // match Dr.
104
+ if ( ! gc . regexes . SORTNAME_DJ ) {
105
+ gc . regexes . SORTNAME_DJ = / ^ D J $ / i; // match DJ
106
+ gc . regexes . SORTNAME_THE = / ^ T h e $ / i; // match The
107
+ gc . regexes . SORTNAME_LOS = / ^ L o s $ / i; // match Los
108
+ gc . regexes . SORTNAME_DR = / ^ D r \. $ / i; // match Dr.
107
109
}
108
110
var firstName = names [ 0 ] ;
109
- if ( firstName . match ( gc . re . SORTNAME_DJ ) ) {
111
+ if ( firstName . match ( gc . regexes . SORTNAME_DJ ) ) {
110
112
append = ( ', DJ' + append ) ; // handle DJ xyz -> xyz, DJ
111
113
names [ 0 ] = null ;
112
- } else if ( firstName . match ( gc . re . SORTNAME_THE ) ) {
114
+ } else if ( firstName . match ( gc . regexes . SORTNAME_THE ) ) {
113
115
append = ( ', The' + append ) ; // handle The xyz -> xyz, The
114
116
names [ 0 ] = null ;
115
- } else if ( firstName . match ( gc . re . SORTNAME_LOS ) ) {
117
+ } else if ( firstName . match ( gc . regexes . SORTNAME_LOS ) ) {
116
118
append = ( ', Los' + append ) ; // handle Los xyz -> xyz, Los
117
119
names [ 0 ] = null ;
118
- } else if ( firstName . match ( gc . re . SORTNAME_DR ) ) {
120
+ } else if ( firstName . match ( gc . regexes . SORTNAME_DR ) ) {
119
121
append = ( ', Dr.' + append ) ; // handle Dr. xyz -> xyz, Dr.
120
122
names [ 0 ] = null ;
121
123
reorder = true ; // reorder doctors.
0 commit comments