Kodi Community Forum
[RELEASE] module.ghub - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=151)
+---- Thread: [RELEASE] module.ghub (/showthread.php?tid=307630)



[RELEASE] module.ghub - boogiepop - 2017-02-20

Hi This module is a small but a very powerfull one. It loads a github repository to your sys.path in runtime, and updates it whenever there is a new release.
Hope you find it usefull. I generally use it to load latest version of youtube-dl.

You can view the code from, https://github.com/hbiyik/script.module.ghub or download the zipball https://raw.githubusercontent.com/hbiyik/dataserver/master/script.module.ghub/script.module.ghub-0.0.1.zip ,

Your comments are wellcome.

def load(uname, rname, branch, commit=None, path=[], period=24)

Loads, caches, and arranges paths for a repo from github. github repo is downlaoded and extracted to userdata/addon_data/scirpt.module.gub/uname/package/branch/commit It also updates the package automatically in a given period (24h default) Note that this is not a package manager and does not do any dependency check

Example:

PHP Code:
import ghub

ghub
.load("hbiyik""script.module.boogie""master"None, ["lib"])

#now you can safely import this module
import boogie 

Quote:Params:

uname github username
rname repository name
branch github branch (ie master), if this parameter is None, latest tagged version is used.
commit [optional,None] commit of the specified branch, if None is specified latest commit is fetched, if brach is None, this parameter is dismissed
path [optional,[]] list of directories pointing to the root directory of source ie, if source is in lib/src folder path should be ["lib", "src"]
Returns: None

Below is an example how to import youtube-dl in runtime with the latest commit from master, and updated in each 24 hours whenever there is a new commit

PHP Code:
import ghub
import sys
import datetime
import time

# fix for sys.stderr.isatty() is not implemented in kodi python interpreter
def proxyisatty():
    return 
False


#fix for datatetime.strptime returns None
class proxydt(datetime.datetime):
    
def __init__(self, *args, **kwargs):
        
super(proxydtself).__init__(*args, **kwargs)

    @
staticmethod
    def strptime
(date_stringformat):
        return 
datetime.datetime(*(time.strptime(date_stringformat)[0:6]))

sys.stderr.isatty proxyisatty
datetime
.datetime proxydt
ghub
.load("rg3""youtube-dl""master")
#thats it now, you have youtube-dl with the latest commit from master :)
import youtube_dl 



RE: [RELEASE] module.ghub - mujunk - 2017-04-18

Some help with instructions for how to do this for youtube-dl would help.
Noob this end Smile


This forum uses Lukasz Tkacz MyBB addons.