is this the way to do it??
please help ,
import groovy.json.JsonSlurper
// Example Response Data
def restResponse = new URL("http://veetle.com/index.php/listing/ajaxStreamByCategory/10/0/199/0").text
// Parse the response
def list = new JsonSlurper().parseText( restResponse )
// Print them out to make sure
def toal = list.totalCount as int
List<WebResourceItem> items = []
def itemsAdded = 0;
for( int i = 0; i < toal ; i++) {
String programName = list.payload.description [i]
String programID = list.payload.channelId [i]
String thumbu= list.payload.thumbnailUrl [i]
WebResourceItem item = new WebResourceItem(thumbnail: thumbu, title: programName, AdditionalInfo: ['programID':programID])
println "item = $item"
items << item
itemsAdded++
}
return new WebResourceContainer(title: pageTitle, items: items)
ContentURLContainer extractUrl(WebResourceItem item, PreferredQuality requestedQuality) {
String programID = item.getAdditionalInfo()['programID']
assert programID != null
def test = new URL ("http://veetle.com/index.php/stream/ajaxStreamLocation/" + programID + "/flash").text
def link = new JsonSlurper().parseText( test )
String contentUrl = link.payload
String thumbUrl = item.thumbnail
return new ContentURLContainer(fileType: MediaFileType.VIDEO, contentUrl: contentUrl, thumbnailUrl: thumbUrl, live: true)
}
~
this is the output of LIST , and the programID is then transformed to the stream file
item = thumbnail:
http://image.veetle.com//channel_logos/ ... 28x297.jpg, title: Broadcasting LIVE, AdditionalInfo: ['programID':4fc755eeb8cb6]
item = thumbnail:
http://image.veetle.com/channel_logos/5 ... 28x297.jpg, title: So You Would Like To Be on TV
http://www.theagent.biz, AdditionalInfo: ['programID':4d2b5a98a9505]
item = thumbnail:
http://image.veetle.com//channel_logos/ ... 28x297.jpg, title: BREAKING BAD STAFFEL 1-4 - Solltet Ihr Probleme mit dem Stream haben dr?ckt mal das blaue "HD"-K?stchen, Viel Spa?!, AdditionalInfo: ['programID':4f26ebaa8ab1b]
item = thumbnail:
http://image.veetle.com/channel_logos/c ... 28x297.jpg, title: Television de La Serena Chile, AdditionalInfo: ['programID':4c5e177728cc4]
item = thumbnail:
http://image.veetle.com/channel_thumbs/ ... 28x297.jpg, title: Broadcasting live, AdditionalInfo: ['programID':4f9673fb112c2]
item = thumbnail:
http://image.veetle.com//channel_logos/ ... 28x297.jpg, title: The Gift of Everlasting Life, AdditionalInfo: ['programID':4f74dfaed6f87]
item = thumbnail:
http://image.veetle.com//channel_logos/ ... 28x297.jpg, title: tiha44ever blogspot com, AdditionalInfo: ['programID':4fd4c7aaaf095]