mirror of
https://source.perfectable.org/nivertius/napi.git
synced 2025-07-02 03:04:39 +02:00
command line option for language
This commit is contained in:
parent
c467260b65
commit
4e587aec00
1 changed files with 12 additions and 4 deletions
16
napi
16
napi
|
@ -27,14 +27,22 @@ base_url = "http://napiprojekt.pl/api/api-napiprojekt3.php"
|
||||||
password = "iBlm8NTigvru0Jr0"
|
password = "iBlm8NTigvru0Jr0"
|
||||||
input_filename = '/tmp/napi-temp-file'
|
input_filename = '/tmp/napi-temp-file'
|
||||||
|
|
||||||
|
from getopt import getopt
|
||||||
|
|
||||||
|
opts, args = getopt(sys.argv[1:], '', ['language='])
|
||||||
|
|
||||||
language = "PL"
|
language = "PL"
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
for optname, optvalue in opts:
|
||||||
print "usage: %s <movie>" % sys.argv[0]
|
if optname == '--language':
|
||||||
sys.exit(2)
|
language = optvalue
|
||||||
|
|
||||||
|
if len(args) < 1:
|
||||||
|
print "usage: %s <movie>" % (sys.argv[0],)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
d = md5.new()
|
d = md5.new()
|
||||||
movie_filename = sys.argv[1]
|
movie_filename = args[0]
|
||||||
try:
|
try:
|
||||||
with open(movie_filename, "r") as movie_file:
|
with open(movie_filename, "r") as movie_file:
|
||||||
d.update(movie_file.read(10485760))
|
d.update(movie_file.read(10485760))
|
||||||
|
|
Loading…
Add table
Reference in a new issue