User Tools

Site Tools


refresh_on_demand

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
refresh_on_demand [2012/04/28 17:10]
jhb50
refresh_on_demand [2012/08/06 14:06] (current)
jhb50
Line 1: Line 1:
- **HOW TO REFRESH ONLINE FOLDERS ON DEMAND FROM THE CLIENT** +**HOW TO REFRESH ONLINE FOLDERS ON DEMAND FROM THE CLIENT**
- +
-NOTE:- This is currently in the middle of being modified  4/27/2012 +
  
 __THE NEED FOR REFRESH ON DEMAND__ __THE NEED FOR REFRESH ON DEMAND__
Line 19: Line 17:
 The ultimate solution therefore is to implement these dynamic feeds with a Web Resource that refreshes on a periodic basis in order to minimize the number of new feed items that will need to be added by a "Force Refresh", and to provide a "Force Refresh" capability from the menus on the client device, that may be used just prior to using the dynamic feed.  The ultimate solution therefore is to implement these dynamic feeds with a Web Resource that refreshes on a periodic basis in order to minimize the number of new feed items that will need to be added by a "Force Refresh", and to provide a "Force Refresh" capability from the menus on the client device, that may be used just prior to using the dynamic feed. 
  
-The facility to initiate periodic refreshes more frequently than the console default refresh value is documented in the "Serviio Online Resource plugin implementation Guide" under "Date expiresOn" Date is based on the current time {long curTimea = System.currentTimeMillis()} plus the milliseconds to the desired expiry time. Note that expiry will be on the earliest of that Date and the console default, and the refresh will actually be performed by Serviio 5 minutes ahead of that time. +The facility to initiate periodic refreshes in a Web Resource plugin groovy, more frequently than the console default refresh valueis documented in the "Serviio Online Resource plugin implementation Guide" under "Date expiresOn" Date is based on the current time {long curTimea = System.currentTimeMillis()} plus the milliseconds to the desired expiry time. Note that expiry will be on the earliest of that Date and the console default, and the refresh will actually be performed by Serviio 5 minutes ahead of that time. 
  
-The hahasports.groovy accepts a refresh=nnn parameter that removes the automatic refresh based on event times and only refreshes the feed every nnn minutes. "Force Refresh" is then used to refresh any new feed items in a feed prior to opening the feed. Other dynamic feeds should implement a similar capability.+The hahasports.groovy implements this option via a refresh=nnn parameter that removes the automatic refresh based on event times and only refreshes the feed every nnn minutes. Other dynamic feeds should implement a similar capability. A "Force Refresh" from the server or a remote console, or from a client device menu may then be used to refresh the feeds prior to opening them
  
-The facility to initiate "Force Refresh" from menu on the client device is documented below, and consists of a WebResource RefreshWebResources.groovy that generates a menu of "Force Refresh" feed items for all WebResource feeds in the Serviio online library. Clicking on a feed initiates its "Forced Refresh" and starts playback of the ISS video stream. The feed is then removed from the list of Online feeds and becomes available again by opening the Online menu once the refresh is complete. +The facility to initiate "Force Refresh" from an online menu on client device consists of a WebResource Refresh.groovy that generates a menu of "Force Refresh" feed items for all enabled WebResource feeds in the Serviio online library. Clicking on a listed feed item initiates "Force Refresh" of that feed by intercepting the call to play the video associated with that menu item. The feed is then removed from the list of Online menu feeds while it refreshes and it becomes available again by opening the Online menu once the refresh is complete. The implementation is documented below.
  
 __ON DEMAND METHODOLOGY__ __ON DEMAND METHODOLOGY__
  
-The ability to implement "Force Refresh" feed items in the RefreshWebResources.groovy is based on prerequisite one time implementations:+The ability to implement "Force Refresh" feed items in the Refresh.groovy is based on prerequisite one time implementations:
  
 1) The installation of CURL.EXE which provides the abilty to access the Serviio repository data and initiate forced refreshes per the latest "Serviio REST interface specification.pdf" The curl.exe may be obtained from http://curl.haxx.se/dlwiz/?type=bin and use the wizard to select the correct package for your operating system and install it in the appropriate system library. I used the generic Win64-ssl package and copied curl.exe into C:\windows\sysWOW64. W32 users should get the generic Win32 package and copy curl.exe into C:\windows\system32 1) The installation of CURL.EXE which provides the abilty to access the Serviio repository data and initiate forced refreshes per the latest "Serviio REST interface specification.pdf" The curl.exe may be obtained from http://curl.haxx.se/dlwiz/?type=bin and use the wizard to select the correct package for your operating system and install it in the appropriate system library. I used the generic Win64-ssl package and copied curl.exe into C:\windows\sysWOW64. W32 users should get the generic Win32 package and copy curl.exe into C:\windows\system32
  
-2) The availability of a live Stream URL which can be used as the trigger to initiate calls to curl.exe to initiate individual library refresh requests. The live Stream URL for the International Space Station (ISS) feed %%"rtsp://a1709.l1856953708.c18569.g.lm.akamaistream.net:554/D/1709/18569/vnnn/reflector:53708"%% is currently used by RefreshWebResources.groovy and the "forcerefresh" method as the live stream associated with each "Force Refresh" feed item, where the "v Value" nnn is the online library id to be refreshed.+2) The availability of a live Stream URL which can be used as the trigger to initiate calls to curl.exe to initiate individual library refresh requests. The live Stream URL for the International Space Station (ISS) feed %%"rtsp://a1709.l1856953708.c18569.g.lm.akamaistream.net:554/D/1709/18569/vnnn/reflector:53708"%% is currently used by RefreshWebResources.groovy as the live stream associated with each "Force Refresh" feed item, where the "v Value" nnn is the online library id to be refreshed.
  
-3) The availability of a "Force Refresh" icon to be used by RefreshWebResources.groovy and the "forcerefresh" method as the "Force Refresh" "feed item" icon associated with the ISS live stream. The icon %%https://sites.google.com/site/serviiorss/refresh.jpg%% is currently used which displays "CLICK TO REFRESH FOLDER" and the "feed item" title is used to display any additional information.+3) The availability of a "Force Refresh" icon to be used by RefreshWebResources.groovy for each "Force Refresh" "feed item" associated with the ISS live stream. The icon %%https://sites.google.com/site/serviiorss/refresh.jpg%% is currently used which displays "CLICK TO REFRESH FOLDER" and the "feed item" title is used to display any additional information.
  
 4) The addition of the line -Dffmpeg.location="C:\Program Files\Serviio\lib\ffmpeg.bat" to the file C:\Program Files\Serviio\bin\ServiioService.exe.vmoptions to cause all Serviio ffmpeg calls to be sent to ffmpeg.bat  This needs to be repeated after each Serviio new install, which will restore that file. 4) The addition of the line -Dffmpeg.location="C:\Program Files\Serviio\lib\ffmpeg.bat" to the file C:\Program Files\Serviio\bin\ServiioService.exe.vmoptions to cause all Serviio ffmpeg calls to be sent to ffmpeg.bat  This needs to be repeated after each Serviio new install, which will restore that file.
 After the addition it will contain: After the addition it will contain:
-<code>-Xmx384m+<code>-Xmx512m
 -Dffmpeg.location="C:\Program Files\Serviio\lib\ffmpeg.bat" -Dffmpeg.location="C:\Program Files\Serviio\lib\ffmpeg.bat"
 </code> </code>
 5) The installation of the attached ffmpeg.bat as C:\Program Files\Serviio\lib\ffmpeg.bat which will detect the ffmpeg calls containing the ISS URL, extract the "vValue" nnn and issue the curl command to refresh the Serviio online library nnn, before calling ffmpeg to process the original ffmpeg call. Note the ffmpeg.bat also logs each ffmpeg call in C:\Program Files\Serviio\log\ffmpeg.log which I have found useful for debugging. The bat may be edited to comment out that line as noted in the bat. 5) The installation of the attached ffmpeg.bat as C:\Program Files\Serviio\lib\ffmpeg.bat which will detect the ffmpeg calls containing the ISS URL, extract the "vValue" nnn and issue the curl command to refresh the Serviio online library nnn, before calling ffmpeg to process the original ffmpeg call. Note the ffmpeg.bat also logs each ffmpeg call in C:\Program Files\Serviio\log\ffmpeg.log which I have found useful for debugging. The bat may be edited to comment out that line as noted in the bat.
  
-With these changes clicking on the Refresh menu item, initiates a refresh of the corresponding online source while the Refresh Menu Item stream plays. If one waits for the refresh to complete before stopping playback, the refreshed menu will be displayed on return and the desired item selected for playback, else the menu will be unavailable on return and Serviio will exit and require a restart to access the updated menu once available(Note that a refresh can require up to 30 seconds to cache a new item, but with hourly automatic updates many of the events should already be cached).+6) The addition of WebResource to the Library Online Sources section of the console using the dummy url http://www.refresh.com
  
-The HAHASPORT.GROOVY is dependent upon the attached ffmpeg.bat script with the appropriate online library id's added as determined by using CURL to dump the repository as documented in the script, and the script is similarly dependent upon the change to ServiioService.exe.vmoptions as documented in the script(Note I am sure more advanced scripts can be created by those conversant with other scripting tools than bats)+With these changes, a Refresh menu will be created with items showing the library id and name of each active Web Resource online source together with a "Click to Refresh Folder" icon. Clicking on an item, initiates playback of the ISS stream while the feed refreshes. Note that a refresh can require up to 30 seconds to cache a new itembut with hourly automatic updates many of the new events should already be cached. After waiting an appropriate period, playback may be stopped, the Refresh and Online Folders exited, and the Online Folder reopened. If the refresh is complete the Refreshed folder should appearIf not repeat the closing and reopening of the Online Folder until it does.
  
-After listing the available live streams, the HAHASPORT.GROOVY also generates a final item in each menu, showing either the scheduled start time of the next event or the absence of any more events in the schedule for that sport, along with the time of the next automatic refresh.+__The FFMPEG.BAT - Updated for Serviio 1.0__ 
 +Download {{:ffmpeg.bat.zip}}
  
-__USING THE HAHASPORT GROOVY__+**How to setup Refresh on demand from client for Linux and Synology NAS:** [[refresh_on_demand_linux|refresh_on_demand_linux]]
  
-To use the HAHASPORT.GROOVY {{:hahasport.groovy.V2.zip}} just add the following Resource URL's as WebResources in the Serviio Console, together with the appropriate labels. 
- 
-%%http://www.hahasport.com/c-1.html%%  FOOTBALL 
-%%http://www.hahasport.com/c-3.html%% HOCKEY 
-%%http://www.hahasport.com/c-4.html%% TENNIS 
-%%http://www.hahasport.com/c-6.html%% BASKETBALL 
-%%http://www.hahasport.com/c-7.html%% BASEBALL 
-%%http://www.hahasport.com/c-8.html%% GOLF 
-%%http://www.hahasport.com/c-9.html%% CYCLING 
-%%http://www.hahasport.com/c-10.html%% MOTORSPORTS 
-%%http://www.hahasport.com/c-11.html%% OTHER 
- 
-Since each live event may have multiple streams available, each from a different source, an estreams parameter may be used with the ResourceUrl to cause multiple streams to be displayed for each live event if available. estreams may equal 1 thru 9 with 9 signifing that all available streams should be displayed, for example %%http://www.hahasport.com/c-1.html?estreams=9%% 
- 
-Note also that since HAHASPORT.COM sources its streams from many different sources, there may be live streams that the groovy does not decode for display in the Serviio menu. For details on the stream decoding set the onlinelibrary log to debug mode. 
- 
-To access the current events for a given sport, open the menu and click on the Refresh menu item which will initiate a refresh of the online source while the Refresh Menu Item stream plays. Wait for the refresh to execute (30 seconds per new item) before stopping playback and the refreshed menu will be displayed on return and the desired item selected for playback. If playback of the Refresh Menu Item stream is stopped before the refresh is complete the menu will be unavailable on return and Serviio will exit and require a restart to access the updated menu once available. 
- 
-Note that if you do not to implement the changes required to support the Refresh On Demand menu item, you must use the Serviio console or a remote console to force the refresh of each sport in order to obtain the current live stream event menu. 
- 
-__THE SCRIPT__ 
- 
-<code> 
- 
- 
-</code> 
  
refresh_on_demand.1335633042.txt.gz · Last modified: 2012/04/28 17:10 by jhb50