New BBC Wiki

March 19th, 2008 by Strawp

I’ve created a new wiki all about using BBC content at beebhack.bluwiki.com

In the first 24 hrs it got 1500 page requests and it’s not looking to slow down just yet. I would have hosted it here at Strawp.net but I wanted this to be more community owned than something I would run.

The downside of course is that I really don’t have any detailed information on where any of those hits are coming from…

21 Responses to “New BBC Wiki”

  1. ThatGuy Says:

    Looks good, I’ve added a few words around Programme Ids.

  2. FreddyFr0g Says:

    @Strawp,
    Thanks for the great script. I played a bit with it because I wanted to be able to stream the .mov file using VLC. I thought I could use your script to get to the .mov file and act as a proxy to serve VLC with it. So I can now access the file via my local Apache server and open a link in VLC, something like http://localhost/iplayer_dl.php (later on we can add ?pid=xxx to get to any .mov file… I’ve hardcoded Mad men for now, see why below) and I managed to get the .mov file to stream to VLC. The only problem is that the script needs to know before hand how big is the file $byte_to_send =174815984; was hardcoded to the right size of the Mad Men .mov file. I’m sure one can use curl to do a HEAD request to see how big is the file or something but I just couldn’t work it out just yet and was wondering if you could help!
    I’m sure since you wrote the script that you won’t any problems droping the new file on one of you website and test it by calling the URL via VLC (I’m suggesting to go view->messages just before so that you have a bit more information about what’s going on, it can take up to 15 seconds to load) or just have a look at what I’ve changed – I based the work on Up All Night : Streaming Shoutcast on the iPhone.
    There’s a lot of commented lines in the code as I was trying to debug the whole thing, I really hope you can improve what I’ve done so that we can stream the content rather than having to have to download it.
    Here’s attached your script that I have modified.
    Thanks,
    FreddyFr0g

    File: http://download.yousendit.com/CD1160E541070449

  3. Strawp Says:

    That’s an interesting idea. Have you looked at what headers are sent back from the server when pulling down a file? You could simply echo what the server says or if it’s missing entirely then you might be able to get away without using “Content-length” at all.

    Have you managed to progressively echo output from curl as it’s downloading? I’ve not used curl a great deal, so I’m not sure if there’s an option to do that, but if there isn’t perhaps it can be achieved by using a progress function to print out the file contents to that point. If you create a function that doesn’t flush the output buffer then you could just print every few bytes and it’ll act like a normal HTTP stream (hopefully).

    Hope that gives you some ideas.

  4. Strawp Says:

    Oh, also if you use set_time_limit() inside a loop with a small value (e.g. 1) then it will act to extend the timeout of the script as long as the loop is still running – more of a robust way of doing it than guessing how long the script is going to take to run at the top.

  5. FreddyFr0g Says:

    That works great with that one episode for now, great not to have to download everything before hand or to jump in the middle of the video as well!

  6. FreddyFr0g Says:

    I thought of looking at the headers that are sent back using curl_getinfo but didn’t manage to print/display anything using this. I thought you were a curl expert (you probably know more than me!) and would solve that little problem quickly 😉 !

  7. FreddyFr0g Says:

    From the work I’ve done yesterday on it (especially reading and implementing bits from blog.fuexy.com/2007/11/03/streaming-shoutcast-on-the-iphone/) the Content-lenght header is key for VLC to work, I can see from the debug file (I commented out the debug stuff in the php script I uploaded) that after requesting the movie with Range 0-, VLC is making a new request for Range !somewhere at the end of the mov file!- – probably to check the streaming parameters that I read somewhere was sometimes at the end of .mov files (footer). Then VLC makes some more query with different ranges, that’s how you can move the cursor halway thru the .mov file, VLC will do another query starting with a higher Range .

    Flushing bit I forgot about mentionning that I enabled auto-flush in php.ini, I also used curl_setopt($ch,CURLOPT_PROGRESSFUNCTION,’progress’); to flush everything out regularly – not sure it’s needed though as curl_exec( $ch ); will output to std out and VLC is buffering anyway.

    Like your set_time_limit idea as the script would probably timeout at some point!

  8. FreddyFr0g Says:

    *Sorry* about the multiple post, I couldn’t get it in in one go because I was using greater than lesser than chars! took me 2 posts to realise

  9. Strawp Says:

    One the HTTP headers thing – Wireshark is your friend. Get that running while your script is going to see exactly what headers are going back and forth.

    Have you tried setting the content-length to a ridiculously high number?

  10. Strawp Says:

    I’ve caught the headers from curl by turning on headers. AFAIK the info you can get by querying a curl session using is limited to a specific set: http://uk.php.net/manual/en/function.curl-getinfo.php

  11. FreddyFr0g Says:

    I’ll have a look at wireshark. I tried setting content-lenght very high, and basically if it’s too high than VLC is requesting something that is out of range so that’s no good. If it’s too small, then VLC doesn’t find any useful info and stops. It’s working with a number bit smaller than the actual size… so plan B would be to take the running time from the XML info sheet and multiply this by the 514Kps stream to get an approx. of the file size!

    Headers: do you mean by doing curl_setopt( $ch, CURLOPT_HEADER, 1 ); ? I didn’t find the manual page too detailed and helpful but I thought yesterday that CURLINFO_CONTENT_LENGTH_DOWNLOAD would do the job

  12. Strawp Says:

    That’ll probably do it. Can you query that info before the curl session has finished executing though? Possibly not if it comes back empty. Watching for the headers going past might be the way around it.

  13. FreddyFr0g Says:

    Yes, I think it needs to take place after a curl_exec( $ch )…. probably needs a in between get just to check out the headers… can’t wait to have some more free time to play with this, feel free to play some more though! Did you try it as it is?

  14. Strawp Says:

    No, I haven’t had a chance yet. It’s probably not something I’d end up using much though – between dumping a show to file and the XBMC client that pretty much has my iPlayer requirements filled.

  15. FreddyFr0g Says:

    Have they just fixed the Range problem? Don’t seem to be able to download anything? It was fine 10 minutes ago!
    I swear I just had the content-length fixed!

  16. Strawp Says:

    My download script still works. Is it that you have it coded for Mad Men and it’s now expired?

  17. FreddyFr0g Says:

    Panic is over… I had to reboot my PC for some reasons and then it all went back to normal!
    This script will stream any available content for iphone in VLC, I’m not sure if there are still some OS that can’t have access to the BBC iPlayer (or people that still don’t want to install flash!), that would enable them – as long as they have VLC – to stream the show, no waiting for downloads to be completed 😉

    Link: http://download.yousendit.com/1E5E37BE2484FDE6

    Thanks for the original PHP script Strawp!

  18. Strawp Says:

    Nice one! What’s the Icy-MetaData header for?

    Do you have a site you can permanently host it on so it can be linked from the Wiki?

  19. FreddyFr0g Says:

    Re: Icy-Metadata – Don’t know exactly to be honest, I was just trying to mimic the headers sent by VLC, probably best to remove it!
    Don’t have a website – I posted the file in this forum (http://world-of-digital.com) if anyone is interested

  20. PT-1 Says:

    @Freddy

    I will host it for you as usual 😉

    @Strawp

    do you want to publish this in the XBMC Forum too ?

    Regards

    PT-1

  21. Strawp Says:

    Sure, go ahead!