mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 00:08:51 -05:00
More general grepTheTvdbId()
This commit is contained in:
parent
ca7a973cd3
commit
a9cf202540
@ -1276,7 +1276,7 @@ public class MediaDetection {
|
||||
|
||||
public static List<Integer> grepTheTvdbId(CharSequence text) {
|
||||
// scan for thetvdb id patterns like http://www.thetvdb.com/?tab=series&id=78874&lid=14
|
||||
Pattern tvdbUrl = Pattern.compile("http[s]?://www.thetvdb.com/[?]tab=series&id=(\\d+)", Pattern.CASE_INSENSITIVE);
|
||||
Pattern tvdbUrl = Pattern.compile("\\w+://(?:\\w+[.])?thetvdb.com/[?]tab=\\w+&id=(\\d+)", Pattern.CASE_INSENSITIVE);
|
||||
return streamMatches(text, tvdbUrl, m -> m.group(1)).map(Integer::new).collect(toList());
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,8 @@ public class MediaDetectionTest {
|
||||
@Test
|
||||
public void grepTheTvdbId() throws Exception {
|
||||
assertEquals("[78874]", MediaDetection.grepTheTvdbId("@see http://www.thetvdb.com/?tab=series&id=78874&lid=14").toString());
|
||||
assertEquals("[78874]", MediaDetection.grepTheTvdbId("@see http://thetvdb.com/?tab=series&id=78874&lid=14").toString());
|
||||
assertEquals("[78874]", MediaDetection.grepTheTvdbId("@see https://www.thetvdb.com/?tab=seasonall&id=78874&lid=14").toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user