Browse Source

support progressbar2

Arnau Sanchez 9 years ago
parent
commit
9544cf9cca
1 changed files with 5 additions and 2 deletions
  1. 5 2
      youtube_upload/main.py

+ 5 - 2
youtube_upload/main.py

@@ -73,7 +73,10 @@ def get_progress_info():
         bar = progressbar.ProgressBar(widgets=widgets)
         def _callback(total_size, completed):
             if not hasattr(bar, "next_update"):
-                bar.maxval = total_size
+                if hasattr(bar, "maxval"):
+                    bar.maxval = total_size
+                else:
+                    bar.max_value = total_size
                 bar.start()
             bar.update(completed)
         def _finish():
@@ -81,7 +84,7 @@ def get_progress_info():
                 return bar.finish()
         return progressinfo(callback=_callback, finish=_finish)
     else:
-        return progressinfo(callback=None, finish=lambda: True)
+        return progressinfo(callback=lambda: None, finish=lambda: True)
 
 def get_category_id(category):
     """Return category ID from its name."""