BBC iPlayer

Discuss third-party additions, plugins and translations for PS3 Media Server

Re: BBC iPlayer

Postby gregd72002 » Mon Mar 05, 2012 7:28 pm

Now, a question to someone smart - I'd like to extend this with 2 ideas:
1) add a custom menu that will allow to change 'mode' that is passed over to the downloader (--mode=flashstd); the menu should have 3 items: Standard, High, HD; once an option is selected it should be remembered and next time the script runs --mode=flashstd, --mode=flashvhigh, --mode=flashhd will be added to the $DOWNLOADER respectively

2) the feed (http://feeds.bbc.co.uk/iplayer/popular/tv) retrieves hundred if not more entries; it would be great if I could sort them and display in A-Z folders; alternatively I would consider getting rid of the feed and render entries from a file? Is this possible? The idea is to create a file that will contain all the movies in A-Z folders and then to make PS3 Media Server to read the file and display the content as it was a feed

Hope someone can elaborate on this. Thanks
gregd72002
 
Posts: 16
Joined: Wed Feb 29, 2012 8:24 pm

Re: BBC iPlayer

Postby chocolateboy » Mon Mar 05, 2012 7:41 pm

chocolateboy
Project Member
 
Posts: 2577
Joined: Wed Sep 16, 2009 10:05 am

Re: BBC iPlayer

Postby gregd72002 » Mon Mar 05, 2012 8:47 pm

Thanks for the elaboration ;) Though, it got me on the right track I believe :)
gregd72002
 
Posts: 16
Joined: Wed Feb 29, 2012 8:24 pm

Re: BBC iPlayer

Postby gregd72002 » Mon Mar 05, 2012 10:51 pm

Ok, I need a bit more help with Channel script.
The problem is now - can a URL point a physical file on hdd?
My script looks like so:
Code: Select all
version=0.1

channel BBC iPlayer {
        folder {
                name=A-Z
                type=ATZ
                pre_script=./channels/bbciplayer/update //. is the Java folder of PS3MS
                url=./channels/bbciplayer/list
                folder {
                        url=./channels/bbciplayer/list
                        matcher=<url>[^\<]
                        # a title=\"[^\"]+\" class=\"[^\"]+\"\s+href=\"([^\"]+)\">\s+([^<]+)</a>
                        order=url
                        # url=http://www.kanal5play.se
                }
        }
}


and my list file:
Code: Select all
<?xml version="1.0" ?>
<MediaStreams>
        <Streams>
                <Name>2012</Name>
                <Stream>
                        <Name>Scottish Labour Party Conference</Name>
                        <type>tv</type>
                        <index>1</index>
                        <url>b01d98hn.mov</url>
                        <Subtitle></Subtitle>
                        <Synopsis>Live coverage of the Scottish Labour Party Conference from Dundee.</Synopsis>
                        <StreamImage>http://www.bbc.co.uk/iplayer/images/episode/b01d98hn_150_84.jpg</StreamImage>
                </Stream>
                <Stream>
                        <Name>Scottish Liberal Democrat Party Conference</Name>
                        <type>tv</type>
                        <index>2</index>
                        <url>b01d98lc.mov</url>
                        <Subtitle></Subtitle>
                        <Synopsis>Coverage of the Scottish Liberal Democrat Party Conference from Inverness.</Synopsis>
                        <StreamImage>http://www.bbc.co.uk/iplayer/images/episode/b01d98lc_150_84.jpg</StreamImage>
                </Stream>
        </Streams>
</MediaStreams>


When I open Channels, go to A-Z folders and then I open letter B the pre_script (./channels/bbciplayer/update) gets executed perfectly fine but I do not see any entries. Why? I was expecting the matcher to kick in and match two <url> node?
gregd72002
 
Posts: 16
Joined: Wed Feb 29, 2012 8:24 pm

Re: BBC iPlayer

Postby chocolateboy » Tue Mar 06, 2012 10:06 pm

gregd72002 wrote:can a URL point a physical file on hdd?


https://en.wikipedia.org/wiki/File_URI_scheme
chocolateboy
Project Member
 
Posts: 2577
Joined: Wed Sep 16, 2009 10:05 am

BBC iPlayer (SOLVED)

Postby gregd72002 » Wed Mar 07, 2012 12:25 am

This should be easy to follow on *nix systems (linux/osx); on Windows, we would need a separate set of instructions though these should not be far away from what is documented below.

Requirements:
1) pmsencoder plugin
2) channel plugin

Instructions:
1) download and unpack get_iplayer from http://www.infradead.org/get_iplayer/ht ... layer.html (preferably into PS3MS Java folder - OSX)
2) download flvstreamer from http://download.savannah.gnu.org/releases/flvstreamer/; save it so its name is flvstreamer into above get_iplayer folder; if you are on *nix system you might want to chmod +x ./flvstreamer
3) within get_iplayer folder create a file called update with the following content
Code: Select all
#!/bin/sh

# working directory is Java folder

./get_iplayer/get_iplayer --xml-alpha --mythtv /tmp/list

exit 0

4) make the file executable (chmod +x ./update)
5) place the following channel_bbciplayer.groovy script in pmsencoder folder (on OSX it is PS3 Media Server.app/Contents/Resources/Java/scripts)
Code: Select all
script {
    profile ('BBC iPlayer') {
        pattern {
                //this URL must match the URL from bbciplayer.ch (channel) script
            match $URI: '^http://channel/bbc/(?<pid>........)'
        }

        action {

        //working folder is Java folder
            def GETIPLAYER_PATH = "./get_iplayer"
            def SHELL = "/bin/sh"
            def PERL = "/usr/bin/perl"
            //def mode = "flashhd"
            def mode = "flashhigh,flashstd,flashvhigh"

            $DOWNLOADER = [ "${SHELL}", "-c", "${PERL} ${GETIPLAYER_PATH}/get_iplayer --pid ${pid} --mode=${mode} --flvstreamer ${GETIPLAYER_PATH}/flvstreamer --overwrite --stream >> ${DOWNLOADER_OUT}"]
        }
    }
}


6) place the following bbciplayer.ch script in channels folder (on OSX it is PS3 Media Server.app/Contents/Resources/Java/channels)
Code: Select all
version=0.1

channel BBC iPlayer {
   folder {
      name=A-Z
      type=ATZ
      #the url below has to be absolute; relative physical (file) url are known not to work with URLConnection class which is used in channels
      url=file:///tmp/list
      folder {
#the url below must match the url in channel_bbciplayer.groovy file and must be valid as per RFC 1738 (though pmsencoder allows for RFC 2396)
         url=http://channel/bbc/
         matcher=<Name>([^<]+)</Name>\s*<index>[^<]*</index>\s*<type>[^<]*</type>\s*<Url>(........).mov</Url>\s*<StreamImage>([^<]+)</StreamImage>\s*<Subtitle>[^<]*</Subtitle>\s*<Synopsis>[^<]*</Synopsis>
         order=name,url,thumb
         type=normal
         media {
            escript=dummy
            prop=script.no_format
            format=video
         }
      }
   }
   folder {
      name=UPDATE
      type=normal
   #the working path is set to Java folder
      pre_script=./get_iplayer/update
   #   this below does not work, somehow channels ignores it if the script has any arguments
   #   pre_script=./channels/bbciplayer/get_iplayer/get_iplayer --xml-alpha --mythtv /tmp/list
   }
}


7) Switch on PS3MS and a renderer, navigate to Channels/BBC iPlayer folder and you should see A-Z folder and UPDATE folder; first enter UPDATE folder; this should invoke update script and create /tmp/list file with list of channels
8) if this above is a case you can navigate back to A-Z folder, select a channel and enjoy!

Consideration:
/tmp/list path - bear in mind privileges
get_iplayer location and relation to Java folder
Need to change quality? - Edit bbciplayer.groovy script and search/replace 'flashstd' into one of the following: flashhd,flashvhigh,flashhigh,flashstd,flashnormal,flashlow

Troubleshooting:
1) from shell level execute file and verify that /tmp/list is created and contains channel information
2) run get_iplayer from your command line/shell and verify that you are able to download an FLV movie

When debugging please post:
channels.log and pmsencoder.log
gregd72002
 
Posts: 16
Joined: Wed Feb 29, 2012 8:24 pm

Re: BBC iPlayer

Postby gregd72002 » Wed Mar 07, 2012 12:28 am

chocolateboy wrote:
gregd72002 wrote:can a URL point a physical file on hdd?


https://en.wikipedia.org/wiki/File_URI_scheme

URL != URI
(RFC 1738 != RFC 2396)

Anyway, I'm already fed up with it. BBC iPlayer is now working with Channel plugin (full program listing) (viewtopic.php?f=12&t=13740)
and without Channel plugin (based on feed called 'most popular') - this thread
gregd72002
 
Posts: 16
Joined: Wed Feb 29, 2012 8:24 pm

Re: BBC iPlayer

Postby chocolateboy » Sat Mar 10, 2012 3:37 pm

gregd72002 wrote:URL != URI
(RFC 1738 != RFC 2396)


gregd72002 wrote:
Code: Select all
url=file:///tmp/list


You're welcome.

(Incidentally, when trying to derail a discussion by nitpicking a working solution, it's a good idea to actually read the cited documents (hint: URLs are URIs; locations are identifiers), if only to discover that RFC 1738 and RFC 2396 are updated and obsoleted by RFC 3986.)

If you have further questions about the syntax of Channel files, take them up in the relevant thread.

Thread locked.
chocolateboy
Project Member
 
Posts: 2577
Joined: Wed Sep 16, 2009 10:05 am

Previous

Return to Additions and Plugins

Who is online

Users browsing this forum: Bing [Bot] and 6 guests