MasterPuppeteer

Fixes revisiting puppet issue.

......@@ -161,29 +161,7 @@ class CBCPuppet implements InstallablePuppet {
@Override
PuppetIterator getChildren() {
mChildren = new BasePuppetIterator()
if (mItems != null) {
for (int i = 0; i < mItems.length(); i++) {
JSONObject item = mItems.getJSONObject(i)
String url = null
try {
url = item.getJSONArray('assetDescriptors').getJSONObject(0).getString('key')
} catch (ignore) {
}
if (url) {
mChildren.add(new CBCSourcesPuppet(
this,
item.getString('title'),
item.getString('description'),
item.getString('thumbnail'),
item.getBoolean('isLive'),
item.getDouble('duration'),
item.getLong('airDate'),
url,
))
}
}
} else {
if (mParent == null) {
String page = new URL(BASE_URL).getText(requestProperties: [
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36',
])
......@@ -227,6 +205,28 @@ class CBCPuppet implements InstallablePuppet {
))
}
}
} else {
for (int i = 0; i < mItems.length(); i++) {
JSONObject item = mItems.getJSONObject(i)
String url = null
try {
url = item.getJSONArray('assetDescriptors').getJSONObject(0).getString('key')
} catch (ignore) {
}
if (url) {
mChildren.add(new CBCSourcesPuppet(
this,
item.getString('title'),
item.getString('description'),
item.getString('thumbnail'),
item.getBoolean('isLive'),
item.getDouble('duration'),
item.getLong('airDate'),
url,
))
}
}
}
return mChildren
}
......