mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	handle missing or empty library.xml
This commit is contained in:
		
							parent
							
								
									4307f65942
								
							
						
					
					
						commit
						66138941e9
					
				
					 2 changed files with 11 additions and 4 deletions
				
			
		| 
						 | 
					@ -19,10 +19,16 @@ if flock -n -e 200; then :
 | 
				
			||||||
  # write to {{ kiwix_library_xml }}.tmp to minimize kiwix down
 | 
					  # write to {{ kiwix_library_xml }}.tmp to minimize kiwix down
 | 
				
			||||||
  # zim map could be out of sync for a few seconds
 | 
					  # zim map could be out of sync for a few seconds
 | 
				
			||||||
  # using new version that does deltas
 | 
					  # using new version that does deltas
 | 
				
			||||||
 | 
					  if [ -f $KIWIXLIB ]; then
 | 
				
			||||||
    cp $KIWIXLIB $KIWIXLIB.tmp
 | 
					    cp $KIWIXLIB $KIWIXLIB.tmp
 | 
				
			||||||
    /usr/bin/iiab-make-kiwix-lib.py
 | 
					    /usr/bin/iiab-make-kiwix-lib.py
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    /usr/bin/iiab-make-kiwix-lib.py -f # force rebuild of library.xml
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
  {{ systemctl_program }} stop kiwix-serve
 | 
					  {{ systemctl_program }} stop kiwix-serve
 | 
				
			||||||
 | 
					  if [ -f $KIWIXLIB ]; then
 | 
				
			||||||
    rm $KIWIXLIB
 | 
					    rm $KIWIXLIB
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
  mv $KIWIXLIB.tmp $KIWIXLIB
 | 
					  mv $KIWIXLIB.tmp $KIWIXLIB
 | 
				
			||||||
  {{ systemctl_program }} start kiwix-serve
 | 
					  {{ systemctl_program }} start kiwix-serve
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,8 +85,9 @@ def read_library_xml(lib_xml_file, kiwix_exclude_attr=["favicon"]): # duplicated
 | 
				
			||||||
                    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[zim_id] = attributes
 | 
					            zims_installed[zim_id] = attributes
 | 
				
			||||||
            path_to_id_map[child.attrib['path']] = zim_id
 | 
					            path_to_id_map[child.attrib['path']] = zim_id
 | 
				
			||||||
    except IOError:
 | 
					    except: # though I try how can I carry on
 | 
				
			||||||
        zims_installed = {}
 | 
					        zims_installed = {}
 | 
				
			||||||
 | 
					        path_to_id_map = {}
 | 
				
			||||||
    return zims_installed, path_to_id_map
 | 
					    return zims_installed, path_to_id_map
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def rem_libr_xml(zim_id, kiwix_library_xml):
 | 
					def rem_libr_xml(zim_id, kiwix_library_xml):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue