XBMC Community Forum
script.module.urlresolver development - 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: script.module.urlresolver development (/showthread.php?tid=105707)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31


- rogerthis - 2011-08-17 21:07

DragonWin Wrote:As I'm a big fan of the icefilms plugin I was wondering if the urlresolver could include a feature to bookmark links for later viewing like icefilms can, or would that be out of scope?

Yeah, I really like the Favorites in IceFilms. It the first section I go to when I'm using it. I had a look at the icefilms code, and anarchintosh has put it into his addDir:
Code:
def addDir(name, url, mode, iconimage, metainfo=False, imdb=False, delfromfav=False, total=False, disablefav=False, searchMode=False):

Whether it would come under the scope of this project, I don't know.


- DragonWin - 2011-08-17 22:17

Hey T0mm0

I think I found out what's wrong with the putlocker plugin

The submit on the page is different from the one that's in the plugin. It looks like they have multiple ways they present the streaming pages.

Here is the url taken from the debug output when it was added by the plugin (removed the url encoding)

http://www.putlocker.com/embed/B28AE94A046F58F1

Web page source
Code:
<input type="hidden" value="1fb066322ff81229" name="hash">
<input name="confirm" type="submit" value="Close Ad and Watch as Free User" class="confirm_button" style="width:250px;">

Plugin code
Code:
try:
            self.net.http_POST(web_url, form_data={'hash': session_hash,
                                          'confirm': 'Continue as Free User'})
        except urllib2.URLError, e:

The submit value is different

I'm off again need some sleep before catching the plane tomorrow morning, I'll check here before I make changes to the putlocker plugin to see if you have changed it.

@rogerthis
Interesting would have to talk to anarchintosh before ripping of any code from the plugin, but def. worth investigating (if it's within scope)

--
DragonWin


- t0mm0 - 2011-08-17 22:35

hi!

DragonWin Wrote:I'm unfamiliar with Git, but once I get closer to being satisfied I'll get in contact with you and figure out how it works.
i'm not a git expert either but there's plenty of good docs on github and i'm finding the tools a nice way to collaborate.

DragonWin Wrote:Thanks for the extensive explanation, I feel like a lot of the fog has just lifted from my eyes.

I am aware that the urlresolver is alpha/beta software and not released yet, so I expect some changes to affect the plugins I have / will write. Hopefully it will be fairly easy to adapt to.
absolutely (and of course the docs will be updated). it's good to have people looking at it before it becomes 'stable' and released because you will probably find stuff that is silly and should be changed. since starting to write the letmewatchthis addon i've already started thinking about ways to make it easier.....
DragonWin Wrote:Just some thoughts I had...

As I'm a big fan of the icefilms plugin I was wondering if the urlresolver could include a feature to bookmark links for later viewing like icefilms can, or would that be out of scope?
i don't know if you have read anarchintosh's document that inspired this effort, but basically the original idea was to build a bunch of specialised modules to do different things that could be reused across addons. i started off just saying i would try to implement the resolving bit, though i have also added the generic stuff in t0mm0.common in the process

i'm afraid i am not much of a power user when it comes to xbmc (i spend much more time playing with the code than actually using it!) so i am not really familiar with all these features so not sure i could comment on whether that stuff should be added to t0mm0.common at the moment (it's definitely not urlresolver territory). maybe if someone could define exactly what the feature is and roughly how it works we would be able to make a decision on where to put it.
DragonWin Wrote:Another idea I had was to build a scraper functions for anonymous proxies to use in plugins, some sites will only allow you to stream from them if your within a specific region. I was thinking that it could be an xml option to "enable anonymous proxy" and "select country" and the feature would scrape the anon proxy sites and do a "head" to eg. google, to detect a working proxy. This would be nice to have in the t0mm0.common.net class to be available to all plugins.
i think i like this idea Wink
maybe this could be done in urlresolver, the settings interface could be expanded to add a call to set the preferred country for your plugin? then users could enable the proxy and/or set a custom one instead of an auto-detected one (if they know of a stable proxy in the right country) in each plugins settings. the actual code could probably go in t0mm0.common.net so it is available to addons that don't use urlresolver.

what do you think?

i also want to add decent caching support to t0mm0.common.net as most of the time when browsing show or movie listings the listings remain unchanged so fetching a new copy is pointless.

(also maybe we should come up with a better naming scheme for these modules - any ideas on that front are welcome!)
DragonWin Wrote:I'm going to have to stop writing now as I have to order plane tickets and book a hotel as I'm leaving tomorrow morning for a business trip Rolleyes

Thanks for the help so far I hope I can put it to good use Big Grin

no problem! i hope you find this stuff useful and end up contributing code back to the project Cool

t0mm0


- t0mm0 - 2011-08-17 22:38

DragonWin Wrote:Hey T0mm0

I think I found out what's wrong with the putlocker plugin

The submit on the page is different from the one that's in the plugin. It looks like they have multiple ways they present the streaming pages.

Here is the url taken from the debug output when it was added by the plugin (removed the url encoding)

http://www.putlocker.com/embed/B28AE94A046F58F1

Web page source
Code:
<input type="hidden" value="1fb066322ff81229" name="hash">
<input name="confirm" type="submit" value="Close Ad and Watch as Free User" class="confirm_button" style="width:250px;">

Plugin code
Code:
try:
            self.net.http_POST(web_url, form_data={'hash': session_hash,
                                          'confirm': 'Continue as Free User'})
        except urllib2.URLError, e:

The submit value is different

I'm off again need some sleep before catching the plane tomorrow morning, I'll check here before I make changes to the putlocker plugin to see if you have changed it.

ah, looks like we just need to scrape the value of the submit button too then? i'll take a quick look now and see if that sorts it out.

edit: actually just committed the fix - the problem was that to get the url for the xml file to grab i was searching and replacing on 'file', but that didn't do anything when the url was an 'embed' url instead. changed now to look for 'file' or 'embed'. i also changed valid_url() to return True for both putlocker and sockshare urls and removed the sockshare plugin.

thanks,

t0mm0


- rogerthis - 2011-08-18 01:02

t0mm0 Wrote:i don't know if you have read anarchintosh's document that inspired this effort, but basically the original idea was to build a bunch of specialised modules to do different things that could be reused across addons. i started off just saying i would try to implement the resolving bit, though i have also added the generic stuff in t0mm0.common in the process

i'm afraid i am not much of a power user when it comes to xbmc (i spend much more time playing with the code than actually using it!) so i am not really familiar with all these features so not sure i could comment on whether that stuff should be added to t0mm0.common at the moment (it's definitely not urlresolver territory). maybe if someone could define exactly what the feature is and roughly how it works we would be able to make a decision on where to put it.
t0mm0

Favorites in IceFilms:
From with the main menu of Icefilms, one of the options is Favourites
To add a TV show you like, right click to bring up the menu. Select "Add to Favorites"
Then when ever you go into Favourites all your favourite shows will be listed. So no more search through long lists in A - Z to bring up your favourite tv shows. It works the same for movies. Very handy indeed. All the favourites are stored locally in a cache file on your xbmc device.

In the IceFilms code, here are the list of Favourite related functions.
def favRead(string):
def addFavourites(enablemetadata,directory,dircontents):
def FAVOURITES(url):
def MOVIE_FAVOURITES(url):
def TV_FAVOURITES(url):
def ADD_TO_FAVOURITES(name,url,imdbnum):
def DELETE_FROM_FAVOURITES(name,url):
def CLEAR_FAVOURITES(url):

There is actually a fair chuck of icefilms addon code related to Favourites.
It could be a project of it's self. I can't see how you could separate it into a completely different module though, it would be better within the script.module.t0mm0.common. t0mm0, if you could have a look it would be great!

t0mm0 Wrote:i think i like this idea Wink
maybe this could be done in urlresolver, the settings interface could be expanded to add a call to set the preferred country for your plugin? then users could enable the proxy and/or set a custom one instead of an auto-detected one (if they know of a stable proxy in the right country) in each plugins settings. the actual code could probably go in t0mm0.common.net so it is available to addons that don't use urlresolver.

what do you think?
This could be another interest setting: X-Forwarded-For
http://forum.xbmc.org/showpost.php?p=691501&postcount=260
It's used to bypass geolock, It seems to work better for the smaller hosters. The likes of the BBC iPlayer and Hulu, it doesn't work with.


t0mm0 Wrote:i also want to add decent caching support to t0mm0.common.net as most of the time when browsing show or movie listings the listings remain unchanged so fetching a new copy is pointless.

Would adding a caching support, enable watched status support? This would be a very useful feature.


- Eldorado - 2011-08-18 19:26

t0mm0, quick question which might have already been answered

How were you planning the distribution of urlresolver?

To be installed separately by the user eg. jDownloader

Or each developer packages it with their addons, making them responsible for updating themselves to new updates?

Edit - nevermind, finally took a peak in your Git and noticed the addon.xml Smile


- t0mm0 - 2011-08-18 20:09

rogerthis Wrote:Favorites in IceFilms:
<snip>
if you could have a look it would be great!
why not use the built in xbmc favourites? am i missing something?

seems like a lot of effort to re-implement something that is already provided by a stock install of xbmc....

rogerthis Wrote:This could be another interest setting: X-Forwarded-For
http://forum.xbmc.org/showpost.php?p=691501&postcount=260
It's used to bypass geolock, It seems to work better for the smaller hosters. The likes of the BBC iPlayer and Hulu, it doesn't work with.
yes good point, i have used that trick in a browser before to access US content before i had access to a proxy and vpn.


rogerthis Wrote:Would adding a caching support, enable watched status support? This would be a very useful feature.

no, it would just speed up listings requests and not annoy servers so much.

Eldorado Wrote:t0mm0, quick question which might have already been answered

How were you planning the distribution of urlresolver?

Edit - nevermind, finally took a peak in your Git and noticed the addon.xml Smile

i guess you have worked it out but in case anyone else is listening it is designed to be automatically installed by adding it as a dependency in your addon.xml - users need never know about installing it, and all addon authors need to add is add a single line in addon.xml

it means that there is only one copy on each install of xbmc and updates (sch as new plugins) will be available to all addons using it without having to change anything in the addon.

obviously this is of no use until it gets into a repo....

t0mm0


- rogerthis - 2011-08-18 20:42

t0mm0 Wrote:why not use the built in xbmc favourites? am i missing something?

seems like a lot of effort to re-implement something that is already provided by a stock install of xbmc....

Well, I learnt something new today. I thought the favourites in xbmc were for your addons, not within addons too. I'm going to put my icefilms favourites in my xbmc favourites . All the same, it's nice to have the favourites within icefilms too, because it just list your icefilms favourites. It doesn't clutter up your other favourites list. I don't think you can have folders within favourites, can you?

Anyways, t0mm0 did you get a chance to look at my vidxden code?


- iDude - 2011-08-18 22:19

I personally think that favorites should be handled by the addons separately. That's because many sites have a "favorites" section once you sign up. letmewatchthis.ch has this for example and it's quite useful because you can add whole TV shows to your favorites and they update themselves when a new episode comes out. This in combination with XBMC.MyLibrary and you have a SickBeard for streaming (Works with movies too)

I already modified t0mm0s addon so that instead of an a-z listing i get my favorite TV shows. Add a simple search filter for XBMC.MyLibrary and that's it. Now I can add tv shows on the road and don't need any servers running at home, don't need to download anything and everything just works automagically Laugh
This should also work with movies but I haven't tried it yet.

But the more I think it about the more it seems that this is maybe a site specific feature and should be handled separately. I don't know. Maybe I'm just talking nonsense (been awake for the last 36 hours)


- t0mm0 - 2011-08-18 23:02

rogerthis Wrote:Well, I learnt something new today. I thought the favourites in xbmc were for your addons, not within addons too. I'm going to put my icefilms favourites in my xbmc favourites . All the same, it's nice to have the favourites within icefilms too, because it just list your icefilms favourites. It doesn't clutter up your other favourites list. I don't think you can have folders within favourites, can you?

don't know about that. if not i'd say it would be better to add it to xbmc so all addons automatically benefit rather than have to write the same thing in each addon. there's lots of other stuff that doesn't exist yet that i'd prefer to work on first - of course if someone else wants to write something that's cool.

rogerthis Wrote:Anyways, t0mm0 did you get a chance to look at my vidxden code?

as i replied i tried to test it last night but couldn't get anything to stream from vidxden even in my browser. i don't have time today but i'll try again at the weekend.

iDude Wrote:I personally think that favorites should be handled by the addons separately. That's because many sites have a "favorites" section once you sign up. letmewatchthis.ch has this for example and it's quite useful because you can add whole TV shows to your favorites and they update themselves when a new episode comes out. This in combination with XBMC.MyLibrary and you have a SickBeard for streaming (Works with movies too)
yes i am planning on adding that functionality to letmewatchthis. i think this kind of thing is a different case, as you can add favourites from the website so there needs to be code in the addon to handle that.
iDude Wrote:I already modified t0mm0s addon so that instead of an a-z listing i get my favorite TV shows. Add a simple search filter for XBMC.MyLibrary and that's it. Now I can add tv shows on the road and don't need any servers running at home, don't need to download anything and everything just works automagically Laugh
This should also work with movies but I haven't tried it yet.
i hadn't seen XBMC.MyLibrary before - looks interesting.

if you've been working on the letmewatchthis code would you be interested in submitting patches? it's in a mess at the moment (it was literally written in a few mins as a way of testing urlresolver and t0mm0.common and thinking about how to make it better) but i plan on making it fully functional eventually.
iDude Wrote:But the more I think it about the more it seems that this is maybe a site specific feature and should be handled separately. I don't know. Maybe I'm just talking nonsense (been awake for the last 36 hours)

i think you're right (not about the talking nonsense bit Wink) that in this particular case that code belongs in the addon - i don't think there is an obvious way to generalise it?

thanks,

t0mm0.