Posts: 2,710
Joined: Feb 2009
Reputation:
12
ppic
Skilled Python Coder
Posts: 2,710
isn't setResolvedUrl function doing that?
Posts: 347
Joined: Jul 2007
Reputation:
4
Wow, that was fast. Let's see what we need.
I suggest the following methods:
individual host-specific modules:
- function to check if a URL is a valid link for that file host (or filter a list of URLs)
- function to check if valid URLs are still up (filter array of URLs)
- function to generate link for video streaming from a given URL of that file host
- function or regular expression to filter out links from an HTML page source
- function to check if login details are supplied and if they are valid
- function to check if login is premium/is sufficient for streaming content with XBMC
- function to login with these details if necessary
general link resolver module:
- function to find out what submodule this link belongs to (hotfile, megaup, etc.)
- function to parse an HTML page for links of any known filehost that allows for streaming (valid account), direct resolving of URLs as an optional flag
- function to parse an HTML page for links of a specific file host, direct resolving optional
- function to log in to all/one specific file host
- function to check which file hosts are available for streaming
- function to resolve a link or a list of links to streamable URLs
the methods to resolve or filter URLs should also have the ability to return file names as they are not always contained in the unresolves URLs.
This is not a complete list, just a few thoughts on how things might work. Please let me know what you think!
Posts: 347
Joined: Jul 2007
Reputation:
4
Thanks for the feedback. I never used git before, mostly used svn because I've been too lazy to learn another version control thing. Anyway, my github username is unbehagen. I can't promise to submit a lot of code as I'm periodically quite busy with my dissertation and just do this for productive procrastination.
A few thoughts about the design:
Maybe the modules should provide simple methods like "resolve this url and give me a URL as a string " and complex methods that provide an icon (if available, logo of filehost otherwise), the resolved URL and the filename and possibly other meta information as a playlist item directly?
Posts: 275
Joined: Jul 2010
Reputation:
5
i actually learned how to use git before svn, weird or what. i'll add you to the repo.
its actually a bit easier, but its very similiar.
yeah, i won't be working on it much either as i have essays/exams over the next months.
but it shouldnt be that complicated to code.
in megaroutines i return the data as a tuple (or is it a list? i'm not sure of the exact name)
but it works as so:
if videolink = the_returned_data
videolink[0] is the resolved url
videolink[1] is something else
and so on....
i think this is better than two separate methods, which gives us more work.
Posts: 347
Joined: Jul 2007
Reputation:
4
Well, as it is an interface, it should probably raise exceptions instead of returning data. I wrote it this way to make it more understandable what the functions actually do.
Posts: 275
Joined: Jul 2010
Reputation:
5
well i like it so far, your code is neat and understandable.
if we get the interface really solid, and add support for a few video hosts, we can then make sure it's easy for addon devs to add support for more videohosts, to ensure it grows.
i added a path class + function that should be universally used by all sub modules in videoresolver, when storing cookies and other bits of data.
Posts: 275
Joined: Jul 2010
Reputation:
5
@unbehagan
i'm calling the general all-purpose resolver .py the 'master handler'
and the specific file hoster .py the 'specific handler'
if you can think up better names let me know!
my idea is to standardise the general structure of the specific handlers
so they can be used interchangeably from the master handler
this could be done by adding a standardised 'controller' class (my term, means nothing special in python) to each one...
this class would have a function for login, another for resolve etc
...making it easy to backport the various login and resolving functions people have written, by calling them from the functions in the 'controller' class, so we can leave their code untouched and not get bored to death rewriting them all.
this would also mean that if people only want to deal with only one specific handler, they don't have to use the master handler.
hope that makes sense, i'm sure i wouldn't understand myself either.