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