MasterPuppeteer

Updates API url to avoid redirect.

......@@ -27,27 +27,27 @@ import tv.puppetmaster.data.i.*
import tv.puppetmaster.data.i.Puppet.PuppetIterator
import tv.puppetmaster.data.i.SourcesPuppet.SourceDescription
public class ComicVinePuppet implements InstallablePuppet {
class ComicVinePuppet implements InstallablePuppet {
static final int VERSION_CODE = 5
def ParentPuppet mParent
def String mBaseUrl
def String mName
def String mDescription
def String mUrl
def String mImageUrl
def String mBackgroundImageUrl
def boolean mIsTopLevel
ParentPuppet mParent
String mBaseUrl
String mName
String mDescription
String mUrl
String mImageUrl
String mBackgroundImageUrl
boolean mIsTopLevel
public ComicVinePuppet() {
ComicVinePuppet() {
this(
null,
"http://api.comicvine.com",
"https://comicvine.gamespot.com/api",
"Comic Vine",
"Comic Vine is the world's largest comic book website. Watch hundreds of original videos and interviews with comic creators and artists.",
"/video_types/?api_key=c64ac7ddc90513cc15539f1d606e8670b1ef0ae4&format=json",
"https://raw.githubusercontent.com/WhiskeyMedia/xbmc/master/plugin.video.comicvine/icon.png",
"https://pbs.twimg.com/profile_images/838844221880578048/JqUAMeZr_400x400.jpg",
"http://static.comicvine.com/uploads/original/8/85249/3158213-project",
true
)
......@@ -173,45 +173,45 @@ public class ComicVinePuppet implements InstallablePuppet {
mUrl = url
}
def static class ComicVineSearchesPuppet extends ComicVinePuppet implements SearchesPuppet {
static class ComicVineSearchesPuppet extends ComicVinePuppet implements SearchesPuppet {
def static final String SEARCH_URL = "/search/?api_key=c64ac7ddc90513cc15539f1d606e8670b1ef0ae4&format=json&resources=video&query="
static final String SEARCH_URL = "/search/?api_key=c64ac7ddc90513cc15539f1d606e8670b1ef0ae4&format=json&resources=video&query="
public ComicVineSearchesPuppet(ParentPuppet parent) {
ComicVineSearchesPuppet(ParentPuppet parent) {
super(
parent,
"http://api.comicvine.com",
"https://comicvine.gamespot.com/api",
"Search",
"Search Comic Vine",
SEARCH_URL,
"https://raw.githubusercontent.com/WhiskeyMedia/xbmc/master/plugin.video.comicvine/icon.png",
"https://pbs.twimg.com/profile_images/838844221880578048/JqUAMeZr_400x400.jpg",
"http://static.comicvine.com/uploads/original/8/85249/3158213-project",
false
)
}
@Override
public void setSearchQuery(String searchQuery) {
void setSearchQuery(String searchQuery) {
setUrl(SEARCH_URL + searchQuery.replace(" ", "%20"))
}
}
def class ComicVineIterator extends PuppetIterator {
class ComicVineIterator extends PuppetIterator {
def ParentPuppet mParent
def String mBaseUrl
def String mUrl
def ArrayList<Puppet> mPuppets
ParentPuppet mParent
String mBaseUrl
String mUrl
ArrayList<Puppet> mPuppets
def int numSources = 0
int numSources = 0
def int currentCategoryIteration = 0
def int currentSourcesIteration = 0
int currentCategoryIteration = 0
int currentSourcesIteration = 0
transient def JSONArray categoryItems = new JSONArray()
transient def JSONArray sourcesItems = new JSONArray()
transient JSONArray categoryItems = new JSONArray()
transient JSONArray sourcesItems = new JSONArray()
public ComicVineIterator(ParentPuppet parent, String baseUrl, String url) {
ComicVineIterator(ParentPuppet parent, String baseUrl, String url) {
mParent = parent
mBaseUrl = baseUrl
mUrl = url
......@@ -225,11 +225,11 @@ public class ComicVinePuppet implements InstallablePuppet {
if(mParent.isTopLevel()) {
mPuppets.add(new ComicVinePuppet(
null,
"http://api.comicvine.com",
"https://comicvine.gamespot.com/api",
"Latest",
"Latest videos from Comic Vine",
"/videos/?api_key=c64ac7ddc90513cc15539f1d606e8670b1ef0ae4&sort=-publish_date&format=json",
"https://raw.githubusercontent.com/WhiskeyMedia/xbmc/master/plugin.video.comicvine/icon.png",
"https://pbs.twimg.com/profile_images/838844221880578048/JqUAMeZr_400x400.jpg",
"http://static.comicvine.com/uploads/original/8/85249/3158213-project",
false
))
......@@ -262,7 +262,7 @@ public class ComicVinePuppet implements InstallablePuppet {
item.get("name").toString(),
null,
"/videos/?api_key=c64ac7ddc90513cc15539f1d606e8670b1ef0ae4&format=json&video_type=" + item.get("id").toString(),
"https://raw.githubusercontent.com/WhiskeyMedia/xbmc/master/plugin.video.comicvine/icon.png",
"https://pbs.twimg.com/profile_images/838844221880578048/JqUAMeZr_400x400.jpg",
"http://static.comicvine.com/uploads/original/8/85249/3158213-project",
false
))
......@@ -291,19 +291,19 @@ public class ComicVinePuppet implements InstallablePuppet {
}
}
def static class ComicVineSourcesPuppet implements SourcesPuppet {
static class ComicVineSourcesPuppet implements SourcesPuppet {
def ParentPuppet mParent
def String mName
def String mDescription
def String mHighQualityVideoUrl
def String mLowQualityVideoUrl
def String mPublicationDate
def long mDuration
def String mImageUrl
def String mBackgroundImageUrl
ParentPuppet mParent
String mName
String mDescription
String mHighQualityVideoUrl
String mLowQualityVideoUrl
String mPublicationDate
long mDuration
String mImageUrl
String mBackgroundImageUrl
public ComicVineSourcesPuppet(ParentPuppet parent, String name, String description, String highUrl, String lowUrl, String publishDate, String lengthSeconds, String imageUrl, String backgroundImageUrl) {
ComicVineSourcesPuppet(ParentPuppet parent, String name, String description, String highUrl, String lowUrl, String publishDate, String lengthSeconds, String imageUrl, String backgroundImageUrl) {
mParent = parent
mName = name
mDescription = description
......@@ -386,23 +386,23 @@ public class ComicVinePuppet implements InstallablePuppet {
}
@Override
public PuppetIterator getRelated() {
PuppetIterator getRelated() {
mParent.getChildren()
}
@Override
public String toString() {
String toString() {
return mParent == null ? getName() : mParent.toString() + " < " + getName()
}
def class ComicVineSourceIterator implements SourcesPuppet.SourceIterator {
class ComicVineSourceIterator implements SourcesPuppet.SourceIterator {
def String mHighQualityVideoUrl
def String mLowQualityVideoUrl
def List<SourceDescription> mSources
def int currentIndex = 0
String mHighQualityVideoUrl
String mLowQualityVideoUrl
List<SourceDescription> mSources
int currentIndex = 0
public ComicVineSourceIterator(String highQualityVideoUrl, lowQualityVideoUrl) {
ComicVineSourceIterator(String highQualityVideoUrl, lowQualityVideoUrl) {
mHighQualityVideoUrl = highQualityVideoUrl
mLowQualityVideoUrl = lowQualityVideoUrl
}
......