XBMC Community Forum
Icefilms (Icefilms.info) Addon Development Thread - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Python Add-on Development (/forumdisplay.php?fid=26)
+--- Thread: Icefilms (Icefilms.info) Addon Development Thread (/showthread.php?tid=90315)



- Eldorado - 2011-12-02 20:06

I wonder if you just don't have enough of the file cached by the time it tries to start playing?

Try bumping the buffer delay to say 20 or more seconds and see how it goes

Look at line 2281:

Code:
handle_wait([b][color=red]10[/color][/b], "Buffering", "Waiting a bit before playing...")

I've been mainly testing at work with a rather fast connection, so might be the issue..


Edit - just pushed in another quick fix, added a new setting for Buffer Delay.. and a Video Seeking option that picky backs on the download & watch code


- zpanderson - 2011-12-02 21:55

Eldorado Wrote:I wonder if you just don't have enough of the file cached by the time it tries to start playing?

Try bumping the buffer delay to say 20 or more seconds and see how it goes

Look at line 2281:

Code:
handle_wait([b][color=red]10[/color][/b], "Buffering", "Waiting a bit before playing...")

I've been mainly testing at work with a rather fast connection, so might be the issue..


Edit - just pushed in another quick fix, added a new setting for Buffer Delay.. and a Video Seeking option that picky backs on the download & watch code

Why not just set the wait time to be dynamic until the downloaded file size is xxx? (whatever the minimum should be...)


- ndeshmukh - 2011-12-02 22:05

Sorry guys, I have been too busy at work to offer any help.

Sometimes in the D&W it so happens that the file on MU is in such a shape that it refuses to play till the whole download happens. Not very frequent, but does happen. In almost all cases, the file is downloading, and XBMC as well as VLC refuses to play it till the whole downloads finishes. I doubt you can do much there.


I don't think XBMC likes the player to start and the addon actually held up waiting for it to stop. It would be better to add those 3 D&W options to the directory listing before you start the player. If you movie actually finishes you could clear up the directory and readd the sources (resembling an up directory) or actually simulate an up directory (I briefly looked but couldn't find it). Basically what I am saying is don't hold up the thread that actually called the player. Agreed that the player runs in its own thread, and it should work, but unfortunately my experience was that it doesn't play ball.

Another important thing I found was that if the sources in the source list were not actually added as folders, then the threading doesn't work well when they are actually clicked upon. i.e. addDirectoryItem( "Sourec 1", isFolder=False) and if teh addon is then invoked from this, then threading inside that is very iffy. Mostly you get the dreaded "Type Error, or Integer required" or some error to that effect. So if it is not added as folder, it is okay to stream, but not okay to do D&W.


- ndeshmukh - 2011-12-02 22:08

I have a mod of my mod for personal use where I do have all the scraped sources from a db you can find on the net bundled with something called an MU Player. But I am too afraid to share it, as that might just put me on the wrong side of DMCA. I would say don't keep any MU links in the addon as cached.

zpanderson Wrote:Since we're doing so much with the metadata and saving to the db is there a reason that we can't just dump the sources in there as well so that the plugin will work (for most things) even when icefilms is down?

That would make it easier to do the multi-parts / etc. because we'd have all the urls stored and wouldn't have to look for them again. (I tried to do this in a list inside the plugin but the random re-initialization when starting a stream kills that idea).



- Eldorado - 2011-12-02 23:04

Thanks for the tips ndeshmukh!

Maybe if you have some time we can all try and solidify this download & watch functionality.. I'm sure other addons that will come along will benefit from the work done in Icefilms as well!

For now I've only implemented the file based D&W.. was there any systems that Env based was required?



Everyone - I just pushed in my last update with zpanderson's stacked playlist support

Currently I put it in as is, so it's not integrated to work with download&watch or video seeking at all.. it might be messy coding to get it there... or it might not.. not sure yet

I'm done coding until Monday, so test/fix away Smile


- zpanderson - 2011-12-02 23:47

I just updated to the latest and greatest after completely deleting icefilms and metahandler folders and there's a few things that I'm seeing...

This folder is not being created...
Code:
metapath = icedatapath+'/mirror_page_meta_cache'

Also, I have fanart enabled for movies and TV shows but it doesn't appear to be scraping it?


- Eldorado - 2011-12-03 00:46

zpanderson Wrote:I just updated to the latest and greatest after completely deleting icefilms and metahandler folders and there's a few things that I'm seeing...

This folder is not being created...
Code:
metapath = icedatapath+'/mirror_page_meta_cache'

Also, I have fanart enabled for movies and TV shows but it doesn't appear to be scraping it?

Hmmm... have to check how/where the folder was being created, probably got wiped from the code during the merge from stable -> master.. I haven't tried deleting my Icefilms userdata folder yet

I think there's also some left over/useless folders and variables still in the code.. bit of a mess

I haven't uploaded the fanart yet, it will only display/scrape them when you have the settings turned on and the fanart packs downloaded/installed.. you can override it by setting the two backdrop fields to 'true' in the addons table of the metahandler video_cache.db


- zpanderson - 2011-12-03 01:00

Eldorado Wrote:Hmmm... have to check how/where the folder was being created, probably got wiped from the code during the merge from stable -> master.. I haven't tried deleting my Icefilms userdata folder yet

I think there's also some left over/useless folders and variables still in the code.. bit of a mess

I haven't uploaded the fanart yet, it will only display/scrape them when you have the settings turned on and the fanart packs downloaded/installed.. you can override it by setting the two backdrop fields to 'true' in the addons table of the metahandler video_cache.db

The folder should be created in the start up part...

Code:
def Startup_Routines():
    
     # avoid error on first run if no paths exists, by creating paths
     if not os.path.exists(translatedicedatapath): os.makedirs(translatedicedatapath)
     if not os.path.exists(transdowninfopath): os.makedirs(transdowninfopath)

Why do you require the downloads to scrape? I would think as long as the setting for fanart is turned on it should scrape...

One situation I think this could be useful in is I know some people who are space limited may only want to scrape their favorites or something along those lines without having to download the entire zip.

Let me know what you think.

[edit] Another thing... Like I was asking earlier, why not have the buffer_delay for download & watch be dynamic until the file is x size? (to keep it independent of download speeds)

Code:
print "Starting Download Thread"
        dlThread = DownloadThread(link[0], mypath, vidname)
        dlThread.start()
        #buffer_delay = int(selfAddon.getSetting('buffer-delay'))
        #handle_wait(buffer_delay, "Buffering", "Waiting a bit before playing...")
        while(1):
               if os.path.getsize(mypath) > [b]**minsize**[/b]:
                     break



- Eldorado - 2011-12-03 19:27

zpanderson Wrote:Why do you require the downloads to scrape? I would think as long as the setting for fanart is turned on it should scrape...

One situation I think this could be useful in is I know some people who are space limited may only want to scrape their favorites or something along those lines without having to download the entire zip.

Let me know what you think.

Well it's the same as how the current release is - you want meta data you must install the meta pack

It's so that we don't put a big load on the TMDB and TVDB servers, there's no need to have hundreds (thousands?) of people scraping for the same information and downloading literally thousands of images, Icefilms is crazy popular so we have to be responsible, I'm sure the TMDB guys will thank us

When you navigate into a folder, XBMC will download and temporarily (?) cache all those images, covers are approx. 20k but fanart is usually between 300-400k each, so just think what will happen when you go into say Movies and letter S.. well over a thousand movies all being scrapped, images downloaded.. a single user can easily pull over a gig from them by just browsing the folders, multiple that by the number of people using the addon

If we're thinking of the ATV2 and space, well they might not be able to do fanart, i believe it will slow it down to a crawl anyways.. but other systems, hard drive space is cheap Smile

The idea of allowing just a small area like favorites to scrape sounds reasonable, might be tough to code special rules in for it though.. if you turn meta data on and fanart packs, you will always get prompted for the download on startup

zpanderson Wrote:[edit] Another thing... Like I was asking earlier, why not have the buffer_delay for download & watch be dynamic until the file is x size? (to keep it independent of download speeds)

Code:
print "Starting Download Thread"
        dlThread = DownloadThread(link[0], mypath, vidname)
        dlThread.start()
        #buffer_delay = int(selfAddon.getSetting('buffer-delay'))
        #handle_wait(buffer_delay, "Buffering", "Waiting a bit before playing...")
        while(1):
               if os.path.getsize(mypath) > [b]**minsize**[/b]:
                     break

Hmm.. we would have to discuss this one more I think, more ideas the better!

The only trouble I can see with this is how would the user know when their video is going to start? With a time delay it's obvious, with a file size delay.. maybe we would have to use a download progress box? How would they know what the correct size should be, would vary depending on what they are watching

How about we set our own internal file size restriction? Currently I believe it checks if we received at least 100k.. maybe bump that up to 1meg or more? Look in the code for the raise SmallFile error

One crappy part about D&W - if your not receiving fast enough and what you are playing catches up to the download, the video will cut off playing.. have to find a spot to catch that and display a msg


- zpanderson - 2011-12-03 21:55

Eldorado Wrote:Well it's the same as how the current release is - you want meta data you must install the meta pack

It's so that we don't put a big load on the TMDB and TVDB servers, there's no need to have hundreds (thousands?) of people scraping for the same information and downloading literally thousands of images, Icefilms is crazy popular so we have to be responsible, I'm sure the TMDB guys will thank us

When you navigate into a folder, XBMC will download and temporarily (?) cache all those images, covers are approx. 20k but fanart is usually between 300-400k each, so just think what will happen when you go into say Movies and letter S.. well over a thousand movies all being scrapped, images downloaded.. a single user can easily pull over a gig from them by just browsing the folders, multiple that by the number of people using the addon

If we're thinking of the ATV2 and space, well they might not be able to do fanart, i believe it will slow it down to a crawl anyways.. but other systems, hard drive space is cheap Smile

The idea of allowing just a small area like favorites to scrape sounds reasonable, might be tough to code special rules in for it though.. if you turn meta data on and fanart packs, you will always get prompted for the download on startup



Hmm.. we would have to discuss this one more I think, more ideas the better!

The only trouble I can see with this is how would the user know when their video is going to start? With a time delay it's obvious, with a file size delay.. maybe we would have to use a download progress box? How would they know what the correct size should be, would vary depending on what they are watching

How about we set our own internal file size restriction? Currently I believe it checks if we received at least 100k.. maybe bump that up to 1meg or more? Look in the code for the raise SmallFile error

One crappy part about D&W - if your not receiving fast enough and what you are playing catches up to the download, the video will cut off playing.. have to find a spot to catch that and display a msg

It is an interesting question we've got here... I was just messing around and set it to wait until the file is 100mb and show the progress dialog. I'm not sure how to determine what the minimum would be though...

[EDIT] I thought about it some more and decided that we can get the file size from megaupload page and then have a setting to say what % of the file we want cached before it starts playing (updated code snippet as well)

Code:
source=GetURL(url)
        match=re.compile('<strong>File size:</strong> (.+?) MB<br />').findall(source)
        fileSize = float(match[0])
        minSize = (fileSize * int(selfAddon.getSetting('download-percent-before-playing')) / float(100)
        #minSize = (fileSize * int(40)) / float(100)
        print 'This is the minSize: ' + str(minSize) + ' and this is the fileSize: ' + str(fileSize)
        dProgress = xbmcgui.DialogProgress()
        dProgress.create('Downloading', vidname, '     will start playing as soon', '      as it reaches the minimum size')
        while 1:
            if os.path.exists(mypath):
                downloadedPercent = int((os.path.getsize(mypath) / (float(minSize)*1000000)) * 100)
                dProgress.update(downloadedPercent)
                print 'updating percent to ' + str(downloadedPercent)
                if os.path.getsize(mypath) > (minSize * 1000000):
                    print 'file is now > ' + str(minSize)  
                    dProgress.close()
                    if dlThread.isAlive():
                        listitem=Item_Meta(name)
                              
                        play_with_watched(mypath, listitem, '')
                
                        #xbmc.Player().play(mypath, listitem)
                        addDownloadControls(name,mypath, listitem)
                        break
                print 'downloaded file isnt big enough yet'
                xbmc.sleep(1000)

To try and fix the issue where you run out of downloaded video to stream (and it kills the stream) could we monitor the percentWatched and make sure it is over the percentDownloaded then wait for a while? I know that isn't an exact match, but it might at least keep it close...