mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-04 03:27:00 -05:00 
			
		
		
		
	Add a function to return the current library name
This commit is contained in:
		
							parent
							
								
									e961004b11
								
							
						
					
					
						commit
						d0ab0d6fce
					
				@ -61,4 +61,13 @@ def generate_test_db(library_path, # {{{
 | 
				
			|||||||
    print 'Time per record:', t/float(num_of_records)
 | 
					    print 'Time per record:', t/float(num_of_records)
 | 
				
			||||||
# }}}
 | 
					# }}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def current_library_name():
 | 
				
			||||||
 | 
					    from calibre.utils.config import prefs
 | 
				
			||||||
 | 
					    import posixpath
 | 
				
			||||||
 | 
					    path = prefs['library_path']
 | 
				
			||||||
 | 
					    if path:
 | 
				
			||||||
 | 
					        path = path.replace('\\', '/')
 | 
				
			||||||
 | 
					        while path.endswith('/'):
 | 
				
			||||||
 | 
					            path = path[:-1]
 | 
				
			||||||
 | 
					        return posixpath.basename(path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user