]> git.phdru.name Git - m_librarian.git/commitdiff
Fix(download:format): Fix compile_format
authorOleg Broytman <phd@phdru.name>
Sun, 10 Jun 2018 23:22:21 +0000 (02:22 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 10 Jun 2018 23:31:08 +0000 (02:31 +0300)
m_librarian/download.py

index 6304658062b79bf2ef68a3550c2981d44eb094e2..f1a41c76d40243908f8f975557696d246f902b1a 100755 (executable)
@@ -17,11 +17,12 @@ compiled_format = '%(file)s'
 
 def _compile_format():
     global format, compile_format, compiled_format
-    if compile_format:
-        compile_format = False
-        format = get_config().get('download', 'format')
-        if not format:
-            return
+    if not compile_format:
+        return
+    compile_format = False
+    format = get_config().get('download', 'format')
+    if not format:
+        return
     got_percent = False
     compiled = []
     for c in format:
@@ -72,8 +73,8 @@ def download(book, dest_path=None, lib_path=None, a_format=None):
 
     global format, compile_format, compiled_format
     if a_format:
-        format = a_format
         compile_format = True
+        format = a_format
     _compile_format()
     if compiled_format[-1] in ('\0', '\\', '/'):
         raise ValueError('Bad format: "%s"' % compiled_format)