forked from filebot/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmiss.groovy
37 lines (27 loc) · 779 Bytes
/
miss.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// filebot -script fn:miss /path/to/media --log off
def episodes = []
def shows = []
args.getFiles().each{ f ->
if (f.isVideo()) {
def episode = f.metadata
def show = any{ ['tvdb', episode.series, episode.series.seriesId] }{ ['anidb', episode.series, episode.series.animeId] }
log.finest "${show} | ${episode} | ${f}"
if (episode != null && show != null) {
episodes << episode
shows << show
}
}
}
def episodeList = shows.collectMany{ s ->
(s[0] == 'tvdb' ? TheTVDB : AniDB).getEpisodeList(s[1])
}
// keep only normal episodes
episodeList = episodeList.findAll{ e ->
e.episode != null && e.special == null
}
episodeList = episodeList as LinkedHashSet
episodeList.removeAll(episodes)
// print missing episodes
episodeList.each{ e ->
println e
}