"Thomas R. Koll" <tomk32(a)gmx.de> writes:
for arg in sys.argv[1:]:
if arg.startswith('-file:'):
So ungefähr. Bei der Eingabedatei "job.txt" verwende ich momentan
dieses Format - eigentlich müßte ich ja XML verwenden:
2004-01-03/atzenhof-solar-modul-unten-v-s.jpg
[[Atzenhof]], Solarkraftwerk, ein Einzelmodul von unten, von S (2004-01-03);
Fotograph: keichwa.
-=-
2004-01-03/atzenhof-solar-module-weg-v-s.jpg
[[Atzenhof]], Solarkraftwerk, eine eingezäunte Modulreihe und der Weg, von S
(2004-01-03); Fotograph: keichwa.
-=-
Also:
Dateiname 1
Beschreibung 1
-=-
Dateiname 2
Beschreibung 2
-=-
Jetzt muß ich noch herausfinden, wie ich Artikel via Bot zur
Beobachtung markieren kann. Tips?
Hier mein Patch gegen upload.py (mit üblen Hartkodierungen, es ist mein
erster Python-Patch überhaupt):
--- upload.py 2003-11-16 16:37:36.000000000 +0100
+++ ke-upload.py 2004-01-10 16:56:18.000000000 +0100
@@ -93,33 +93,47 @@
print "Uploading image to ",wikipedia.langs[wikipedia.mylang]
def main():
- fn = raw_input('File or URL where image is now : ')
- # Get file contents
- import urllib
- file = urllib.urlopen(fn)
- contents = file.read()
- file.close()
- # Isolate the pure name
- if '/' in fn:
- fn = fn.split('/')[-1]
- if '\\' in fn:
- fn = fn.split('\\')[-1]
- print "The filename on wikipedia will default to:",fn
- newfn = raw_input("Better name : ")
- if newfn:
- fn = newfn
-
- # A proper description for the submission
- description = raw_input('Description : ')
+ import urllib,os
+ fn = "job.txt"
+ start = 1
+ text = ''
+ if os.path.exists(fn):
+ f=open(fn)
+ for line in f.readlines():
+ if line == "-=-\n":
+
+ file = urllib.urlopen(img)
+ contents = file.read()
+ file.close()
+ # Isolate the pure name
+ if '/' in img:
+ img = img.split('/')[-1]
+
+ if '\\' in fn:
+ img = img.split('\\')[-1]
+ print "The filename on wikipedia will default to:",img
+
+ description = text
+
+ data = post_multipart(wikipedia.langs[wikipedia.mylang],
+ uploadaddr,
+ (('wpUploadDescription', description),
+ ('wpUploadAffirm', '1'),
+ ('wpUpload','upload bestand')),
+ (('wpUploadFile',img,contents),)
+ )
- data = post_multipart(wikipedia.langs[wikipedia.mylang],
- uploadaddr,
- (('wpUploadDescription', description),
- ('wpUploadAffirm', '1'),
- ('wpUpload','upload bestand')),
- (('wpUploadFile',fn,contents),)
- )
+ start = 1
+ text = ''
+ continue
+ if start:
+ img = line
+ start = False
+ continue
+
+ text = text + line
+
return fn
if __name__=="__main__":
--
| ,__o
| _-\_<,
http://www.gnu.franken.de/ke/ | (*)/'(*)