Ejemplo n.º 1
0
def GetChannels():
    channels = sf.OpenJson(name="channels")
    list_of_channels = ""
    for channel in channels:
        list_of_channels = list_of_channels + str(channel) + "\n"

    return list_of_channels
Ejemplo n.º 2
0
def DeleteRule(ad):
    ads = sf.OpenJson(name="ads")
    if ad in ads:
        ads.pop(ad, None)
        sf.SaveJson(name="ads", data=ads)
        return True
    else:
        return False
Ejemplo n.º 3
0
def DeleteChannel(key):
    channels = sf.OpenJson(name="channels")

    if key in channels:
        channels.pop(key, None)
        sf.SaveJson(name="channels", data=channels)
        return True
    else:
        return False
Ejemplo n.º 4
0
def GetAdsRuleList():
    ads = sf.OpenJson(name="ads")
    if ads["enable"] == 0:
        list_of_channels = "*WARNING!\nAdBlock disabled*\n\n"
    else:
        list_of_channels = ""
    for ad in ads:
        if ad != "enable":
            list_of_channels = list_of_channels + str(ad) + "\n"

    return list_of_channels
Ejemplo n.º 5
0
def ChangeEnableAds(isEnbale):
    ads = sf.OpenJson(name="ads")

    if (isEnbale == None):
        if ads["enable"] == 1:
            ads["enable"] = 0
            ads_block_status = "disabled"
        else:
            ads["enable"] = 1
            ads_block_status = "enabled"
    else:
        if isEnbale == True:
            ads["enable"] = 1
            ads_block_status = "enabled"
        else:
            ads["enable"] = 0
            ads_block_status = "disabled"

    sf.SaveJson(name="ads", data=ads)

    return ads_block_status
Ejemplo n.º 6
0
def AddRuleToList(rule):
    ads = sf.OpenJson(name="ads")
    ads[rule] = 0
    sf.SaveJson(name="ads", data=ads)
Ejemplo n.º 7
0
def AddChannel(key):
    channels = sf.OpenJson(name="channels")
    channels[key] = 0
    sf.SaveJson(name="channels", data=channels)