* fix myepisodes scraper

This commit is contained in:
Reinhard Pointner 2013-04-16 17:30:51 +00:00
parent cb8aa8d7d6
commit 2e71d710e3
2 changed files with 4 additions and 3 deletions

View File

@ -98,7 +98,7 @@ class MyEpisodesScraper {
get("http://www.myepisodes.com/views.php?type=manageshow&mode=add&showid=${showid}")
}
def update = { showid, season, episode, tick = 'acquired', value = '0' ->
def update = { showid, season, episode, tick = 'acquired', value = '1' ->
get("http://www.myepisodes.com/myshows.php?action=Update&showid=${showid}&season=${season}&episode=${episode}&${tick}=${value}")
}

View File

@ -3,6 +3,7 @@
def mesacc = login.split(':')
def mesadd = tryQuietly{ addshows.toBoolean() }
def mesupdate = tryQuietly { tick } ?: 'acquired'
def mesvalue = tryQuietly { value } ?: '1'
// import myepisodes scraper
include('fn:lib/ws')
@ -11,7 +12,7 @@ def mes = MyEpisodes(mesacc[0], mesacc[1])
def myshows = mes.getShowList()
// series name => series key (e.g. Doctor Who (2005) => doctorwho)
def collationKey = { s -> s == null ? '' : s.replaceAll(/\W/).replaceAll(/(?<!\d)\d{4}$/).lower() }
def collationKey = { s -> s == null ? '' : s.replaceAll(/^(?i)(The|A)\b/, '').replaceAll(/(?<!\d)\d{4}$/).replaceAll(/\W/).lower() }
args.getFiles{ it.isVideo() && parseEpisodeNumber(it) && detectSeriesName(it) }.groupBy{ detectSeriesName(it) }.each{ series, files ->
def show = myshows.find{ collationKey(it.name) == collationKey(series) }
@ -28,7 +29,7 @@ args.getFiles{ it.isVideo() && parseEpisodeNumber(it) && detectSeriesName(it) }.
files.each{
if (show != null) {
def sxe = parseEpisodeNumber(it)
mes.update(show.id, sxe.season, sxe.episode, mesupdate)
mes.update(show.id, sxe.season, sxe.episode, mesupdate, mesvalue)
println "[$mesupdate] $show.name $sxe [$it.name]"
} else {
println "[failure] '$series' has not been added [$it.name]"