[RELEASE] Play Locally - Cache videos locally before playing
#1
Thumbs Up 
Hi everyone, this is my first addon to solve a specific WAF problem I was facing where I would get regular buffering due to only having access to wifi.

Frodo 12.2 - http://windebank.com.au/script.playLocally-1.0.0.zip

What it does

Adds a context menu item to both Movies and TV Episodes to allow a user to cache the file locally before playing. The file is coped to the local device and then plays immediately and the local file is removed once playback ends, either when the file finishes or when the user stops playback.

Features

- Config to allow users to select cache directory (defaulted to system agnostic special://temp)
- Displays progress bar whilst file is copying
- Local file automatically removed once playback completes
- Certain media tags are loaded before playing for display in pause menu (currently title, year, tagline and plot)
- Context menu item only displays if script is enabled
- File copy buffer exposed in addon configuration for testing of optimal setting (changing this didn't make a noticeable difference on my laptop)

To install

See README.txt or below.

Code:
To use this script you will need to add a context menu control directly by editing the skin xml files.

Tested with Aeon MQ5

Add the following to DialogContextMenu.xml (\XBMC\addons\skin.aeonmq5\720p) where you want the button to be in the context menu:

<control type="button" id="1034">

    <include>DialogContext_Button</include>

    <onleft>Dialog.Close(106)</onleft>

    <onright>Dialog.Close(106)</onright>

    <onclick>RunScript(script.playLocally)</onclick>

    <label>88888</label>

    <visible>System.HasAddon(script.playLocally) + [Container.Content(episodes) | Container.Content(movies)]</visible>

</control>

Add the following to the skin's language file (\XBMC\addons\skin.aeonmq5\language\English\strings.po):

msgctxt "#88888"
msgid "PLAY LOCALLY"
msgstr "PLAY LOCALLY"

msgctxt "#88889"
msgid "Path to cache local media"
msgstr "Path to cache local media"

msgctxt "#88890"
msgid "Buffer size"
msgstr "Buffer size"

** NOTE - One minor bug with settings.xml being unable to read setting descriptions from strings.po so hard coded in English until resolved.

Screenshots

Image

Image

Image

Image

If anyone has any issues or requests, please post here. I've only tested on two instances of XBMC - Frodo 12.2 on Openelec and Frodo 12.2 on Windows 8.


Thanks,
Jordan
Reply
#2
Just found one small bug where it clashes with the TVTunes script and captures the xbmc.Player.onPlaybackEnded() event prematurely.

Will update a minor patch in a couple of hours.
Reply
#3
Awesome!
I was looking for something like that to enable my hdd to spin down during playback.
My HTPC is completely noiseless, and the loud hdd is driving me crazy.
Will give it a look in the new year, and contact you when I find bugs.

A very usefull extension I could imagine for this:
Give the user a custom code field that gets executed when the movie is finished with caching.
I could enter the spindown command there, so it doesn't wait for the hdd to "timeout".


Happy new year and thanks a lot Smile

BTW: For Aeon Nox 4.1.9 the context menu is in [your home folder path]/.xbmc/addons/Aeon-Nox/1080i/DialogContextMenu.xml
and then enter

Code:
<control type="button" id="1034">
            <width>462</width>
            <height>58</height>
            <textoffsety>12</textoffsety>
            <align>center</align>
            <texturefocus>dialogs/context_highlight.png</texturefocus>
            <texturenofocus>dialogs/context_nofocus.png</texturenofocus>
            <font>Font_Reg30_2</font>
            <textcolor>context</textcolor>
            <focusedcolor>white2</focusedcolor>
            <colordiffuse>$VAR[SpotColorVar2]</colordiffuse>
                <include>DialogContext_Button</include>
            <onleft>Dialog.Close(106)</onleft>
            <onright>Dialog.Close(106)</onright>
            <onclick>RunScript(script.playLocally)</onclick>
                <label>88888</label>
                <visible>System.HasAddon(script.playLocally) + [Container.Content(episodes) | Container.Content(movies)]</visible>
        </control>

to make it appear in the context menu. (I needed to adjust it a little bit, the code above doesn't work with Nox)

The Language file is equivalent.
Reply

Logout Mark Read Team Forum Stats Members Help
[RELEASE] Play Locally - Cache videos locally before playing1