[Release] Simple downloader

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #1
This is version 0.9.1 of a simple downloader for XBMC.

This service will go to Final 1.0, with YouTube 3.0.

This addon provides a simple http/rtmp downloader.

A single queue is used across all plugins.

The rtmp downloader uses the rtmpdump binary, and thus only streams supported by the installed rtmpdump will work.

We have endeavoured to make the downloader as unintrusive for the user as possible, it is thus very simple.

Implementation details can be found on the wiki.

http://wiki.xbmc.org/index.php?title=Add...mc_plugins

This is a dependency used by our other plugins, and we perform constant integration and unittesting during development

http://tc.tobiasussing.dk/jenkins/view/S...ownloader/

Questions, requests, suggestions are welcome.

Note: Before the 1.0 final we do not promise the interface will stay locked.
After the 1.0 version there will be "DeprecatedFunction" warnings on changes for a limited time.

TheCollective
(This post was last modified: 2012-01-27 01:42 by TobiasTheCommie.)
find quote
Popeye Offline
Posting Freak
Posts: 911
Joined: Aug 2009
Reputation: 26
Location: Sweden
Post: #2
Excellent!

Would you mind adding all possible params to the wiki? I Was thinking about how to set the "live" parameter.
The rtmpdump binary have to be manually downloaded or?

sverigesradio | Pneumatic | SABnzbd | XBMC that just works - openelec
(This post was last modified: 2011-12-09 12:01 by Popeye.)
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #3
Sure, this is still a WIP, so we're bound to miss something.

As for the rtmp binary, we can't bundle it with the plugin, so it looks for the systemwide binary.

On linux it should Just Work™.

Sadly there isn't currently a better way to do it.

ETA: Updated the wiki with live RTMP stream examples.
(This post was last modified: 2011-12-09 17:51 by TobiasTheCommie.)
find quote
Popeye Offline
Posting Freak
Posts: 911
Joined: Aug 2009
Reputation: 26
Location: Sweden
Post: #4
Thanks for the information. Would it be possible to extend the api with a Boolean to know whether rtmpdump is supported or not?
This addon + svtplay = true IMHO

sverigesradio | Pneumatic | SABnzbd | XBMC that just works - openelec
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #5
That is doable.

Might even help me solve another problem i'm having. Smile
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #6
Finally got around to adding isRTMPInstalled.
find quote
Popeye Offline
Posting Freak
Posts: 911
Joined: Aug 2009
Reputation: 26
Location: Sweden
Post: #7
TobiasTheCommie Wrote:Finally got around to adding isRTMPInstalled.

Great, then I have some work todo.... Big Grin

sverigesradio | Pneumatic | SABnzbd | XBMC that just works - openelec
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #8
It hasn't been pushed yet, if you want the trunk it is here http://hg.tobiasussing.dk/hgweb.cgi/downloadxbmc/
find quote
divingmule Offline
Skilled Python Coder
Posts: 1,297
Joined: Oct 2008
Reputation: 61
Post: #9
Hi, I'm getting an AttributeError, any idea what I'm missing?

Code:
Error Type: <type 'exceptions.AttributeError'>
Error Contents: 'module' object has no attribute 'common'
Traceback (most recent call last):
          File "C:\Users\divingmule\Desktop\xbmc-pvr\XBMC\portable_data\addons\plugin.program.piratebay\default.py", line 16, in <module>
                                                downloader = downloader.SimpleDownloader()
          File "C:\Users\divingmule\Desktop\xbmc-pvr\XBMC\portable_data\addons\script.module.simple.downloader\lib\SimpleDownload​er.py", line 30, in __init__
                                                if sys.modules[ "__main__" ].common:
                                            AttributeError: 'module' object has no attribute 'common'
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #10
Oh crap, yeah, you are gonna need this too http://hg.tobiasussing.dk/hgweb.cgi/commonxbmc/
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #11
Pull requests have been sent for 0.9.1.

The updated version should land in the Eden repository soonish.
find quote
stacked Offline
Skilled Python Coder
Posts: 802
Joined: Jun 2007
Reputation: 18
Post: #12
Hey, thanks again for all your hard work on this. When using 0.9.0 I didn't have any problems. After updating to 0.9.1, the downloads no longer worked.

When using downloader.downloadVideo:
Code:
18:08:05 T:2228   ERROR: Error Contents: SimpleDownloader instance has no attribute 'downloadVideo'
18:08:05 T:2228   ERROR: Traceback (most recent call last):
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\plugin.video.g4tv\default.py", line 190, in <module>
                                                play_video(name, url, plot, thumb)
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\plugin.video.g4tv\default.py", line 139, in play_video
                                                downloader.downloadVideo("myvideo.mp4", params)
                                            AttributeError: SimpleDownloader instance has no attribute 'downloadVideo'


When using downloader.download:

Code:
        url = 'http://videos.revision3.com/revision3/web/tekzilla/0290/tekzilla--0290--dual-firewalls--hd720p30.h264.mp4'
        path = 'C:\\'
        name = 'tekzilla'
        params = { "url": url, "download_path": path, "Title": name }
                downloader.download("myvideo.mp4", params) }

Code:
18:03:17 T:2104   ERROR: Exception in thread Thread-1:
                                            Traceback (most recent call last):
                                              File "C:\Program Files (x86)\XBMC-Eden\system\python\Lib\threading.py", line 532, in __bootstrap_inner
                                                self.run()
                                              File "C:\Program Files (x86)\XBMC-Eden\system\python\Lib\threading.py", line 484, in run
                                                self.__target(*self.__args, **self.__kwargs)
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\script.module.simple.downloader\lib\SimpleDownloader.p​y", line 125, in _startDownload
                                                self._processQueue()
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\script.module.simple.downloader\lib\SimpleDownloader.p​y", line 167, in _processQueue
                                                status = self._downloadURL(filename, item)
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\script.module.simple.downloader\lib\SimpleDownloader.p​y", line 413, in _downloadURL
                                                self._updateProgress(filename, item, params)
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\script.module.simple.downloader\lib\SimpleDownloader.p​y", line 485, in _updateProgress
                                                speed = int((get("bytes_so_far") / 1024) / (new_mark - get("mark")))
                                            ZeroDivisionError: float division
18:03:18 T:2264    INFO: Python script stopped
(This post was last modified: 2012-01-29 04:12 by stacked.)
find quote
Fisslefink Offline
Junior Member
Posts: 3
Joined: Dec 2010
Reputation: 20
Post: #13
I am having the same error, consistently. It crashes XBMC. Please fix.

mythtv@beagle:~$ grep downloader *.log
xbmc_crashlog-20120128_231056.log:23:10:52 T:2832202608 ERROR: ADDON: extension 'downloader/' is not currently supported for service addon
xbmc_crashlog-20120129_100704.log:23:34:01 T:3019052864 ERROR: ADDON: extension 'downloader/' is not currently supported for service addon
xbmc_crashlog-20120129_100704.log:10:06:59 T:2715347824 ERROR: ADDON: extension 'downloader/' is not currently supported for service addon

A representative error log is here: http://pastebin.com/9vJmjrBN
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #14
stacked Wrote:Hey, thanks again for all your hard work on this. When using 0.9.0 I didn't have any problems. After updating to 0.9.1, the downloads no longer worked.

When using downloader.downloadVideo:
Code:
18:08:05 T:2228   ERROR: Error Contents: SimpleDownloader instance has no attribute 'downloadVideo'
18:08:05 T:2228   ERROR: Traceback (most recent call last):
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\plugin.video.g4tv\default.py", line 190, in <module>
                                                play_video(name, url, plot, thumb)
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\plugin.video.g4tv\default.py", line 139, in play_video
                                                downloader.downloadVideo("myvideo.mp4", params)
                                            AttributeError: SimpleDownloader instance has no attribute 'downloadVideo'


When using downloader.download:

Code:
        url = 'http://videos.revision3.com/revision3/web/tekzilla/0290/tekzilla--0290--dual-firewalls--hd720p30.h264.mp4'
        path = 'C:\\'
        name = 'tekzilla'
        params = { "url": url, "download_path": path, "Title": name }
                downloader.download("myvideo.mp4", params) }

Code:
18:03:17 T:2104   ERROR: Exception in thread Thread-1:
                                            Traceback (most recent call last):
                                              File "C:\Program Files (x86)\XBMC-Eden\system\python\Lib\threading.py", line 532, in __bootstrap_inner
                                                self.run()
                                              File "C:\Program Files (x86)\XBMC-Eden\system\python\Lib\threading.py", line 484, in run
                                                self.__target(*self.__args, **self.__kwargs)
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\script.module.simple.downloader\lib\SimpleDownloader.p​y", line 125, in _startDownload
                                                self._processQueue()
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\script.module.simple.downloader\lib\SimpleDownloader.p​y", line 167, in _processQueue
                                                status = self._downloadURL(filename, item)
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\script.module.simple.downloader\lib\SimpleDownloader.p​y", line 413, in _downloadURL
                                                self._updateProgress(filename, item, params)
                                              File "C:\Program Files (x86)\XBMC-Eden\portable_data\addons\script.module.simple.downloader\lib\SimpleDownloader.p​y", line 485, in _updateProgress
                                                speed = int((get("bytes_so_far") / 1024) / (new_mark - get("mark")))
                                            ZeroDivisionError: float division
18:03:18 T:2264    INFO: Python script stopped

This has been reported a few times, i can not reproduce this.

Full debug log please.

ETA:

downloadVideo has been deprecated, I've updated the wiki. Normal download() should just work.
(This post was last modified: 2012-01-30 00:12 by TobiasTheCommie.)
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #15
Fisslefink Wrote:I am having the same error, consistently. It crashes XBMC. Please fix.

mythtv@beagle:~$ grep downloader *.log
xbmc_crashlog-20120128_231056.log:23:10:52 T:2832202608 ERROR: ADDON: extension 'downloader/' is not currently supported for service addon
xbmc_crashlog-20120129_100704.log:23:34:01 T:3019052864 ERROR: ADDON: extension 'downloader/' is not currently supported for service addon
xbmc_crashlog-20120129_100704.log:10:06:59 T:2715347824 ERROR: ADDON: extension 'downloader/' is not currently supported for service addon

A representative error log is here: http://pastebin.com/9vJmjrBN

Those error messages are annoying, but not harmful.

I don't see anything related to the downloader in the pastebin, and honestly, nothing i makes should be able to crash XBMC. It is a bug in XBMC if the downloader can bring it down.

Please provide a full debug log if you want me to look at this further.
find quote
Post Reply