Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

Commit

Permalink
update gif & fix clear line
Browse files Browse the repository at this point in the history
  • Loading branch information
Redcxx committed Aug 14, 2019
1 parent 565cda7 commit bac31fe
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 10 deletions.
4 changes: 0 additions & 4 deletions build/lib/pikax/api/androidclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# for explaining https://oauth.secure.pixiv.net/auth/token
#

#
# NOTE XXX This api is developing and not used by pikax yet
#


import datetime
import time
Expand Down
2 changes: 1 addition & 1 deletion build/lib/pikax/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"""
String to clear previous stdout line
"""
CLEAR_LINE = '\b' * 300
CLEAR_LINE = '\r' + ' ' * 150 + '\r'

"""
Indicate a failure when there's too much exceptions occurred during requesting in the same loop
Expand Down
8 changes: 8 additions & 0 deletions build/lib/pikax/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ def __init__(self):
self.last_percent_print_time = None
self.est_time_lefts = [0, 0, 0, 0, 0]
self.start_time = None
self.last_printed_line = None

def print_progress(self, curr, total, msg=None):
curr_percent = math.floor(curr / total * 100)
Expand Down Expand Up @@ -300,7 +301,13 @@ def print_progress(self, curr, total, msg=None):
if msg:
progress_text = progress_text + ' | ' + str(msg)

if self.last_printed_line:
spaces = len(self.last_printed_line)
else:
spaces = 1

log(progress_text, end='', start=settings.CLEAR_LINE, inform=True)
self.last_printed_line = progress_text

def print_done(self, msg=None):
if msg:
Expand All @@ -315,6 +322,7 @@ def print_done(self, msg=None):
self.last_percent = None
self.last_percent_print_time = None
self.last_percent_time_left = None
self.last_printed_line = None
self.est_time_lefts = [0, 0, 0]


Expand Down
Binary file modified demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/pikax-2.0.7-py3-none-any.whl
Binary file not shown.
Binary file modified dist/pikax-2.0.7.tar.gz
Binary file not shown.
Binary file added dist/pikax-2.0.8-py3-none-any.whl
Binary file not shown.
Binary file added dist/pikax-2.0.8.tar.gz
Binary file not shown.
Binary file added dist/pikax-2.0.9-py3-none-any.whl
Binary file not shown.
Binary file added dist/pikax-2.0.9.tar.gz
Binary file not shown.
6 changes: 3 additions & 3 deletions pikax.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pikax
Version: 2.0.7
Version: 2.0.9
Summary: A Pixiv Mass Downloading Tool
Home-page: https://github.com/Redcxx/Pikax
Author: Redcxx
Expand Down Expand Up @@ -39,9 +39,9 @@ Description: # Pikax:unicorn:
- 。。。
- 有人再做吧,我自己够用了owo
## 试用 [demo.py](https://github.com/Redcxx/Pixiv-Crawler/blob/master/demo.py)
#### 下载当日排行榜前20的插画
#### 下载当日排行榜前50的插画
````
from pikax.pikax import Pikax, params
from pikax.pikax import Pikax

pixiv = Pikax()
results = pixiv.rank(limit=50)
Expand Down
2 changes: 1 addition & 1 deletion pikax/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"""
String to clear previous stdout line
"""
CLEAR_LINE = '\b' * 300
CLEAR_LINE = '\r' + ' ' * 150 + '\r'

"""
Indicate a failure when there's too much exceptions occurred during requesting in the same loop
Expand Down
8 changes: 8 additions & 0 deletions pikax/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ def __init__(self):
self.last_percent_print_time = None
self.est_time_lefts = [0, 0, 0, 0, 0]
self.start_time = None
self.last_printed_line = None

def print_progress(self, curr, total, msg=None):
curr_percent = math.floor(curr / total * 100)
Expand Down Expand Up @@ -300,7 +301,13 @@ def print_progress(self, curr, total, msg=None):
if msg:
progress_text = progress_text + ' | ' + str(msg)

if self.last_printed_line:
spaces = len(self.last_printed_line)
else:
spaces = 1

log(progress_text, end='', start=settings.CLEAR_LINE, inform=True)
self.last_printed_line = progress_text

def print_done(self, msg=None):
if msg:
Expand All @@ -315,6 +322,7 @@ def print_done(self, msg=None):
self.last_percent = None
self.last_percent_print_time = None
self.last_percent_time_left = None
self.last_printed_line = None
self.est_time_lefts = [0, 0, 0]


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="pikax",
version="2.0.7",
version="2.0.9",
author="Redcxx",
author_email="[email protected]",
description="A Pixiv Mass Downloading Tool",
Expand Down

0 comments on commit bac31fe

Please sign in to comment.