@@ -134,6 +134,7 @@ class BulkCreateService {
134
134
def seasonNumber = tvShowMatcher. group(' Season' ). toInteger()
135
135
def episodeNumber = tvShowMatcher. group(' Episode' ). toInteger()
136
136
fileResult. type = " tv"
137
+ Boolean isSubtitle = VideoHelper . isSubtitleFile(fileResult. file)
137
138
138
139
try {
139
140
TvShow existingTvShow
@@ -153,7 +154,11 @@ class BulkCreateService {
153
154
154
155
if (! seasonNumber && ! episodeNumber){
155
156
if (existingTvShow){
156
- fileResult. status = MATCHER_STATUS . EXISTING
157
+ if (isSubtitle){
158
+ fileResult. status = MATCHER_STATUS . EXISTING_FOR_SUBTITLE
159
+ }else {
160
+ fileResult. status = MATCHER_STATUS . EXISTING
161
+ }
157
162
fileResult. importedId = existingTvShow. id
158
163
fileResult. importedType = STREAMA_ROUTES [fileResult. type]
159
164
}
@@ -168,6 +173,9 @@ class BulkCreateService {
168
173
fileResult. name = name
169
174
}
170
175
fileResult. status = fileResult. status ?: MATCHER_STATUS . MATCH_FOUND
176
+ if (fileResult. status == MATCHER_STATUS . MATCH_FOUND && isSubtitle){
177
+ fileResult. status = MATCHER_STATUS . SUBTITLE_MATCH
178
+ }
171
179
fileResult. message = ' match found'
172
180
fileResult. type = fileResult. type
173
181
fileResult. season = seasonNumber
@@ -176,6 +184,7 @@ class BulkCreateService {
176
184
177
185
private extractDataForEpisode (TvShow existingTvShow , seasonNumber , episodeNumber , fileResult , tvShowId ) {
178
186
fileResult. type = ' episode'
187
+ Boolean isSubtitle = VideoHelper . isSubtitleFile(fileResult. file)
179
188
Episode existingEpisode
180
189
181
190
if (existingTvShow) {
@@ -188,7 +197,7 @@ class BulkCreateService {
188
197
}
189
198
190
199
if (existingEpisode) {
191
- fileResult. status = MATCHER_STATUS . EXISTING
200
+ fileResult. status = isSubtitle ? MATCHER_STATUS . EXISTING_FOR_SUBTITLE : MATCHER_STATUS . EXISTING
192
201
fileResult. importedId = existingEpisode. showId
193
202
fileResult. importedType = STREAMA_ROUTES [fileResult. type]
194
203
fileResult. apiId = existingEpisode. apiId
@@ -197,7 +206,7 @@ class BulkCreateService {
197
206
def episodeResult = theMovieDbService. getEpisodeMeta(tvShowId, seasonNumber, episodeNumber)
198
207
existingEpisode = Episode . findByApiIdAndDeletedNotEqual(episodeResult. id, true )
199
208
if (existingEpisode) {
200
- fileResult. status = MATCHER_STATUS . EXISTING
209
+ fileResult. status = isSubtitle ? MATCHER_STATUS . EXISTING_FOR_SUBTITLE : MATCHER_STATUS . EXISTING
201
210
fileResult. importedId = existingEpisode. showId
202
211
fileResult. importedType = STREAMA_ROUTES [fileResult. type]
203
212
}
0 commit comments