1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

a little lint

This commit is contained in:
Tim Moody 2019-12-03 11:55:58 -05:00
parent ae4e17ef1b
commit 56966022a8

View file

@ -2,18 +2,11 @@
# common functions for IIAB
# Admin Console functions are in adm_lib.py
import os, sys, syslog
import pwd, grp
import time
from datetime import date, datetime
import os
import json
import yaml
import re
import subprocess
import shlex
import configparser
import xml.etree.ElementTree as ET
import argparse
import iiab.iiab_const as CONST
lang_codes = {}
@ -67,18 +60,18 @@ def read_library_xml(lib_xml_file, kiwix_exclude_attr=[""]): # duplicated from i
attributes = {}
if 'id' not in child.attrib: # is this necessary? implies there are records with no book id which would break index for removal
print("xml record missing Book Id")
id = child.attrib['id']
zim_id = child.attrib['id']
for attr in child.attrib:
if attr not in kiwix_exclude_attr:
attributes[attr] = child.attrib[attr] # copy if not id or in exclusion list
zims_installed[id] = attributes
path_to_id_map[child.attrib['path']] = id
zims_installed[zim_id] = attributes
path_to_id_map[child.attrib['path']] = zim_id
except IOError:
zims_installed = {}
return zims_installed, path_to_id_map
def rem_libr_xml(id, kiwix_library_xml):
command = CONST.kiwix_manage + " " + kiwix_library_xml + " remove " + id
def rem_libr_xml(zim_id, kiwix_library_xml):
command = CONST.kiwix_manage + " " + kiwix_library_xml + " remove " + zim_id
#print command
args = shlex.split(command)
try: