Page 1 of 2

veetle plugin success !!

PostPosted: Mon Jun 11, 2012 11:39 am
by trigu75
kind of ..

using perl and unix I managed to create a script that gets all the streams sources and names and creates a EXTM3U playlist

and used the playlist plugin to read the extm3u file , and I'm able see all beetle channels on my TV

the question , how can I make a plugin that executes my script and tells serviio to "refresh" the playlist , this way the list gets updated with the latest streams ?

, I'll post the scripts soon , 3 files , a perl script is used to get http requests
a unix script that parses the http , gets some info , executes a 3rd script that gets the stream info from the web (again using the perl script) and output a m3u file having all the information

this file is loaded in serviio as web resources as a normal playlist (using the playlist plugin)

Re: veetle plugin success !!

PostPosted: Mon Jun 11, 2012 12:17 pm
by zip
couldn't all this be done via Groovy?

Re: veetle plugin success !!

PostPosted: Mon Jun 11, 2012 12:19 pm
by trigu75
and here are the files , you need the playlist plugin installed ..

you can use them to create m3u files

on linux or osx , extract the files to some directory (home directory)

then run

sh vetest > ent.m3u
for entretaomment category

sh veshow > show.m3u
for shows category

then edit the m3u file , remove the 6 first lines , add #EXTM3U to the beginning

then on serviio add the playlist to the web resource

example :

http://-SW-uhttp://192.168.0.15/ent.m3u ... O-SW-lLIVE

name veetle movies

and that's it , all is there ... now , from time to time you rerun the scripts , to get the updated list ... , and then go back to servo . uncheck the playlist , save check the playlist , save


maybe using this base someone else can make a better , real plugin

m3u gotten file should look like :

#EXTM3U

#EXTINF:-1,2012 FILMS
http://213.254.202.139/flv/4f91c2005baa6


#EXTINF:-1,BR2-EPICTV II malu00e8na
http://213.254.202.144/flv/4f12ef90bad73


#EXTINF:-1,u026a-u0280u1d07u029fu1d00x-u029cu1d07u0280u1d07.u0299u029fu1d0fu0262su1d18u1d0fu1d1b.u1d04u1d0fu1d0d
http://213.254.202.149/flv/4fab772264e27


#EXTINF:-1,ACTIu047aN Mu047aVIES
http://213.254.202.13/flv/4f9250c819808


#EXTINF:-1,*The Dictator & BattleShip*
http://89.149.156.211/flv/4f5f56aa32e85


#EXTINF:-1,Watch Movies Online at moviesanytime.u1d04u1d0fu1d0d
http://89.149.156.210/flv/4f57e9a486e54


#EXTINF:-1,PLUS....BATTLESHIP>>>.....
http://213.254.202.13/flv/4dfa967c9fdf0


#EXTINF:-1,~ Random Movies! ~
http://213.254.202.13/flv/4fbc50c46fcac


#EXTINF:-1,Teeburd's Lounge
http://213.254.202.141/flv/4f85e06f64e17


#EXTINF:-1,u2606u2606 Marvel u2606u2606
http://213.254.202.144/flv/4f5fb15db5d6b

Re: veetle plugin success !!

PostPosted: Mon Jun 11, 2012 12:24 pm
by trigu75
I guess it can , I just don't know groovy :)

I sent the way I get it to work ... maybe someone that knows groovy cam "translate" it to

and make this a better plugin .. (the thumbnail can be also be extracted , is $5 inside the awk that creates the ourput , I just didn't use it on m3u

Re: veetle plugin success !!

PostPosted: Mon Jun 11, 2012 4:52 pm
by trigu75
in groovy


mport groovy.json.JsonSlurper

def restResponse = new URL("http://veetle.com/index.php/listing/ajaxStreamByCategory/10/0/20/0").text
// Parse the response
def list = new JsonSlurper().parseText( restResponse )

list.payload.each {println it}

returns 20 channels , from there list.payload.channelId and list.payload.description are needed ...

channelID then is used again to get the stream link
which is the payload of http://veetle.com/index.php/stream/ajaxStreamLocation/ ' channelId ' /flash

if I knew how to put all that together in groovy then we already had the plugin :)

if you change the 20 and put 100 you will get 100 channels data

it's simple in groovy ... I wish I knew more ..

Re: veetle plugin success !!

PostPosted: Mon Jun 11, 2012 9:57 pm
by vaha
Thanks bro!! :)

Re: veetle plugin success !!

PostPosted: Tue Jun 12, 2012 5:23 am
by trigu75
ok .. looking at the ap web resource plugin , learning from it ..

I'm getting to it ..

in groovy
this , makes a m3u file from veetle entertainment category

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 )

def toal = list.totalCount as int // number of channels gotten

println "#EXTM3U"

for ( i = 0; i < toal ; i++) {

println "#EXTINF:-1,"+ list.payload.description [i]
def test = new URL ("http://veetle.com/index.php/stream/ajaxStreamLocation/" + list.payload.channelId [i]+"/flash").text
def link = new JsonSlurper().parseText( test )
println link.payload

}

just run it using groovy but output the results to a m3u file

so I guess I need to output that to serviio , and that's the way the plugging will get ready

Re: veetle plugin success !!

PostPosted: Tue Jun 12, 2012 10:04 am
by trigu75
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]

Re: veetle plugin success !!

PostPosted: Tue Jun 12, 2012 10:34 am
by zip
that looks good, the first part has to be in a proper method

  Code:
WebResourceContainer extractItems(URL resourceUrl, int maxItemsToRetrieve)

Re: veetle plugin success !!

PostPosted: Tue Jun 12, 2012 11:46 am
by trigu75
ok .. this is the code ... veetle gets added , no errors in log

just

Lion:log nurielt$ 2012-06-12 14:36:17,704 INFO [PluginCompilerThread] Added Web Resouce plugin veetle (test1.groovy)


but for some reason is empty

  Code:
 
import groovy.json.JsonSlurper
import org.serviio.library.metadata.*
import org.serviio.library.online.*
import org.serviio.util.*

class veetle extends WebResourceUrlExtractor {
       
        final VALID_FEED_URL = '^(?:http?://)?(?:www\\.)?veetle\\.com.*?'
       
        String getExtractorName() {
                return 'veetle'
        }
       
        boolean extractorMatches(URL feedUrl) {
                return feedUrl ==~ VALID_FEED_URL
        }


WebResourceContainer extractItems(URL resourceUrl, int maxItemsToRetrieve)
{

// 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( title: programName, additionalInfo: ['programID':programID])
                        println "item = $item"
                        items << item
                        itemsAdded++                   
                }
                       
                return new WebResourceContainer(title: 'http://www.veetle.com', 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 thumbnailUrl = item.thumbnail

                return new ContentURLContainer(fileType: MediaFileType.VIDEO, contentUrl: contentUrl, thumbnailUrl: thumbnailUrl , live: true)
        }

}


Re: veetle plugin success !!

PostPosted: Tue Jun 12, 2012 12:07 pm
by zip
did you add a URL to the console as a video WebResource ? Should be one to match the VALID_FEED_URL regex.

Re: veetle plugin success !!

PostPosted: Tue Jun 12, 2012 12:28 pm
by trigu75
yes ,

tried http://www.veetle.com

but I can't see is using the plugin

Re: veetle plugin success !!

PostPosted: Tue Jun 12, 2012 1:43 pm
by trigu75
ok .. changed a bit the code .. got it to load :)

but now I got this , so I'm checking all again :P

java.io.IOException: Unexpected error while invoking plugin (veetle): Expected a value on line: 1, column: 57975.
But got an unterminated object.
at org.serviio.library.online.WebResourceParser.parse(WebResourceParser.java:58)
at org.serviio.library.online.OnlineLibraryManager.findResource(OnlineLibraryManager.java:169)
at org.serviio.library.online.OnlineLibraryManager.findResourceInCacheOrParse(OnlineLibraryManager.java:184)
at org.serviio.library.online.metadata.FeedUpdaterThread.getOnlineItems(FeedUpdaterThread.java:158)
at org.serviio.library.online.metadata.FeedUpdaterThread.run(FeedUpdaterThread.java:95)
Caused by: groovy.json.JsonException: Expected a value on line: 1, column: 57975.
But got an unterminated object.
at groovy.json.JsonSlurper.parseObject(JsonSlurper.java:222)
at groovy.json.JsonSlurper.parseArray(JsonSlurper.java:114)
at groovy.json.JsonSlurper.parseObject(JsonSlurper.java:235)
at groovy.json.JsonSlurper.parse(JsonSlurper.java:75)
at groovy.json.JsonSlurper.parseText(JsonSlurper.java:59)
at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:230)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at veetle.extractItems(test1.groovy:26)
at org.serviio.library.online.WebResourceUrlExtractor.parseWebResource(WebResourceUrlExtractor.java:29)
at org.serviio.library.online.WebResourceParser.parse(WebResourceParser.java:56)
... 4 more

Re: veetle plugin success !!

PostPosted: Tue Jun 12, 2012 3:03 pm
by zip
the JSON object is not correct

Re: veetle plugin success !!

PostPosted: Tue Jun 12, 2012 4:14 pm
by trigu75
I finished

and works like a charm .. finally , serviio veetle

just put it in plugins folder , and add web resource address http://www.veetle.com and that's it

a few seconds later (just think it actually query every channel stream url)

it gets all the channels loaded :)

ENJOY !!!!!!!!!!!

updated , veetleshow.groovy added also for show category , web resource url , type http://www.veetles.com , name beetle shows

Currently lists channels from the movies area ..

I'll make another one for the sport area , and for the TV shows area and post it
now I need to work on adding the thumbnails which I disabled cause it gave me some errors ..

and one question ... what do I need to add to it so it gets refreshed with new or non working streams? (currently , to get the list updated it's enough the uncheck and check back again

Re: veetle plugin success !!

PostPosted: Tue Jun 12, 2012 7:37 pm
by zip
you can give the URL and expiry date which would expire the whole feed on that date. otherwise it'll recheck in the interval given in the console (cache expiry).

Also make sure you only get the number of items the user requires, and not all (which could be hundreds).

good job :-) Once you have a final version upload it to the Available plugins area.

Re: veetle plugin success !!

PostPosted: Wed Jun 13, 2012 8:19 am
by trigu75
posted in available plugins my files ..

thumbnails work , and TV shows gets you 20 most popular , while movies gets you 40 most popular .. and used the usernames instead of description which contained a lot of garbage

Re: veetle plugin success !!

PostPosted: Wed Jun 13, 2012 10:05 am
by zip
trigu75 wrote:thumbnails work , and TV shows gets you 20 most popular , while movies gets you 40 most popular .. and used the usernames instead of description which contained a lot of garbage

You should meet the user's selected number of items to retrieve, you are getting the number in the mehod prameter. Look at Channel4 plugin to see what I've done

Re: veetle plugin success !!

PostPosted: Wed Jun 13, 2012 12:24 pm
by trigu75
done ... current plugin (in available plugins) , any number you add after / is the number of channels you ask to retrieve ..

if the payload is bigger than the requested , then the payload becomes the number of requested items , else it will use the amount of channels that can be retrieved (which are less than the number the user asked)

sometimes I see in the log this error which I have no idea how to solve

the plugins work fine what so ever .. and sometimes this error appear ..


java.io.IOException: Unexpected error while invoking plugin (veetle): Lexing failed on line: 1, column: 2, while reading '�', no possible valid JSON value or punctuation could be recognized.
at org.serviio.library.online.WebResourceParser.parse(WebResourceParser.java:58)
at org.serviio.library.online.OnlineLibraryManager.findResource(OnlineLibraryManager.java:169)
at org.serviio.library.online.OnlineLibraryManager.findResourceInCacheOrParse(OnlineLibraryManager.java:184)
at org.serviio.library.online.metadata.FeedUpdaterThread.getOnlineItems(FeedUpdaterThread.java:158)
at org.serviio.library.online.metadata.FeedUpdaterThread.run(FeedUpdaterThread.java:95)
Caused by: groovy.json.JsonException: Lexing failed on line: 1, column: 2, while reading '�', no possible valid JSON value or punctuation could be recognized.
at groovy.json.JsonLexer.nextToken(JsonLexer.java:84)
at groovy.json.JsonSlurper.parse(JsonSlurper.java:73)
at groovy.json.JsonSlurper.parseText(JsonSlurper.java:59)
at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:230)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at veetleis.extractItems(veetle.groovy:26)
at org.serviio.library.online.WebResourceUrlExtractor.parseWebResource(WebResourceUrlExtractor.java:29)
at org.serviio.library.online.WebResourceParser.parse(WebResourceParser.java:56)
... 4 more

Re: veetle plugin success !!

PostPosted: Wed Jun 13, 2012 1:24 pm
by zip
that looks like dodgy json document, you should try to retrieve it manually and check what form it has