Page 1 of 18

SvtPlay

PostPosted: Mon Nov 19, 2012 2:55 pm
by ottomatic
WebResource plugin and separate Rss feed plugin to play contents from http://www.svtplay.se.

Edit 2016-03-11: Posted version 2 of the Rss feed plugin and version 22 of the Web resource plugin to respond to changes in markup.

Edit 2015-08-06: Posted version 21 of the Web resource plugin to respond to changes in markup.
But folks: you will be better off using the rss feed plugin!

Edit 2014-12-20: Posted version 20 of the Web resource plugin to respond to recent changes in markup.
MORE IMPORTANTLY: There is now also an Rss feed plugin for the SvtPlay site. This may be preferred over the WebResource plugin because it gives proper information regarding publishing date for individuel shows / episodes. Instructions further down


Full instructions are in the plugin source, with the most important stuff pasted below.

Enjoy!

/ Otto
/**
* RSS / Atom feed plugin for Serviio Media Server
* Works with SvtPlay.se
*
* On almost all pages in the SvtPlay site, you may append /rss.xml at the end
* to get an RSS feed for items on that page.
*
* Example:
* Latest documentaries are found at:
* http://www.svtplay.se/dokumentar/
*
* The RSS feed for those items are at:
* http://www.svtplay.se/dokumentar/rss.xml
*

__________________________________________

/**
* SvtPlay.se Web resource plugin.
*
* ##############################################
* Resource URL instructions
* ##############################################
*
* This is a plugin of the type "Web Resource" ("Webbresurs").
*
* There is a separate plugin for RSS feeds, which may be prefered as it gives accurate
* information about the publishing date of each individual episode.
*
* Find URLs for categories by navigating to your desired category at the top of http://www.svtplay.se/program
* Right click on your desired category's thumb nail image and copy the shortcut to the clipboard. For documentaries
* ths URL is http://www.svtplay.se/dokumentar. By default this will give you *the latest* episiodes
* for your selected show.
*
* You can also add individual shows, links to which are also found at:
* http://www.svtplay.se/program
* For example, the show "Fotbollskväll" has the feed URL
* http://www.svtplay.se/fotbollskvall
*
* As of version 17, the plugin understands the tab=<tabname> parameters at the end of the URL:s.
* So, if you navigate to a show (or category) and then press a button for "Populäraste", "Senaste",
* "Sista chansen" or "Klipp", you will get the episodes by that filter if you copy the resulting
* URL from the address field of your web browser.
*
* Example. To get the latest shows of "Fotbollskväll", register the URL:
* http://www.svtplay.se/fotbollskvall
*
* If you want one feed to display ONLY the shows and another feed to display ONLY the clips,
* use these two feed urls:
* 1) http://www.svtplay.se/fotbollskvall
* 2) http://www.svtplay.se/fotbollskvall?tab=klipp
*
* If you want a feed with the latest shows AS WELL as the clips, you will need to register a special URL:
* http://www.svtplay.se/fotbollskvall?serviioclips=1
*
* For the most popular children's shows, register the URL:
* http://www.svtplay.se/barn?tab=populara
*
* For film and drama shows which will soon become unavailable, register:
* http://www.svtplay.se/filmochdrama?tab=sista-chansen
*
* Live feeds are included since version 1.1.6.
* They can sometimes be included in certain category pages (such as news).
* Find live feeds here:
* http://www.svtplay.se/kanaler
*

Re: SvtPlay (Sweden only)

PostPosted: Tue Nov 20, 2012 10:06 am
by Swehawk
Great work :D :D :D
Installed the plugin yesterday evening and added "Nyheter - Senaste" with "..sida=5" and got 40 entries/thumbs in my dlna-controller. With the old plug I could never got more than 12! Gonna add the other categories tonight and test some more.

Thank you soooo much!

Re: SvtPlay (Sweden only)

PostPosted: Tue Nov 20, 2012 10:08 am
by ottomatic
I'm glad it's working for you.

I'll post an update some day soon which also has the correct publishing date for each content item.

Re: SvtPlay (Sweden only)

PostPosted: Tue Nov 20, 2012 9:23 pm
by csholmq
I'm getting 400 errors.

  Code:
2012-11-20 22:15:06,078 DEBUG [FFMPEGWrapper] Invoking FFMPEG to retrieve media information for file: http://svtplay9i-f.akamaihd.net/i/world/open/20121120/1224820-032A/VV_AVA_2012-032A-40e735fa8f11fbe7_,900,320,420,620,1660,2760,.mp4.csmil/index_5_av.m3u8?e=b2a7ace1bf661c32
2012-11-20 22:15:06,078 DEBUG [ProcessExecutor] Starting /root/.serviio/lib/FFmpegWrapper.sh -i http://svtplay9i-f.akamaihd.net/i/world/open/20121120/1224820-032A/VV_AVA_2012-032A-40e735fa8f11fbe7_%2c900%2c320%2c420%2c620%2c1660%2c2760%2c.mp4.csmil/index_5_av.m3u8?e=b2a7ace1bf661c32
2012-11-20 22:15:08,977 WARN  [FeedUpdaterThread] Failed to retrieve online item information for http://svtplay9i-f.akamaihd.net/i/world/open/20121120/1224820-032A/VV_AVA_2012-032A-40e735fa8f11fbe7_,900,320,420,620,1660,2760,.mp4.csmil/index_5_av.m3u8?e=b2a7ace1bf661c32. It might not play.


  Code:
ffmpeg version N-42368-gbf53863-Serviio_Qnap Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 19 2012 23:26:14 with gcc 4.2.3
  configuration: --arch=arm --enable-armv5te --prefix=/root/.serviio/opt --extra-cflags=-I/opt/include --enable-static --disable-shared --disable-ffplay --disable-ffserver --enable-pthreads --enable-libmp3lame --enable-librtmp --extra-version=Serviio_Qnap
  libavutil      51. 64.100 / 51. 64.100
  libavcodec     54. 33.100 / 54. 33.100
  libavformat    54. 15.102 / 54. 15.102
  libavdevice    54.  1.100 / 54.  1.100
  libavfilter     3.  1.100 /  3.  1.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
[http @ 0xe1d8f0] HTTP error 400 Bad Request
http://svtplay9i-f.akamaihd.net/i/world/open/20121120/1224820-032A/VV_AVA_2012-032A-40e735fa8f11fbe7_,900,320,420,620,1660,2760,.mp4.csmil/index_5_av.m3u8\?e=b2a7ace1bf661c32: Input/output error


Any ideas on what this is?

Re: SvtPlay (Sweden only)

PostPosted: Tue Nov 20, 2012 10:24 pm
by ottomatic
Looks like the wrapper has inserted an extra backslash before the question mark in the URL. I must admit that I haven't tested the wrapper on a Linux box. Will have a look and see if I can come up with a quick fix.

Re: SvtPlay (Sweden only)

PostPosted: Tue Nov 20, 2012 10:50 pm
by csholmq
Fixed it.

Change
  Code:
ARG="$(printf "%q" "$1")"

to
  Code:
ARG="$(printf "%s" "$1")"


Now it works great!

Re: SvtPlay (Sweden only)

PostPosted: Tue Nov 20, 2012 11:09 pm
by ottomatic
Great!

I'll update the wrapper in the zip file.

Re: SvtPlay (Sweden only)

PostPosted: Tue Nov 20, 2012 11:21 pm
by csholmq
My bad!

While this fixes the plugin, the wrapper is still broken. It won't allow spaces in filenames.

I.e ./FFmpegWrapper.sh -i "filename 123.mov" will be lumped together without the quotes. To solve this, the filename argument must be passed along with "$filename"

Re: SvtPlay (Sweden only)

PostPosted: Wed Nov 21, 2012 12:31 am
by csholmq
Here we go. I refactored the wrapper somewhat and now both CricTV, SVTPlay and my regular media works.

Give it a spin and see if you can spot any flaws.

  Code:
#!/usr/bin/env bash
PATH_TO_FFMPEG=/root/.serviio/opt/bin/ffmpeg

SWITCHES=""

COUNT=$#
for ((INDEX=0; INDEX<COUNT; ++INDEX))
do
    if [ "$1" == "-i" ]
   then
        # Unescape the escaped commas
        FILENAME=`echo $2 | sed -e s/%2c/,/g`
      
      shift
   else
      # Add extra switches
      SWITCHES="$SWITCHES $1"
   fi

   shift
done

#echo $PATH_TO_FFMPEG -i \"$FILENAME\" $SWITCHES
$PATH_TO_FFMPEG -i "$FILENAME" $SWITCHES

Re: SvtPlay (Sweden only)

PostPosted: Wed Nov 21, 2012 7:52 am
by ottomatic
Actually, there is a flaw in the above implementation as well.

In case there are any arguments before the -i option, they will be moved to after that option. Which I believe makes a huge difference in terms of FFMpeg options. Arguments before the in-file pertain to the incoming stream and arguments after the in-file configure the output.

So I think this should do it:

  Code:
#!/usr/bin/env bash
PATH_TO_FFMPEG=/root/.serviio/opt/bin/ffmpeg

SWITCHES=""

COUNT=$#
for ((INDEX=0; INDEX<COUNT; ++INDEX))
do
    if [ "$1" == "-i" ]
   then
        # Unescape the escaped commas
        FILENAME=`echo $2 | sed -e s/%2c/,/g`
       
        # Make sure we quote the -i argument
        SWITCHES="$SWITCHES -i \"$FILENAME\""
      shift
   else
      # Add extra switches
      SWITCHES="$SWITCHES $1"
   fi

   shift
done

#echo $PATH_TO_FFMPEG $SWITCHES
$PATH_TO_FFMPEG $SWITCHES

Re: SvtPlay (Sweden only)

PostPosted: Wed Nov 21, 2012 1:03 pm
by csholmq
Actually, while you preserve the order of all the arguments, simply escaping quotes around the filename won't work.

This seems to work. Now it preserves the order of the switches and still keeps the integrity of the input string.

  Code:
#!/usr/bin/env bash
PATH_TO_FFMPEG=/root/.serviio/opt/bin/ffmpeg

PRESWITCHES=""
FILENAME=""
POSTSWITCHES=""
INPUT_FOUND=false

COUNT=$#
for ((INDEX=0; INDEX<COUNT; ++INDEX))
do
   if $INPUT_FOUND
   then
      POSTSWITCHES="$POSTSWITCHES $1"
   else
      if [ "$1" == "-i" ]
      then
         # Unescape the escaped commas
         FILENAME=`echo $2 | sed -e s/%2c/,/g`

         INPUT_FOUND=true
         shift
      else
         # Add extra switches
         PRESWITCHES="$PRESWITCHES $1"
      fi
   fi

   shift
done

#echo $PATH_TO_FFMPEG $PRESWITCHES -i \"$FILENAME\" $POSTSWITCHES
$PATH_TO_FFMPEG $PRESWITCHES -i "$FILENAME" $POSTSWITCHES

Re: SvtPlay (Sweden only)

PostPosted: Wed Nov 21, 2012 9:50 pm
by ottomatic
Ha!

The output from my latest attempt looked soooo right on my ancient Linux box. But I couldn't be arsed to install ffmpeg to test it - there are no longer any live software packages for the distribution.

Just to be certain, can you verify that flash decryption works with your latest wrapper version?

Add the Homeland feed and see if you can play more than a minute of the latest show:

http://www.svtplay.se/homeland

Re: SvtPlay (Sweden only)

PostPosted: Wed Nov 21, 2012 11:03 pm
by csholmq
Several episodes were added almost immediately and played right away. I watched some stored media earlier, and that worked aswell. So I would say that it's working.

Re: SvtPlay (Sweden only)

PostPosted: Thu Nov 22, 2012 8:02 pm
by ottomatic
Hi everyone.

I have updated the files in the original announcement.

Version 1.1 of the plugin correctly parses the publishing date for each content item, if available in the html markup.

Also: when usung the pirate API to fetch streanm urls, if there is no stream matching the requested quality, the first available stream will be returned. This will likely be a dynamic (adaptive) stream declared with an f4m manifest, and ffmpeg is currently unable to play such streams.
(For more info, see: http://rdkls.blogspot.se/2011/11/what-i ... aptive.htm )
So, the bottom line is: there are still some shows that won't show up in your feed. It seems that it won't be easy to get those shows to play im serviio.

The FFMpeg wrapper for linux has been updated according to the latest suggestion by csholmq.

Re: SvtPlay (Sweden only)

PostPosted: Fri Nov 23, 2012 1:24 pm
by csholmq
Wow, I just gotta say... This plugin is AMAZING! It's fast, it never breaks down, SVTplay streams in really high quality (and loads real fast!).

If only I could figure out how to sort the Webresources after title.

Re: SvtPlay (Sweden only)

PostPosted: Sat Nov 24, 2012 10:53 am
by dtp
"There is no media in the current folder" when using the svtplay plugin on my wd tv live 3. Any clues?

Re: SvtPlay (Sweden only)

PostPosted: Sat Nov 24, 2012 11:10 am
by csholmq
dtp wrote:"There is no media in the current folder" when using the svtplay plugin on my wd tv live 3. Any clues?

No clues but many possible causes. Post log.

Re: SvtPlay (Sweden only)

PostPosted: Sat Nov 24, 2012 12:04 pm
by dtp
here's a log-file. really appreciate your effort!

Re: SvtPlay (Sweden only)

PostPosted: Sat Nov 24, 2012 12:34 pm
by csholmq
This is the part that I wanted.
  Code:
2012-11-24 12:26:48,673 DEBUG [ProcessExecutor] Starting C:\Program Files\Serviio\lib/ffmpeg.exe -i http://svtplay7o-f.akamaihd.net/i/world/open/20121120/1337354-011A/WHY_POVERTY_KOR-011A-97b7e3def8b913f7_%2c900%2c320%2c420%2c620%2c1660%2c2760%2c.mp4.csmil/index_0_av.m3u8?e=b2a7ace1bf661c32


It looks like you haven't changed -Dffmpeg.location as the instructions says. This is what it's supposed to look like

  Code:
2012-11-24 13:30:36,478 DEBUG [ProcessExecutor] Starting C:\Program Files\Serviio\PATH_TO_FFMPEGWRAPPER -i http://svtplay7o-f.akamaihd.net/i/world/open/20121120/1337354-011A/WHY_POVERTY_KOR-011A-97b7e3def8b913f7_%2c900%2c320%2c420%2c620%2c1660%2c2760%2c.mp4.csmil/index_0_av.m3u8?e=b2a7ace1bf661c32


You should change PATH_TO_FFMPEGWRAPPER accordingly.

Re: SvtPlay (Sweden only)

PostPosted: Sat Nov 24, 2012 3:16 pm
by dtp
FFMPegWrapper in folder lib: SET PATH_TO_FFMPEG="C:\Program Files\Serviio\lib\FFMPeg.exe"

ServiioService.exe in folder bin: -Dffmpeg.location="C:\Program Files\Serviio\lib\FFMPegWrapper.bat"

still the same error...