mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 15:02:51 +03:00
Last missing bit of Popen
This commit is contained in:
parent
62c3663df3
commit
c7f2cbd85b
1 changed files with 22 additions and 20 deletions
|
@ -25,9 +25,10 @@ import traceback
|
||||||
import glob
|
import glob
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import paramiko
|
import paramiko
|
||||||
import common, metadata
|
|
||||||
import socket
|
import socket
|
||||||
import subprocess
|
|
||||||
|
import common, metadata
|
||||||
|
from common import FDroidPopen
|
||||||
|
|
||||||
def carbon_send(key, value):
|
def carbon_send(key, value):
|
||||||
s = socket.socket()
|
s = socket.socket()
|
||||||
|
@ -121,29 +122,30 @@ def main():
|
||||||
for logfile in glob.glob(os.path.join(logsdir,'access-*.log.gz')):
|
for logfile in glob.glob(os.path.join(logsdir,'access-*.log.gz')):
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
print '...' + logfile
|
print '...' + logfile
|
||||||
p = subprocess.Popen(["zcat", logfile], stdout = subprocess.PIPE)
|
p = FDroidPopen(["zcat", logfile])
|
||||||
matches = (logsearch(line) for line in p.stdout)
|
matches = (logsearch(line) for line in p.stdout)
|
||||||
for match in matches:
|
for match in matches:
|
||||||
if match and match.group('statuscode') == '200':
|
if match and match.group('statuscode') == '200':
|
||||||
uri = match.group('uri')
|
uri = match.group('uri')
|
||||||
if uri.endswith('.apk'):
|
if not uri.endswith('.apk'):
|
||||||
_, apkname = os.path.split(uri)
|
continue
|
||||||
app = knownapks.getapp(apkname)
|
_, apkname = os.path.split(uri)
|
||||||
if app:
|
app = knownapks.getapp(apkname)
|
||||||
appid, _ = app
|
if app:
|
||||||
if appid in apps:
|
appid, _ = app
|
||||||
apps[appid] += 1
|
if appid in apps:
|
||||||
else:
|
apps[appid] += 1
|
||||||
apps[appid] = 1
|
|
||||||
# Strip the '.apk' from apkname
|
|
||||||
appVer = apkname[:-4]
|
|
||||||
if appVer in appsVer:
|
|
||||||
appsVer[appVer] += 1
|
|
||||||
else:
|
|
||||||
appsVer[appVer] = 1
|
|
||||||
else:
|
else:
|
||||||
if not apkname in unknownapks:
|
apps[appid] = 1
|
||||||
unknownapks.append(apkname)
|
# Strip the '.apk' from apkname
|
||||||
|
appVer = apkname[:-4]
|
||||||
|
if appVer in appsVer:
|
||||||
|
appsVer[appVer] += 1
|
||||||
|
else:
|
||||||
|
appsVer[appVer] = 1
|
||||||
|
else:
|
||||||
|
if not apkname in unknownapks:
|
||||||
|
unknownapks.append(apkname)
|
||||||
|
|
||||||
# Calculate and write stats for total downloads...
|
# Calculate and write stats for total downloads...
|
||||||
lst = []
|
lst = []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue