[WIP] URPlay.se Video plugin
#1
About Me ("Disclaimer")
So, this is my first stab at making an add-on for Kodi. I'm not a programmer by profession or education, so expect some bugs Big Grin. This has mostly served as a learning experience. There is an older UR Play plugin that no longer seems to receive updates. Judging by the code it seems that the UR Play site has received a major overhaul since then. Therefore I opted to start from scratch with a new plugin and this thread with it.

Installation [1.3.1 RC1] (In development, expect odd behavior or missing features)
The plugin require XBMC 13.x\Gotham or Kodi 14.x\Helix.

For convenience here is a zip which should work with the "install from zip-file" feature (let me know if it doesn't):
https://www.dropbox.com/s/2d3b4oyd01o4e0...1.zip?dl=0

The source can be found on github: https://github.com/granskog/kodi-plugin.video.urplay-se

What the Plugin Does
The plugin will currently list and play video files in all categories and list all programmes in the "A-Ö" section of UR Play website. The search should also work. There are plugin settings for using HD quality when available (not meny shows seems to use HD though) and to use subtitles.

I have run the plugin in Kodi 14 during development (in OS X). I have also successfully played videos on my TV-connected RaspberryPi running OpenELEC 4.2.1 and XBMC 13.2 Gotham.

Quirks
  • UR Play does not group videos together into series at all times. The site use pagination without support for sorting in alphabetical order or possibility to choose number of items per page. The sorting options are: "latest", "most viewed", "most shared" and "last chance". Currently the plugin just list what it sees on the site. This make everything appear a bit messy.
  • There are several streams available one of which has subtitles permanently "burned in". This is the stream used when the setting "Force Subtitles" is enabled in the plugin settings menu. In other words, to get subtitles, this setting need to be enabled before playing a video.

    Also, no subtitles mean no subtitles whatever language spoken. Enabling subtitles will show subtitles even if the program is in Swedish. This is a limitation of UR Play and seems to apply to the separate subtitle files as well (se below).

Future Features?
Here are some things still need fixing, I intend to include or perhaps ideas for the future.
  • Proper Subtitle Support
    The subtitle format on urplay.se is in .tt, xml (TTML?) format. I do not know much about this, but it seems Kodi only support .srt? I guess one solution would be to download the .tt file and convert it to .srt and then (cache to disk for later use?) present it to Kodi? A quick google around landed Captions transformer, pycaption and ttml2srt.py. I have only tested ttml2srt.py which didn't give a satisfactory output with UR Play subtitles. It might be a start for something at least.
  • Front Landing Page
    List all videos presented from the website landing page (index).
  • ...

Regards!
//dgs
Reply
#2
Excellent work!
Dont care about the sorting right now. The site has a good structure for quick access to the most poular things. What you could do is a background scraping and cashing of the site contents and then you could present show in whatever order you like (I suspect you allready thought about this.).

Regarding subs, have you tried just adding the subtitle url to the listitem and let xbmc/kodi decide if it could read it or not (svtplay does this I believe)?
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#3
Thank you!

I did try to forward the subtitle url with the ListItem.setSubtitles(), but it didn't work (can't remember what the log did say). I didn't manage to find any detailed documentation regarding subtitle format support either.
Edit2: (How did I miss this page?) Subtitle formats: AQTitle, ASS/SSA, CC, JACOsub, MicroDVD, MPsub, OGM, PJS, RT, SMI, SRT, SUB, VOBsub, VPlayer.

I just looked at the svtplay-plugin and they create a xbmc.Player() object, waits for the video to start playing and then use .setSubtitles() of that object. Don't know if this is just another way to achieve the same thing or a workaround for something? However there is a reference to .wsrt when they parse the subtitle url. Wikipedia seems to "confirm" that SVT uses SubRip subtitles.

Need to look into this more when time allow...

Edit:
Just randomly googled and found this plugin: joerns/xbmc-plugin.video.tagesschau.
PHP Code:
def download_subtitles(urlsubtitles_dir):
    
"""Downloads and parses TTML subtitles from the given URL and saves it as tagesschau.de.srt in the given subtitles directory.
    ...
    """ 
Reply
#4
I suspect a workaround because Nilzen wouldn't do it if not needed.
Good you found a usable plugin.
You use some really deep python stuff, I had to read up on http://stackoverflow.com/questions/10000...-in-python to partly grasp what you are doing ;D
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#5
Well, It started out as an exercise to learn more python. Tongue But, I'm not very happy with how the code does look currently. The idea at the beginning then got scrapped half-way through and now it's a bit of a mix of everything unfortunately.

Since it is somewhat working though, I thought I released it and go about cleaning up and fixing the now unnecessary complicated stuff later.
Reply
#6
Thats the way to go. End users don't care how your code look, as long as things just work.
If I can have one suggestion, that would be to split out the web parsing stuff to a file of its own. Maybe even a json you could store on github and update it completely separate from your code. If ur-play makes minor changes, there would be no need for addon update. I haven't seen anyone do it, but there is always a few days of lag when sites changes before addons get updated..
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#7
You are the M A N ! ! ! Love

I watch a lot of stuff on UR Play but so far I've always had to grab/fetch a tablet and airplay/chromecast it to the TV, which is really annoying when I use Kodi for everything else not broadcasted. Been looking out for and hoping someone would write an addon and here you are!

Thank you, thank you, thank you! Big Grin
HTPC: LibreELEC 7 on Shuttle XS35GTv2 & Raspberry Pi 3
NAS: NAS4Free 2x 3TB Raid1
Reply
#8
Seems to be broken now:

Code:
20:33:37 T:140241335736064   ERROR: [UR Play v1.3.0~RC1]: Unable to decode video information (u'file_hd').
20:33:37 T:140241335736064   ERROR: [UR Play v1.3.0~RC1]: Exception during handling of "/Produkter/186789-Pluggkoden-Strategier-for-matematik" (u'file_hd').
20:33:37 T:140242480732032   ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.video.urplay-se/Produkter/186789-Pluggkoden-Strategier-for-matematik]

I guess urplay changed something? Any hints?

Thanks in advance!
Reply
#9
Same here, although I haven't gotten around to checking any debug stuff (for the simple reason that I would have to google how to do so).

Guess they changed something.
HTPC: LibreELEC 7 on Shuttle XS35GTv2 & Raspberry Pi 3
NAS: NAS4Free 2x 3TB Raid1
Reply
#10
Tongue 
Hello all!

First, thank you for your comments! I'm sorry that I have been absent here. Due to personal reasons I have not had the opportunity to develop this further at the moment. It is nice though to see that the plugin is getting some use.

I've just committed a fix to github and there is a new zip to download here: https://www.dropbox.com/s/2d3b4oyd01o4e0...1.zip?dl=0.

I have note done extensive testing of Urplay.se changes, but testing random videos it seems to work now. Also need to get to know my code again... Tongue Just post here if there are more issues although I will not have more time until some time tomorrow.
Reply
#11
Jepp! The plugin works much better now Smile

Thanks for taking the time to fix this!
Reply
#12
Works again!

Thank you so very much! I have become quite addicted to having the URPlay content available on my Openelec Smile
HTPC: LibreELEC 7 on Shuttle XS35GTv2 & Raspberry Pi 3
NAS: NAS4Free 2x 3TB Raid1
Reply
#13
great plugin many thanks! A bit of a shame on the subtitles not working but it definitely isn't the end of the world!
Reply
#14
Guess this isn't being worked on anymore? Browse and search are broken in Jarvis.


Found another addon that's partly (search, no browsing) working: https://github.com/VioletRed/kodi-urplay

Also appears to have some form of subtitle support although nothing is rendered.
Reply
#15
I've turned to Retrospect addon (http://www.rieter.net/content/). One-stop-shop for SVT/UR Play, Öppet Arkiv and a few other channels. Don't remember if search works nowadays - I mostly browse - but subtitles do. Well, with the exception that UR Play subs get out of sync when pausing for more than 10-15 seconds, plus content skipping forward a few seconds as well.

Can't say for sure, but my hunch is that it has to do with the buffer getting full when pausing, stream is interrupted (buffer full => no packets arriving from server) and when pressing play the program starts from buffer while asking the UR play server to resume the stream, but fails to make a seamless transition. Somewhere there also the subs go out of sync with some half second. Can be a tad of nuisance, but easily solved by pressing stop and then play=> resume episode (and beats having no subs at all).
HTPC: LibreELEC 7 on Shuttle XS35GTv2 & Raspberry Pi 3
NAS: NAS4Free 2x 3TB Raid1
Reply

Logout Mark Read Team Forum Stats Members Help
[WIP] URPlay.se Video plugin0