Пример #1
0
def addItem(item,path):
    if 'http' in path:
        control.infoDIalog('Cannot modify remote list.',heading='Castaway Lists')
        return

    
    f = open(path,'r')
    content = f.read()
    f.close()
    itemx = '''
    <item>
        <title>%s</title>
        <thumbnail>%s</thumbnail>
        <url>%s</url>
    </item>'''%(item[1],item[2],item[0])
    content += '%s'%itemx
    f = open(path,'w')
    f.write(content)
    f.close()
Пример #2
0
def addItem(item, path):
    if 'http' in path:
        control.infoDIalog('Cannot modify remote list.',
                           heading='Castaway Lists')
        return

    f = open(path, 'r')
    content = f.read()
    f.close()
    itemx = '''
    <item>
        <title>%s</title>
        <thumbnail>%s</thumbnail>
        <url>%s</url>
    </item>''' % (item[1], item[2], item[0])
    content += '%s' % itemx
    f = open(path, 'w')
    f.write(content)
    f.close()
Пример #3
0
def removeItem(item, path):
    if 'http' in path:
        control.infoDIalog('Cannot modify remote list.',heading='Castaway Lists')
        return

    items = getItems_extended(path)
    toReplace = False
    for it in items:
        i2 = (it[0],it[1],it[2])
        if i2 == item:
            toReplace = it[3]
            break

    if toReplace:
        f = open(path,'r')
        content = f.read()
        f.close()
        content = content.replace(toReplace,'')
        f = open(path,'w')
        f.write(content)
        f.close()
Пример #4
0
def removeItem(item, path):
    if 'http' in path:
        control.infoDIalog('Cannot modify remote list.',
                           heading='Castaway Lists')
        return

    items = getItems_extended(path)
    toReplace = False
    for it in items:
        i2 = (it[0], it[1], it[2])
        if i2 == item:
            toReplace = it[3]
            break

    if toReplace:
        f = open(path, 'r')
        content = f.read()
        f.close()
        content = content.replace(toReplace, '')
        f = open(path, 'w')
        f.write(content)
        f.close()