Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cli-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8316,7 +8316,8 @@
"index",
"title",
"status",
"size"
"size",
"path"
],
"type": "js",
"modulePath": "douban/download.js",
Expand Down
3 changes: 2 additions & 1 deletion clis/douban/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cli({
{ name: 'photo-id', help: '只下载指定 photo_id 的图片' },
{ name: 'output', default: './douban-downloads', help: '输出目录' },
],
columns: ['index', 'title', 'status', 'size'],
columns: ['index', 'title', 'status', 'size', 'path'],
func: async (page, kwargs) => {
const subjectId = normalizeDoubanSubjectId(String(kwargs.id || ''));
const output = String(kwargs.output || './douban-downloads');
Expand Down Expand Up @@ -61,6 +61,7 @@ cli({
detail_url: photo.detailUrl,
status: result.success ? 'success' : 'failed',
size: result.success ? formatBytes(result.size) : (result.error || 'unknown error'),
path: path.resolve(destPath),
});
}
return results;
Expand Down
3 changes: 3 additions & 0 deletions clis/douban/download.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ describe('douban download', () => {
detail_url: 'https://movie.douban.com/photos/photo/2913450214/',
status: 'success',
size: '1200 B',
path: path.resolve('/tmp/douban-test/30382501/30382501_001_2913450214_Main_poster.webp'),
},
{
index: 2,
Expand All @@ -112,6 +113,7 @@ describe('douban download', () => {
detail_url: 'https://movie.douban.com/photos/photo/2913450215/',
status: 'success',
size: '980 B',
path: path.resolve('/tmp/douban-test/30382501/30382501_002_2913450215_Character_poster.jpg'),
},
]);
});
Expand Down Expand Up @@ -160,6 +162,7 @@ describe('douban download', () => {
detail_url: 'https://movie.douban.com/photos/photo/2913450215/',
status: 'success',
size: '980 B',
path: path.resolve('/tmp/douban-test/30382501/30382501_002_2913450215_Character_poster.jpg'),
},
]);
});
Expand Down
Loading