[Release] Simple downloader

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
stacked Offline
Skilled Python Coder
Posts: 802
Joined: Jun 2007
Reputation: 18
Post: #16
Full Debug log for ZeroDivisionError http://pastebin.com/KygxEyBy

I was able to fix this ZeroDivisionError.

The problem happens in:
script.module.simple.downloader\lib\SimpleDownloader.py", line 485, in _updateProgress
Code:
speed = int((get("bytes_so_far") / 1024) / (new_mark - get("mark")))

When a download starts, new_mark will sometimes equal get("mark"). This causes the denominator in the equation to be zero and python errors out. I'm not sure if this is the best fix, but replacing line 485 with the code below prevents a zero denominator.

Code:
if new_mark == get("mark"):
            speed = 0
        else:
            speed = int((get("bytes_so_far") / 1024) / (new_mark - get("mark")))

I've test this and it works fine.
(This post was last modified: 2012-01-30 03:17 by stacked.)
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #17
Ah yes, that makes perfect sense.

thanks Smile
find quote
virtualxtc Offline
Junior Member
Posts: 1
Joined: Jan 2012
Reputation: 0
Post: #18
I've been having the same issue for the past several days. Is there a binary patch available or do I need to manually fix this and recompile?

thanks.
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #19
No recompile needed. I need to push a new update.

This was a stupid bug that i never hit myself :/
find quote
sphere Offline
Team-XBMC Member
Posts: 1,177
Joined: Jul 2009
Reputation: 49
Location: Germany
Post: #20
TobiasTheCommie Wrote:No recompile needed. I need to push a new update.

any updates on this?

Im thinking about using your module in my addons - but at the moment it is unusable Wink

regards,
sphere

My GitHub. My Add-ons:
[Image: IOoywq0.jpg]
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #21
sphere Wrote:any updates on this?

Im thinking about using your module in my addons - but at the moment it is unusable Wink

regards,
sphere

It will come when it comes. Sorry, i don't feel confident in giving a specific date.

I do expect to push an update before the next YouTube update. Hopefully there will be no interface changes from now on in, So pushing should no longer be locked. I hope.
find quote
sphere Offline
Team-XBMC Member
Posts: 1,177
Joined: Jul 2009
Reputation: 49
Location: Germany
Post: #22
TobiasTheCommie Wrote:It will come when it comes. Sorry, i don't feel confident in giving a specific date.

I do expect to push an update before the next YouTube update. Hopefully there will be no interface changes from now on in, So pushing should no longer be locked. I hope.

Hi

Ok cool. Sure Push it when you feel that it is done Smile
I just wanted to know if there are any Updates Wink

Regards
sphere

My GitHub. My Add-ons:
[Image: IOoywq0.jpg]
find quote
spoyser Offline
Donor
Posts: 220
Joined: Oct 2011
Reputation: 17
Post: #23
How would I setup the params to acheive the equivalent of this:

Code:
C:\RTMP\rtmpdump.exe
--rtmp "rtmpe://cp72511.edgefcs.net"
--app "ondemand?auth=eaEdQdlbUayd6bLdDbrcZaeatdVaub3bKcVbzbzajbXdyb2c6bebqbtdkdbb1d.cJb​B-bpmKkV-eS-6An2IArmDsDs&aifp=v002&slist=production/"
--flashVer "WIN 11,0,1,152"
--swfVfy "http://www.itv.com/mercury/Mercury_VideoPlayer.swf"
--conn Z:
--playpath "mp4:production/priority/CATCHUP/6ccad712/561b/4126/9673/713b489f4d25/1-9502-0033-001_BABAR-AND-THE-ADVENTURES-OF-BADOU_TX270112_ITV1200_16X9.mp4"
-o "C:\Downloads\Babar and the Adventures of Badou - Ruby Rumpus - Episode 33.flv"

TIA
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #24
spoyser Wrote:How would I setup the params to acheive the equivalent of this:

Code:
C:\RTMP\rtmpdump.exe
--rtmp "rtmpe://cp72511.edgefcs.net"
--app "ondemand?auth=eaEdQdlbUayd6bLdDbrcZaeatdVaub3bKcVbzbzajbXdyb2c6bebqbtdkdbb1d.cJb​B-bpmKkV-eS-6An2IArmDsDs&aifp=v002&slist=production/"
--flashVer "WIN 11,0,1,152"
--swfVfy "http://www.itv.com/mercury/Mercury_VideoPlayer.swf"
--conn Z:
--playpath "mp4:production/priority/CATCHUP/6ccad712/561b/4126/9673/713b489f4d25/1-9502-0033-001_BABAR-AND-THE-ADVENTURES-OF-BADOU_TX270112_ITV1200_16X9.mp4"
-o "C:\Downloads\Babar and the Adventures of Badou - Ruby Rumpus - Episode 33.flv"

TIA

That finegrained control is currently not done.

It can/will be added for later versions though.

ETA: Currenlty adding this to the trunk. Will the above work with a danish IP? If you give me stuff i can test against, then, well, i can test against it. And make sure it works Smile
(This post was last modified: 2012-02-09 15:00 by TobiasTheCommie.)
find quote
spoyser Offline
Donor
Posts: 220
Joined: Oct 2011
Reputation: 17
Post: #25
The example will only work from a UK ip address, but if you want to send me the new .py file I'll give it a test
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #26
Replace your ~/.xbmc/addons/script.module.simple.downloader/lib/SimpleDownloader.py with this
http://paste.ubuntu.com/835850/

then you should be able to set all the rtmpdump parameters in the dictionary you give the downloader.

I've used all the full length arguments, (ie, --rtmp not -r) names. so setting { "rtmp": "rtmp://bla", "app": "my_path", "swfVfy": "whatever"} should hopefully work just like it would with the rtmpdump program in a shell.

The only arguments from the man page i have not included, are those under the "Miscellaneous" heading.

NOTE: This is a direct copy from trunk. NOT a backport to 0.9.1
(This post was last modified: 2012-02-10 00:32 by TobiasTheCommie.)
find quote
spoyser Offline
Donor
Posts: 220
Joined: Oct 2011
Reputation: 17
Post: #27
Not having much luck.

Can you confirm for this:

Code:
C:\RTMP\rtmpdump.exe
--rtmp "rtmpe://cp72511.edgefcs.net"
--app "ondemand?auth=eaEd0dGb3cmdQcwbhdAdhdJd6d4dUaybjapdccubCbcaac0aZdccOcUb5bhdqbTbpb​0-bpnpmw-eS-6Ao2HCpmxtyq&aifp=v002&slist=production/"
--flashVer "WIN 11,0,1,152" --swfVfy "http://www.itv.com/mercury/Mercury_VideoPlayer.swf"
--conn Z:
--playpath "mp4:production/CATCHUP/12333f63/0be8/4bf5/a9a7/f01ed13934d7/1-1125-0006-004_THE-ADVENTURES-OF-SHERLOCK-HOLMES_TX260112_ITV800_16X9.mp4"
-o "C:\Download\Sherlock Holmes - A Crooked Man - Episode 5.flv"

I would do this:

Code:
params = {"url"           : "rtmpe://cp72511.edgefcs.net",
              "download_path" : "/download",
              "Title"         : "Sherlock Holmes - A Crooked Man - Episode 5",
              "app"           : "ondemand?auth=eaEd0dGb3cmdQcwbhdAdhdJd6d4dUaybjapdccubCbcaac0aZdccOcUb5bhdqbTbpb​0-bpnpmw-eS-6Ao2HCpmxtyq&aifp=v002&slist=production/",
              "flashVer"      : "WIN 11,0,1,152",
              "swfVfy"        : "http://www.itv.com/mercury/Mercury_VideoPlayer.swf",
              "conn"          : "Z:",
              "playpath"      : "mp4:production/CATCHUP/12333f63/0be8/4bf5/a9a7/f01ed13934d7/1-1125-0006-004_THE-ADVENTURES-OF-SHERLOCK-HOLMES_TX260112_ITV800_16X9.mp4",
              "flv"           : "C:\Download\Sherlock Holmes - A Crooked Man - Episode 5.flv"}
    downloader.download("Sherlock Holmes - A Crooked Man - Episode 5.flv", params)

Do I need to wrap anything in extra quotes? Or should the parameters have the - or -- infront of them?
(This post was last modified: 2012-02-10 12:55 by spoyser.)
find quote
TobiasTheCommie Offline
Skilled Python Coder
Posts: 617
Joined: Apr 2008
Reputation: 4
Post: #28
spoyser Wrote:Not having much luck.

Can you confirm for this:

Code:
C:\RTMP\rtmpdump.exe
--rtmp "rtmpe://cp72511.edgefcs.net"
--app "ondemand?auth=eaEd0dGb3cmdQcwbhdAdhdJd6d4dUaybjapdccubCbcaac0aZdccOcUb5bhdqbTbpb​0-bpnpmw-eS-6Ao2HCpmxtyq&aifp=v002&slist=production/"
--flashVer "WIN 11,0,1,152" --swfVfy "http://www.itv.com/mercury/Mercury_VideoPlayer.swf"
--conn Z:
--playpath "mp4:production/CATCHUP/12333f63/0be8/4bf5/a9a7/f01ed13934d7/1-1125-0006-004_THE-ADVENTURES-OF-SHERLOCK-HOLMES_TX260112_ITV800_16X9.mp4"
-o "C:\Download\Sherlock Holmes - A Crooked Man - Episode 5.flv"

I would do this:

Code:
params = {"url"           : "rtmpe://cp72511.edgefcs.net",
              "download_path" : "/download",
              "Title"         : "Sherlock Holmes - A Crooked Man - Episode 5",
              "app"           : "ondemand?auth=eaEd0dGb3cmdQcwbhdAdhdJd6d4dUaybjapdccubCbcaac0aZdccOcUb5bhdqbTbpb​0-bpnpmw-eS-6Ao2HCpmxtyq&aifp=v002&slist=production/",
              "flashVer"      : "WIN 11,0,1,152",
              "swfVfy"        : "http://www.itv.com/mercury/Mercury_VideoPlayer.swf",
              "conn"          : "Z:",
              "playpath"      : "mp4:production/CATCHUP/12333f63/0be8/4bf5/a9a7/f01ed13934d7/1-1125-0006-004_THE-ADVENTURES-OF-SHERLOCK-HOLMES_TX260112_ITV800_16X9.mp4",
              "flv"           : "C:\Download\Sherlock Holmes - A Crooked Man - Episode 5.flv"}
    downloader.download("Sherlock Holmes - A Crooked Man - Episode 5.flv", params)

Do I need to wrap anything in extra quotes? Or should the parameters have the - or -- infront of them?

download_path <- Must be c:\Downloads, not just /download

And you shouldn't set flv, the downloader sets a temporary path itself, then moves to the final destination.
find quote
spoyser Offline
Donor
Posts: 220
Joined: Oct 2011
Reputation: 17
Post: #29
TobiasTheCommie Wrote:download_path <- Must be c:\Downloads, not just /download

And you shouldn't set flv, the downloader sets a temporary path itself, then moves to the final destination.

Cheers for the info, I'll give it a try and let you know how I get on.
find quote
Memphiz Offline
Team-XBMC Developer
Posts: 10,143
Joined: Feb 2011
Reputation: 109
Location: germany
Post: #30
@TobiasTheCommie

Hi - i think amet already mailed you. It seems your script spams our logs (though unwanted i guess).

Code:
ADDON: extension 'downloader/' is not currently supported for service addon

Extension point service needs a "library" attribute. Not sure why you even provide that extension point (downloader isn't a service imho). So either you drop that extension point. Or if its needed (not quiet into it) you have to provide the Library attribute pointing to a .py (no clue again which should that be in your case).

Would be great if you could fix this and do a pr request on the addon mailing list.

Thx

Memphiz

AppleTV2/iPhone/iPod: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for XBMC: Wiki NFS
HowTo configure avahi (zeroconf): Wiki Avahi
READ THE IOS FAQ!: iOS FAQ
find quote