File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 11
11
12
12
COMMONS_SITE_URL = 'commons.wikimedia.org'
13
13
COMMONS_PROTOCOL = 'https'
14
- COMMONS_DEFAULT_CATEGORY = 'Images supported by Wikimedia France - Lutz'
15
-
14
+ COMMONS_FILE_NAMESPACE = 6
16
15
COMMONS_QI_CATEGORY = 'Category:Quality images'
17
16
COMMONS_FP_CATEGORY = 'Category:Featured pictures on Wikimedia Commons'
18
17
COMMONS_VI_CATEGORY = 'Category:Valued images sorted by promotion date'
19
18
19
+ COMMONS_DEFAULT_CATEGORY = 'Images supported by Wikimedia France - Lutz'
20
20
DEFAULT_DB_FILE = 'category.db'
21
21
22
22
@@ -28,7 +28,9 @@ def updatecategory(mediadatabase, category):
28
28
category (str): category to update
29
29
"""
30
30
site = mwclient .Site ((COMMONS_PROTOCOL , COMMONS_SITE_URL ))
31
- images = [img for img in site .Categories [category ]]
31
+ # search page in category and keeps only images
32
+ images = [img for img in site .Categories [category ]
33
+ if img .namespace == COMMONS_FILE_NAMESPACE ]
32
34
logging .debug ("%d images in category %s" , len (images ), category )
33
35
for img in images :
34
36
image = make_media (img )
You can’t perform that action at this time.
0 commit comments