瀏覽代碼

Change `tootctl media refresh` to skip already downloaded attachments (#12118)

master^2
Eugen Rochko 4 年之前
committed by GitHub
父節點
當前提交
4a98e77d0e
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. +5
    -1
      lib/mastodon/media_cli.rb

+ 5
- 1
lib/mastodon/media_cli.rb 查看文件

@@ -50,6 +50,7 @@ module Mastodon
option :concurrency, type: :numeric, default: 5, aliases: [:c]
option :verbose, type: :boolean, default: false, aliases: [:v]
option :dry_run, type: :boolean, default: false
option :force, type: :boolean, default: false
desc 'refresh', 'Fetch remote media files'
long_desc <<-DESC
Re-downloads media attachments from other servers. You must specify the
@@ -62,6 +63,9 @@ module Mastodon
using username@domain handle of the account.

Use the --domain option to download attachments from a specific domain.

By default, attachments that are believed to be already downloaded will
not be re-downloaded. To force re-download of every URL, use --force.
DESC
def refresh
dry_run = options[:dry_run] ? ' (DRY RUN)' : ''
@@ -85,7 +89,7 @@ module Mastodon
end

processed, aggregate = parallelize_with_progress(scope) do |media_attachment|
next if media_attachment.remote_url.blank?
next if media_attachment.remote_url.blank? || (!options[:force] && media_attachment.file_file_name.present?)

unless options[:dry_run]
media_attachment.reset_file!


Loading…
取消
儲存