Add-on:Simple Downloader for xbmc plugins: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>TobiasTheCommie
No edit summary
>TobiasTheCommie
No edit summary
Line 19: Line 19:
* Requeing an existing item moves it to the front of the queue.
* Requeing an existing item moves it to the front of the queue.
* RTMP downloading if the rtmpdump binary is installed.
* RTMP downloading if the rtmpdump binary is installed.
* RTSP/mms downloading if the vlc or mplayer binary is installed.(And any other stream they accept)
[[File:Simple_downloader.png|900px| Simple Downloader]]
[[File:Simple_downloader.png|900px| Simple Downloader]]


Line 40: Line 42:
   <requires>
   <requires>
     <import addon="xbmc.python" version="2.0"/>
     <import addon="xbmc.python" version="2.0"/>
     <import addon="script.module.simple.downloader.beta" version="0.9.0"/> # Add this
     <import addon="script.module.simple.downloader.beta" version="0.9.1"/> # Add this
   </requires>
   </requires>


And add the following to your py file.
And add the following to your py file.


  import xbmc, xbmcvfs, xbmcaddon
  settings = xbmcaddon.Addon(id='your.plugin.id') # The same as in addon.xml
   import SimpleDownloader as downloader
   import SimpleDownloader as downloader
   downloader = downloader.SimpleDownloader()
   downloader = downloader.SimpleDownloader()


You can now access the downloader through the "downloader" variable.
You can now access the downloader through the "downloader" variable.
=== Settings ===
In your resources/settings.xml you need the following.
    <setting id="downloadPath" type="folder" label="Download Location" default="" />
    <setting id="hideDuringPlayback" type="bool" label="Hide during playback" default="true" />
    <setting id="notification_length" type="enum" label="Notification length in seconds" values="1|2|3|4|5|6|7|8|9|10" default="2" />


== Debugging ==
== Debugging ==
To enable debugging set the following values in default.py
To enable debugging set the following values in your default.py


  dbg = True # Default
  dbg = True # Default
Line 67: Line 59:
Or you can change it after import with.
Or you can change it after import with.


  common.dbg = True # Default
  downlaoder.dbg = True # Default


Whenever you debug your own code you should also debug in the cache. Otherwise you should remember to DISABLE it.
Whenever you debug your own code you should also debug in the cache. Otherwise you should remember to DISABLE it.


== downloadVideo(self, params = {}) ==  
== downloadVideo(self, filename, params = {}) ==
Takes dictionary list with video name and url.
Takes filename(string) and dictionary list with url and download_path.


For http and normal RTMP streams you need to specify a video_url, a videoid and a Title.
The filename must be unique.
* video_url: "http://server.com/video.mp4" # Url to download
 
* videoid: "0" # Video id. Must be unique. Preferably just use the videoid provided from your site(if applicable).
The params collection can contain an optional Title to be shown during transfer, instead of showing the filename.
 
For http and normal RTMP streams you need to specify a url.
* params = {"url": "http://server.com/video.mp4", "download_path": settings.getSetting("download_path")} # Url to download


For live RMTP streams you also need to specify live and max_size:
For live RMTP streams you also need to specify live and max_size:
* live: True # Tell the downloader it is getting a live stream
* params = {"url": "http://server.com/video.mp4", # Url to download
* max_size: 10000000 # The maximum size(in bytes) of the download stream. Defaults to "10000000" if nothing is specified.
            "download_path": "/tmp", # Download path
 
            "live": True, # Tell the downloader it is getting a live stream
NOTE: Changes for next version:
            "duration": 10}  # Duration of stream to save. Defined in minutes.
* Name change to download
* Takes two arguments (string, dictionary)
* The supplied string must be an unique identifier. It can be a videoid, an UUID or anything else unique.
* A "videoid" variable is no long required in the submitted dictionary.


Returns None
Returns None


A simple http download
A simple http download
   params = { "videoid": "0", "video_url": "http://server.com/video.mp4", "Title": "my video" }
   params = { "url": "http://server.com/video.mp4", "download_path": "/tmp" }
   downloader.downloadVideo(params)
  downloader.downloadVideo("myvideo.mp4", params)
 
A simple http download with a custom title.
  params = { "url": "http://server.com/video.mp4", "download_path": "/tmp", "Title": "my video" }
   downloader.downloadVideo("myvideo.mp4", params)


A simple RTMP download
A simple RTMP download
   params = {"videoid": "1", "video_url": "rtmp://edge01.fms.dutchview.nl/botr/bunny", "Title": "bunny"}
   params = {"url": "rtmp://edge01.fms.dutchview.nl/botr/bunny", "Title": "bunny"}
   downloader.downloadVideo(params)
   downloader.downloadVideo("bunny.mp4", params)


A simple RTMP Live download
A simple RTMP Live download
   video = {"videoid": "2", "video_url": "rtmp://aljazeeraflashlivefs.fplive.net:1935/aljazeeraflashlive-live/aljazeera_english_1", "Title": "mock", "live": "true", "max_size": "3000000"}
   video = {"url": "rtmp://aljazeeraflashlivefs.fplive.net:1935/aljazeeraflashlive-live/aljazeera_english_1", "Title": "Live Download", "live": "true", "duration": "10"}
   downloader.downloadVideo(params)
   downloader.downloadVideo("aljazeera-10minutes.mp4", params)


[[Category:Pre-Eden add-on repository]]
[[Category:Pre-Eden add-on repository]]

Revision as of 23:54, 26 January 2012

Simple downloader for xbmc plugins.

See this add-on on the kodi.tv showcase

Author: TheCollective

Type: Add-on library/module
Repo:

Summary: Simple downloader for xbmc plugins.
Home icon grey.png   ▶ Add-ons ▶ Simple downloader for xbmc plugins.

Introduction

This is a downloader developed and used with the YouTube and BlipTV addons.

Features

  • One queue across all plugins
  • Requeing an existing item moves it to the front of the queue.
  • RTMP downloading if the rtmpdump binary is installed.
  • RTSP/mms downloading if the vlc or mplayer binary is installed.(And any other stream they accept)

Simple Downloader

Testing/Status

Integration and unittests are run continously by Jenkins

http://tc.tobiasussing.dk/jenkins/view/Simple%20Downloader/

Developers

This is a unified cross plugin http/rtmp downloader.

It is currently not possible to distribute the rtmpdump binary with this addon.

The user must make sure rtmpdump is installed in a system PATH for rtmp downloading to work.

Development and support thread: http://forum.xbmc.org/showthread.php?t=116500

Setup

To use the downloader edit your addon.xml like this.

 <requires>
   <import addon="xbmc.python" version="2.0"/>
   <import addon="script.module.simple.downloader.beta" version="0.9.1"/> # Add this
 </requires>

And add the following to your py file.

 import SimpleDownloader as downloader
 downloader = downloader.SimpleDownloader()

You can now access the downloader through the "downloader" variable.

Debugging

To enable debugging set the following values in your default.py

dbg = True # Default

Or you can change it after import with.

downlaoder.dbg = True # Default

Whenever you debug your own code you should also debug in the cache. Otherwise you should remember to DISABLE it.

downloadVideo(self, filename, params = {})

Takes filename(string) and dictionary list with url and download_path.

The filename must be unique.

The params collection can contain an optional Title to be shown during transfer, instead of showing the filename.

For http and normal RTMP streams you need to specify a url.

For live RMTP streams you also need to specify live and max_size:

           "download_path": "/tmp", # Download path
           "live": True, # Tell the downloader it is getting a live stream
           "duration": 10}  # Duration of stream to save. Defined in minutes.

Returns None

A simple http download

 params = { "url": "http://server.com/video.mp4", "download_path": "/tmp" }
 downloader.downloadVideo("myvideo.mp4", params)

A simple http download with a custom title.

 params = { "url": "http://server.com/video.mp4", "download_path": "/tmp", "Title": "my video" }
 downloader.downloadVideo("myvideo.mp4", params)

A simple RTMP download

 params = {"url": "rtmp://edge01.fms.dutchview.nl/botr/bunny", "Title": "bunny"}
 downloader.downloadVideo("bunny.mp4", params)

A simple RTMP Live download

 video = {"url": "rtmp://aljazeeraflashlivefs.fplive.net:1935/aljazeeraflashlive-live/aljazeera_english_1", "Title": "Live Download", "live": "true", "duration": "10"}
 downloader.downloadVideo("aljazeera-10minutes.mp4", params)