* fix myepisodes scraper
This commit is contained in:
parent
cb8aa8d7d6
commit
2e71d710e3
|
@ -98,7 +98,7 @@ class MyEpisodesScraper {
|
||||||
get("http://www.myepisodes.com/views.php?type=manageshow&mode=add&showid=${showid}")
|
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}")
|
get("http://www.myepisodes.com/myshows.php?action=Update&showid=${showid}&season=${season}&episode=${episode}&${tick}=${value}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
def mesacc = login.split(':')
|
def mesacc = login.split(':')
|
||||||
def mesadd = tryQuietly{ addshows.toBoolean() }
|
def mesadd = tryQuietly{ addshows.toBoolean() }
|
||||||
def mesupdate = tryQuietly { tick } ?: 'acquired'
|
def mesupdate = tryQuietly { tick } ?: 'acquired'
|
||||||
|
def mesvalue = tryQuietly { value } ?: '1'
|
||||||
|
|
||||||
// import myepisodes scraper
|
// import myepisodes scraper
|
||||||
include('fn:lib/ws')
|
include('fn:lib/ws')
|
||||||
|
@ -11,7 +12,7 @@ def mes = MyEpisodes(mesacc[0], mesacc[1])
|
||||||
def myshows = mes.getShowList()
|
def myshows = mes.getShowList()
|
||||||
|
|
||||||
// series name => series key (e.g. Doctor Who (2005) => doctorwho)
|
// 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 ->
|
args.getFiles{ it.isVideo() && parseEpisodeNumber(it) && detectSeriesName(it) }.groupBy{ detectSeriesName(it) }.each{ series, files ->
|
||||||
def show = myshows.find{ collationKey(it.name) == collationKey(series) }
|
def show = myshows.find{ collationKey(it.name) == collationKey(series) }
|
||||||
|
@ -28,7 +29,7 @@ args.getFiles{ it.isVideo() && parseEpisodeNumber(it) && detectSeriesName(it) }.
|
||||||
files.each{
|
files.each{
|
||||||
if (show != null) {
|
if (show != null) {
|
||||||
def sxe = parseEpisodeNumber(it)
|
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]"
|
println "[$mesupdate] $show.name $sxe [$it.name]"
|
||||||
} else {
|
} else {
|
||||||
println "[failure] '$series' has not been added [$it.name]"
|
println "[failure] '$series' has not been added [$it.name]"
|
||||||
|
|
Loading…
Reference in New Issue