コード例 #1
0
ファイル: addons.py プロジェクト: nusch/modules4all
def Addon_Genre(genre='adult'):
    """
[COLOR=gold]PREMIUM FEATURE FOR ADDONS EXCLUSIVELY SUPPORTED AT NOOBSANDNERDS[/COLOR]
If you'd like to hook into this please take a look at the README.

Return a dictionary of add-ons which match a specific genre.

CODE: Addon_Genre([genre])

AVAILABLE PARAMS:
    
    genre  -  By default this is set to 'adult' which will return
    a dictionary of all known adult add-ons. For a full list of all
    the available genres you can filter by take a look at the Add-on Portal
    link below. If you click on each of the genre links then look at the
    url you'll be able to see the name to use. For example if you click on
    "Dev Tools" you'll see the url shows as 'devtools' and that's what you'd
    send through to this function if you only wanted those to show.
    http://noobsandnerds.com/addons/category/genres/

EXAMPLE CODE:
space_addons = koding.Addon_Genre(genre='space')
if space_addons:
    my_return = 'LIST OF AVAILABLE SPACE BASED ADD-ONS:\n\n'

# Convert the dictionary into a list:
    space_addons = space_addons.items()
    for item in space_addons:
        my_return += '[COLOR=gold]Name:[/COLOR] %s   |   [COLOR=dodgerblue]ID:[/COLOR] %s\n' % (item[0],item[1])
    koding.Text_Box('SPACE ADD-ONS',my_return)
~"""
    import binascii
    from __init__ import Main
    from filetools import Text_File
    from systemtools import Timestamp

    xbmc.log('ADDON GENRE: %s' % genre)
    dialog = xbmcgui.Dialog()
    local_path = binascii.hexlify(genre)
    final_path = xbmc.translatePath(
        'special://profile/addon_data/script.module.python.koding.aio/cookies/%s'
        % local_path)
    if os.path.exists(final_path):
        modified = os.path.getmtime(final_path)
        old = int(modified)
        now = int(Timestamp('epoch'))
        # Add a 24hr wait so we don't kill server
        if now > (modified + 86400):
            Main('addon_list|g:%s' % genre)

# Create new file if it doesn't exist
    else:
        Main('addon_list|g:%s' % genre)

    try:
        addon_list = eval(binascii.unhexlify(Text_File(final_path, 'r')))
        return addon_list
    except:
        return False
コード例 #2
0
ファイル: __main__.py プロジェクト: maximstewart/GWinWrap
from __init__ import Main, gtk

if __name__ == "__main__":
    try:
        main = Main()
        gtk.main()
    except Exception as e:
        print(e)
コード例 #3
0
def Addon_Genre(genre='adult', custom_url=''):
    """
[COLOR=gold]PREMIUM FEATURE FOR ADDONS EXCLUSIVELY SUPPORTED AT NOOBSANDNERDS[/COLOR]
If you'd like to hook into this please take a look at the README.

Please Note: Although this hooks into the NaN framework to pull genres you can use this without
having to hook into their framework if you have a custom url which returns results in the same format.
Your url must return a dictionary of items in this format: {"addon_name":"addon_id","addon_name_2":"addon_id_2"}

Return a dictionary of add-ons which match a specific genre.

CODE: Addon_Genre([genre, custom_url])

AVAILABLE PARAMS:
    
    genre  -  By default this is set to 'adult' which will return
    a dictionary of all known adult add-ons. For a full list of all
    the available genres you can filter by take a look at the Add-on Portal
    link below. If you click on each of the genre links then look at the
    url you'll be able to see the name to use. For example if you click on
    "Dev Tools" you'll see the url shows as 'devtools' and that's what you'd
    send through to this function if you only wanted those to show.
    http://noobsandnerds.com/addons/category/genres/

    custom_url  -  If you have your own custom url which returns genres
    you can enter it here and use that rather than rely on NaN categorisation.

EXAMPLE CODE:
space_addons = koding.Addon_Genre(genre='space')
if space_addons:
    my_return = 'LIST OF AVAILABLE SPACE BASED ADD-ONS:\n\n'

# Convert the dictionary into a list:
    space_addons = space_addons.items()
    for item in space_addons:
        my_return += '[COLOR=gold]Name:[/COLOR] %s   |   [COLOR=dodgerblue]ID:[/COLOR] %s\n' % (item[0],item[1])
    koding.Text_Box('SPACE ADD-ONS',my_return)
~"""
    import binascii
    from __init__ import Main
    from filetools import Text_File
    from systemtools import Timestamp
    from web import Open_URL

    local_path = binascii.hexlify(genre)
    cookie_path = xbmc.translatePath(
        "special://profile/addon_data/script.module.python.koding.aio/cookies/"
    )
    final_path = os.path.join(cookie_path, local_path)
    if not os.path.exists(cookie_path):
        os.makedirs(cookie_path)

    if os.path.exists(final_path):
        modified = os.path.getmtime(final_path)
        old = int(modified)
        now = int(Timestamp('epoch'))
        # Add a 24hr wait so we don't kill server
        if now > (modified + 86400):
            if custom_url == '':
                Main('addon_list|g:%s' % genre)
            else:
                addon_list = Open_URL(custom_url)
                try:
                    addon_list = eval(addon_list)
                    Text_File(final_path, "w",
                              binascii.hexlify(str(addon_list)))
                except:
                    pass

# Create new file if it doesn't exist
    else:
        if custom_url == '':
            Main('addon_list|g:%s' % genre)
        else:
            addon_list = Open_URL(custom_url)
            try:
                addon_list = eval(addon_list)
                Text_File(final_path, "w", binascii.hexlify(str(addon_list)))
            except:
                pass

    if os.path.exists(final_path):
        try:
            addon_list = eval(binascii.unhexlify(Text_File(final_path, 'r')))
            return addon_list
        except:
            return False
    else:
        return False
コード例 #4
0
#!/usr/bin/env python
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMessageBox, QApplication,QMainWindow
import sys
from UI_JM import Ui_MainWindow
import getpass
import os
import xlrd
from xlrd import open_workbook
import subprocess
import threading
import time
import xlutils.copy
import sqlite3
import SQL


from pycallgraph import PyCallGraph
from pycallgraph.output import GraphvizOutput

from __init__ import Main


graphviz = GraphvizOutput(output_file='filter_none.png')

with PyCallGraph(output=graphviz):
    app = QApplication(sys.argv)
    window = Main()
    window.show()
    sys.exit(app.exec_())
コード例 #5
0
from setproctitle import setproctitle

# Gtk imports
import gi, faulthandler, signal
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository import GLib

# Application imports
from __init__ import Main

if __name__ == "__main__":
    try:
        setproctitle('<replace this>')
        GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT,
                             gtk.main_quit)
        faulthandler.enable()  # For better debug info
        parser = argparse.ArgumentParser()
        # Add long and short arguments
        parser.add_argument("--file",
                            "-f",
                            default="default",
                            help="JUST SOME FILE ARG.")

        # Read arguments (If any...)
        args = parser.parse_args()
        main = Main(args)
        gtk.main()
    except Exception as e:
        print(repr(e))
コード例 #6
0
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

# Application imports
from __init__ import Main

if __name__ == "__main__":
    try:
        # import web_pdb
        # web_pdb.set_trace()

        setproctitle('GWinWrap')
        faulthandler.enable()  # For better debug info
        parser = argparse.ArgumentParser()
        # Add long and short arguments
        parser.add_argument("--file",
                            "-f",
                            default="default",
                            help="JUST SOME FILE ARG.")

        # Read arguments (If any...)
        args, unknownargs = parser.parse_known_args()

        Main(args, unknownargs)
        Gtk.main()
    except Exception as e:
        traceback.print_exc()
        quit()
コード例 #7
0
ファイル: addons.py プロジェクト: nusch/modules4all
def Addon_Install(addon_id, confirm=True, silent=0, repo_install=1):
    """
[COLOR=gold]PREMIUM FEATURE FOR ADDONS EXCLUSIVELY SUPPORTED AT NOOBSANDNERDS[/COLOR]
If you'd like to hook into this please take a look at the README.

Install an add-on and all dependencies matching the version of Kodi
you're currently running. If the add-on install takes a while to kick
in (spinning wheel) it just means that particular add-on hasn't yet
been cached in the db, the next time someone hits that add-on it will be instant.

CODE: Addon_Install(addon_id, [confirm, silent, repo_install])

AVAILABLE PARAMS:
    
    addon_id  -  This is the add-on id you want to install.
    The Add-on Portal will be scanned for an add-on and all the
    dependencies will also be scanned. A list of possible download
    locations are then populated server side and the best ones which
    match your needs are installed (matching dependencies with your
    current running version of Kodi to make sure bad modules aren't
    installed).

    confirm  -  By default this is set to True which means the user
    will get a choice of whether to install the add-on or not. Set to
    false if you want to force this add-on without any dialogs.

    silent  -  By default this is set to False which means there will
    always be a dialog appear showing the install process. Set this to
    True if you'd prefer to silently auto install the content.
        
    repo_install  -  This will allow you to automatically install the
    relevant repo, offer to install the repo or do not install the repo.
    See the available values below.
    
    The team at NaN take great care to try and make sure the relevant
    add-ons are matched against the official developers repo and the
    daily script which scans repositories also does a lot of clever
    assignment processes. However due to the sheer amount of
    "developers" re-uploading others content there's always a chance
    an add-on may get marked up against the wrong repo. If you notice
    an add-on is marked against the wrong repo please consider updating
    the details via the Add-on Portal (EDIT ADDON button) or notifying
    a member of the team at the nooobsandnerds forum and they can
    manually get it rectified. Thank you.

    AVAILABLE VALUES:

        0 - This will not install the repo the add-on was found on.

        1 - This will automatically install the repo the add-on is found on.
        If you don't send through a value this will be used as the default.
        
        2 - This will ask user if they want to install the repo the add-on was found on.

EXAMPLE CODE:
dialog.ok('INSTALL NAN TUTORIALS','We will now attempt to install NaN Tutorials add-on.')
if os.path.exists(xbmc.translatePath('special://home/addons/plugin.video.nantus')):
    dialog.ok('ALREADY INSTALLED','We cannot install NaN Tutorials as it\'s already installed!')
else:
    koding.Addon_Install(addon_id='plugin.video.nantuts',confirm=True,silent=0,repo_install=1)
~"""
    from __init__ import Main
    if silent == True:
        silent = 1
    elif silent == False:
        silent = 0

    if confirm == True:
        confirm = 2
    else:
        confirm = 0

    kodi_version = str(xbmc.getInfoLabel("System.BuildVersion")[:2])
    Main('addoninstall|id:%s~version:%s~repo:%s~silent:%s~installtype:%s' %
         (addon_id, kodi_version, repo_install, silent, confirm))