def __init__(self, addon_name, params):
        """

        :param str addon_name:  The name of the add-on
        :param str params:      The parameteters used to start the ParameterParser

        """

        Logger.debug("Parsing parameters from: %s", params)

        # Url Keywords
        self.keywordPickle = "pickle"  # : Used for the pickle item
        self.keywordAction = "action"  # : Used for specifying the action
        self.keywordChannel = "channel"  # : Used for the channel
        self.keywordChannelCode = "channelcode"  # : Used for the channelcode
        self.keywordCategory = "category"  # : Used for the category
        self.keywordRandomLive = "rnd"  # : Used for randomizing live items
        self.keywordSettingId = "settingid"  # : Used for setting an encrypted setting
        self.keywordSettingActionId = "settingactionid"  # : Used for passing the actionid for the encryption
        self.keywordSettingName = "settingname"  # : Used for setting an encrypted settings display name
        self.keywordSettingTabFocus = "tabfocus"  # : Used for setting the tabcontrol to focus after changing a setting
        self.keywordSettingSettingFocus = "settingfocus"  # : Used for setting the setting control to focus after changing a setting
        self.keywordLanguage = "lang"  # : Used for the 2 char language information
        self.keywordProxy = "proxy"  # : Used so set the proxy index
        self.keywordLocalIP = "localip"  # : Used to set the local ip index

        # Url Actions
        self.actionFavourites = "favourites"  # : Used to show favorites for a channel
        self.actionAllFavourites = "allfavourites"  # : Used to show all favorites
        self.actionRemoveFavourite = "removefromfavourites"  # : Used to remove items from favorites
        self.actionAddFavourite = "addtofavourites"  # : Used to add items to favorites
        self.actionDownloadVideo = "downloadVideo"  # : Used to download a video item
        self.actionPlayVideo = "playvideo"  # : Used to play a video item
        self.actionUpdateChannels = "updatechannels"  # : Used to update channels
        self.actionListFolder = "listfolder"  # : Used to list a folder
        self.actionListCategory = "listcategory"  # : Used to show the channels from a category
        self.actionConfigureChannel = "configurechannel"  # : Used to configure a channel
        self.actionSetEncryptionPin = "changepin"  # : Used for setting an application pin
        self.actionSetEncryptedValue = "encryptsetting"  # : Used for setting an application pin
        self.actionResetVault = "resetvault"  # : Used for resetting the vault
        self.actionPostLog = "postlog"  # : Used for sending log files to pastebin.com
        self.actionProxy = "setproxy"  # : Used for setting a proxy

        self.propertyRetrospect = "Retrospect"
        self.propertyRetrospectChannel = "RetrospectChannel"
        self.propertyRetrospectChannelSetting = "RetrospectChannelSettings"
        self.propertyRetrospectFolder = "RetrospectFolder"
        self.propertyRetrospectVideo = "RetrospectVideo"
        self.propertyRetrospectCloaked = "RetrospectCloaked"
        self.propertyRetrospectCategory = "RetrospectCategory"
        self.propertyRetrospectFavorite = "RetrospectFavorite"
        self.propertyRetrospectAdaptive = "RetrospectAdaptive"

        # determine the query parameters
        self.params = self.__get_parameters(params)
        self.pluginName = addon_name

        # We need a picker for this instance
        self._pickler = Pickler()
    def __init__(self, path):
        """ Initializes a Favourites class that can be use to show, add and delete favourites.

        :param str path: The path to store the favourites file

        """

        self.__filePattern = "%s-%s.xotfav"
        self.__pickler = Pickler()

        self.FavouriteFolder = path
예제 #3
0
    def make_pickle(self):
        pickle = Pickler()
        try:
            assert len(self._dict_of_everything.keys()) > 0
            pickle.serialise(self._dict_of_everything)
            with open('result.json', 'w', encoding='utf8') as json_file:
                json.dump(self._dict_of_everything, json_file)

        except FileNotFoundError as e:
            print(e)
        except AssertionError:
            print(
                'Dictionary is empty, try loading then extracting data first')
예제 #4
0
def encode(value, **kwargs):
    """Returns a JSON formatted representation of value, a Python object.
    
    Optionally takes a keyword argument unpicklable.  If set to False,
    the output does not contain the information necessary to turn 
    the json back into Python.
    
    >>> encode('my string')
    '"my string"'
    >>> encode(36)
    '36'
    """
    j = Pickler(unpicklable=__isunpicklable(kwargs))
    return json.encode(j.flatten(value),
                       False)  #, False)  # JL - don't convert to ASCII.
예제 #5
0
 def do_delete_pickle(self, arg):
     my_pickler = Pickler()
     my_pickler.delete_pickle(arg)
예제 #6
0
 def setUp(self):
     self.pickler = Pickler()