Skip to content

Commit

Permalink
优化进程下载逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
KilluaaaCHEN committed Apr 7, 2017
1 parent 0d804fc commit b9bf927
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 65 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Created by .ignore support plugin (hsz.mobi)
.idea
tmp/
.DS_Store
2 changes: 1 addition & 1 deletion DownloadAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function down($start = 1)

$is_cs = false;//是否重试

for ($i = $start; ; $i++) {
for ($i = $start; $i < $start + 50; $i++) {
$content = $this->get($url . $i);
preg_match_all('/data-original\=\"\/\/([\s\S]*?)\"/', $content, $img_list);
if (count($img_list[1]) < 10) {
Expand Down
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
# 斗图神器

### [下载斗图神器](斗图神器.alfredworkflow)
## 下载

### 第一次检索的关键字只会显示第一页预览,搜过的关键字图片会自动缓存
[下载斗图神器](斗图神器.alfredworkflow)

### 检索关键字: `dt`
## 检索

### 下载所有图片关键字: `dadt` ,近20个进程同时下载
检索关键字: `dt`

### 查看已下载图片数:`ls ~/Pictures/.DouTu | wc -w`
检索快捷键:`Option+Shift+D`

### 图片默认保存在`~/Pictures/.DouTu/`下面
下载所有图片关键字: `dadt` ,近20个进程同时下载

### 不要了可以直接删掉`rm -rf ~/Pictures/.DouTu`
> 第一次检索的关键字只会显示第一页预览,搜过的关键字图片会自动缓
### 想修改图片保存路径可以修改`config.php`文件
## 查阅

查看已下载图片数:`ls ~/Pictures/.DouTu | wc -w`

## 配置

图片默认保存在`~/Pictures/.DouTu/`下面,不要了可以直接删掉`rm -rf ~/Pictures/.DouTu`

想修改图片保存路径可以修改`config.php`文件

## 效果图

![效果图](preview.gif)

1 change: 0 additions & 1 deletion cache.txt

This file was deleted.

110 changes: 55 additions & 55 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -132,37 +132,6 @@
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>action</key>
<integer>0</integer>
<key>argument</key>
<integer>0</integer>
<key>focusedappvariable</key>
<false/>
<key>focusedappvariablename</key>
<string></string>
<key>hotkey</key>
<integer>2</integer>
<key>hotmod</key>
<integer>655360</integer>
<key>hotstring</key>
<string>D</string>
<key>leftcursor</key>
<false/>
<key>modsmode</key>
<integer>0</integer>
<key>relatedAppsMode</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.trigger.hotkey</string>
<key>uid</key>
<string>B2766B5C-9C5D-4BE4-A748-35C43FCD5C7C</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand Down Expand Up @@ -207,12 +176,35 @@
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>action</key>
<integer>0</integer>
<key>argument</key>
<integer>0</integer>
<key>focusedappvariable</key>
<false/>
<key>focusedappvariablename</key>
<string></string>
<key>hotkey</key>
<integer>2</integer>
<key>hotmod</key>
<integer>655360</integer>
<key>hotstring</key>
<string>D</string>
<key>leftcursor</key>
<false/>
<key>modsmode</key>
<integer>0</integer>
<key>relatedAppsMode</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.revealfile</string>
<string>alfred.workflow.trigger.hotkey</string>
<key>uid</key>
<string>73C71487-6079-42CA-831B-3E959C6BAE2F</string>
<string>B2766B5C-9C5D-4BE4-A748-35C43FCD5C7C</string>
<key>version</key>
<integer>1</integer>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
Expand Down Expand Up @@ -260,6 +252,14 @@
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>type</key>
<string>alfred.workflow.action.revealfile</string>
<key>uid</key>
<string>73C71487-6079-42CA-831B-3E959C6BAE2F</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand All @@ -283,27 +283,6 @@
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>2</integer>
<key>keyword</key>
<string>dadt</string>
<key>subtext</key>
<string>可能需要一段时间...5万多张</string>
<key>text</key>
<string>下载所有图图片-斗图神器</string>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>03F0F61A-BDC4-4F63-8F6E-DFF5E4D5396A</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand Down Expand Up @@ -347,6 +326,27 @@ php DownloadAll.php 1000&amp;</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>2</integer>
<key>keyword</key>
<string>dadt</string>
<key>subtext</key>
<string>可能需要一段时间......</string>
<key>text</key>
<string>下载所有图图片-斗图神器</string>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>03F0F61A-BDC4-4F63-8F6E-DFF5E4D5396A</string>
<key>version</key>
<integer>1</integer>
</dict>
</array>
<key>readme</key>
<string>Keywords are one of Alfred's most commonly used and most useful ways of launching actions. Set a keyword and connect it to the action(s) you want to perform.
Expand Down
Binary file modified 斗图神器.alfredworkflow
Binary file not shown.

0 comments on commit b9bf927

Please sign in to comment.