From 2e71d710e3ddd68079cbbf9d60bcef6a8abdd2cb Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 16 Apr 2013 17:30:51 +0000 Subject: [PATCH] * fix myepisodes scraper --- website/scripts/lib/ws.groovy | 2 +- website/scripts/update-mes.groovy | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/website/scripts/lib/ws.groovy b/website/scripts/lib/ws.groovy index 0a71db3b..66a00bdd 100644 --- a/website/scripts/lib/ws.groovy +++ b/website/scripts/lib/ws.groovy @@ -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}") } diff --git a/website/scripts/update-mes.groovy b/website/scripts/update-mes.groovy index dc3f0d23..936b5abb 100644 --- a/website/scripts/update-mes.groovy +++ b/website/scripts/update-mes.groovy @@ -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(/(? s == null ? '' : s.replaceAll(/^(?i)(The|A)\b/, '').replaceAll(/(? 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]"