Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
I
inary
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
1
Konular (issue)
1
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
SulinOS
inary
Commits
339c5f5b
Kaydet (Commit)
339c5f5b
authored
Tem 01, 2005
tarafından
S.Çağlar Onur
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed unused imports, file -> fileURI [ keyword ]
üst
9fb88dc5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
18 deletions
+12
-18
cat-db.py
cat-db.py
+1
-3
fetcher.py
pisi/fetcher.py
+11
-15
No files found.
cat-db.py
Dosyayı görüntüle @
339c5f5b
...
...
@@ -3,14 +3,12 @@
# avoiding multiple invocations of the same instance
import
sys
import
string
import
bsddb.dbshelve
as
shelve
import
os
d
=
shelve
.
open
(
sys
.
argv
[
1
]
)
#print 'list serial time, db size ', len(d)
for
(
k
,
data
)
in
d
.
iteritems
():
for
(
k
,
data
)
in
d
.
iteritems
():
print
k
,
data
d
.
close
()
pisi/fetcher.py
Dosyayı görüntüle @
339c5f5b
...
...
@@ -11,7 +11,6 @@ import os
# pisi modules
import
util
from
config
import
config
from
purl
import
PUrl
from
ui
import
ui
...
...
@@ -64,7 +63,7 @@ class Fetcher:
return
os
.
path
.
join
(
self
.
filedest
,
self
.
url
.
filename
())
def
doGrab
(
self
,
file
,
dest
,
totalsize
):
def
doGrab
(
self
,
file
URI
,
dest
,
totalsize
):
symbols
=
[
' B/s'
,
'KB/s'
,
'MB/s'
,
'GB/s'
]
from
time
import
time
tt
,
oldsize
=
int
(
time
()),
0
...
...
@@ -72,12 +71,12 @@ class Fetcher:
bs
,
size
=
1024
,
0
symbol
,
depth
=
"B/s"
,
0
st
=
time
()
chunk
=
file
.
read
(
bs
)
chunk
=
file
URI
.
read
(
bs
)
size
=
size
+
len
(
chunk
)
self
.
percent
=
p
.
update
(
size
)
while
chunk
:
dest
.
write
(
chunk
)
chunk
=
file
.
read
(
bs
)
chunk
=
file
URI
.
read
(
bs
)
size
=
size
+
len
(
chunk
)
ct
=
time
()
if
int
(
tt
)
!=
int
(
ct
):
...
...
@@ -98,9 +97,7 @@ class Fetcher:
dest
.
close
()
def
fetchLocalFile
(
self
):
from
shutil
import
copyfile
url
=
self
.
url
if
os
.
access
(
url
.
path
(),
os
.
F_OK
)
==
False
:
...
...
@@ -108,16 +105,15 @@ class Fetcher:
dest
=
open
(
os
.
path
.
join
(
self
.
filedest
,
url
.
filename
())
,
"w"
)
totalsize
=
os
.
path
.
getsize
(
url
.
path
())
file
=
open
(
url
.
path
())
self
.
doGrab
(
file
,
dest
,
totalsize
)
fileURI
=
open
(
url
.
path
())
self
.
doGrab
(
fileURI
,
dest
,
totalsize
)
def
fetchRemoteFile
(
self
):
from
httplib
import
HTTPException
try
:
file
=
urllib2
.
urlopen
(
self
.
url
.
uri
)
headers
=
file
.
info
()
file
URI
=
urllib2
.
urlopen
(
self
.
url
.
uri
)
headers
=
file
URI
.
info
()
except
ValueError
,
e
:
self
.
err
(
'
%
s'
%
(
e
,
))
...
...
@@ -133,7 +129,7 @@ class Fetcher:
else
:
totalsize
=
int
(
headers
[
'Content-Length'
])
dest
=
open
(
os
.
path
.
join
(
self
.
filedest
,
self
.
url
.
filename
())
,
"w"
)
self
.
doGrab
(
file
,
dest
,
totalsize
)
self
.
doGrab
(
file
URI
,
dest
,
totalsize
)
def
err
(
self
,
error
):
...
...
@@ -150,7 +146,7 @@ class Progress:
percent
=
(
size
*
100
)
/
self
.
totalsize
if
percent
and
self
.
percent
is
not
percent
:
self
.
percent
=
percent
return
percent
self
.
percent
=
percent
return
percent
else
:
return
0
return
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment