aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Logan <cody@lokken.dev>2023-11-16 11:50:52 -0800
committerCody Logan <cody@lokken.dev>2023-11-16 11:50:52 -0800
commit5e7e0b84c632641ba12041b2aa516b4a27245de6 (patch)
tree6306ca6a238a0b95dd9038c64dd111b582941807
parent2f3074e1b2a62cbd5e32778abc0ff82027c1ce3b (diff)
parentabf8d1cbf22bb5aa5a1dc8a7380177af05bb4b23 (diff)
downloadwikiget-5e7e0b84c632641ba12041b2aa516b4a27245de6.tar.gz
wikiget-5e7e0b84c632641ba12041b2aa516b4a27245de6.zip
Merge branch 'master' into reduce-api-calls
-rw-r--r--docs/wikiget.113
-rw-r--r--docs/wikiget.1.md11
-rw-r--r--src/wikiget/dl.py2
-rw-r--r--src/wikiget/version.py2
-rw-r--r--tests/test_dl.py3
5 files changed, 21 insertions, 10 deletions
diff --git a/docs/wikiget.1 b/docs/wikiget.1
index fa1a33d..0d7bf9b 100644
--- a/docs/wikiget.1
+++ b/docs/wikiget.1
@@ -1,6 +1,6 @@
-.\" Automatically generated by Pandoc 3.1.8
+.\" Automatically generated by Pandoc 3.1.9
.\"
-.TH "WIKIGET" "1" "October 5, 2023" "Version 0.5.1" "Wikiget User Manual"
+.TH "WIKIGET" "1" "November 16, 2023" "Version 0.8.0" "Wikiget User Manual"
.SH NAME
wikiget - download files from MediaWiki sites
.SH SYNOPSIS
@@ -81,6 +81,11 @@ If this flag is set, \f[B]wikiget\f[R] will run in batch download mode
Number of parallel downloads to attempt in batch mode.
This option has no effect if -\f[B]a\f[R] is not also set.
.TP
+-\f[B]n\f[R], --\f[B]dry-run\f[R]
+Do a dry-run of the download process.
+Useful for checking the format of a batch file.
+Nothing will actually be downloaded.
+.TP
-\f[B]v\f[R], --\f[B]verbose\f[R]
Print additional information, such as the site used and the full URL of
the file.
@@ -120,4 +125,6 @@ You should have received a copy of the GNU General Public License along
with this program.
If not, see https://www.gnu.org/licenses/.
.SH AUTHORS
-Cody Logan <clpo13@gmail.com>.
+Cody Logan \c
+.MT cody@lokken.dev
+.ME \c.
diff --git a/docs/wikiget.1.md b/docs/wikiget.1.md
index fd274d5..d537942 100644
--- a/docs/wikiget.1.md
+++ b/docs/wikiget.1.md
@@ -1,6 +1,6 @@
-% WIKIGET(1) Version 0.5.1 | Wikiget User Manual
-% Cody Logan <clpo13@gmail.com>
-% October 5, 2023
+% WIKIGET(1) Version 0.8.0 | Wikiget User Manual
+% Cody Logan <cody@lokken.dev>
+% November 16, 2023
# NAME
@@ -72,6 +72,11 @@ the file name or the URL of its description page.
: Number of parallel downloads to attempt in batch mode. This option has no effect if \-**a** is not also set.
+\-**n**, \-\-**dry-run**
+
+: Do a dry-run of the download process. Useful for checking the format of a batch file. Nothing will actually be
+ downloaded.
+
\-**v**, \-\-**verbose**
: Print additional information, such as the site used and the full URL of the file. Additional invocations will
diff --git a/src/wikiget/dl.py b/src/wikiget/dl.py
index c9b2ed5..9b53d66 100644
--- a/src/wikiget/dl.py
+++ b/src/wikiget/dl.py
@@ -189,7 +189,7 @@ def download(f: File, args: Namespace) -> int:
# prepend the current filename to all log messages
adapter = FileLogAdapter(logger, {"filename": filename})
- if file.exists:
+ if file.imageinfo:
# file exists either locally or at a common repository, like Wikimedia Commons
file_url = file.imageinfo["url"]
file_size = file.imageinfo["size"]
diff --git a/src/wikiget/version.py b/src/wikiget/version.py
index 479f200..804c60f 100644
--- a/src/wikiget/version.py
+++ b/src/wikiget/version.py
@@ -15,4 +15,4 @@
# You should have received a copy of the GNU General Public License
# along with Wikiget. If not, see <https://www.gnu.org/licenses/>.
-__version__ = "0.8.0.dev0"
+__version__ = "0.8.0"
diff --git a/tests/test_dl.py b/tests/test_dl.py
index b0822cf..10f5fd5 100644
--- a/tests/test_dl.py
+++ b/tests/test_dl.py
@@ -338,7 +338,6 @@ class TestDownload:
"""
file = File(name="Example.jpg")
file.image = Mock()
- file.image.exists = True
file.image.imageinfo = {
"url": "https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg",
"size": 9022,
@@ -506,7 +505,7 @@ class TestDownload:
self, mock_file: File, caplog: pytest.LogCaptureFixture
) -> None:
"""Test that a warning message is logged if no file info was returned."""
- mock_file.image.exists = False
+ mock_file.image.imageinfo = {}
args = parse_args(["File:Example.jpg"])
errors = download(mock_file, args)