mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
Partly revert c7f2cbd to make stats work again
This commit is contained in:
parent
49ec09a78b
commit
b8e48f32f7
1 changed files with 21 additions and 21 deletions
|
|
@ -27,9 +27,8 @@ from optparse import OptionParser
|
||||||
import paramiko
|
import paramiko
|
||||||
import socket
|
import socket
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import common, metadata
|
import common, metadata
|
||||||
from common import FDroidPopen
|
import subprocess
|
||||||
|
|
||||||
def carbon_send(key, value):
|
def carbon_send(key, value):
|
||||||
s = socket.socket()
|
s = socket.socket()
|
||||||
|
|
@ -121,30 +120,31 @@ def main():
|
||||||
logsearch = re.compile(logexpr).search
|
logsearch = re.compile(logexpr).search
|
||||||
for logfile in glob.glob(os.path.join(logsdir,'access-*.log.gz')):
|
for logfile in glob.glob(os.path.join(logsdir,'access-*.log.gz')):
|
||||||
logging.info('...' + logfile)
|
logging.info('...' + logfile)
|
||||||
p = FDroidPopen(["zcat", logfile])
|
if options.verbose:
|
||||||
|
print '...' + logfile
|
||||||
|
p = subprocess.Popen(["zcat", logfile], stdout = subprocess.PIPE)
|
||||||
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 not uri.endswith('.apk'):
|
if uri.endswith('.apk'):
|
||||||
continue
|
_, apkname = os.path.split(uri)
|
||||||
_, apkname = os.path.split(uri)
|
app = knownapks.getapp(apkname)
|
||||||
app = knownapks.getapp(apkname)
|
if app:
|
||||||
if app:
|
appid, _ = app
|
||||||
appid, _ = app
|
if appid in apps:
|
||||||
if appid in apps:
|
apps[appid] += 1
|
||||||
apps[appid] += 1
|
else:
|
||||||
|
apps[appid] = 1
|
||||||
|
# Strip the '.apk' from apkname
|
||||||
|
appVer = apkname[:-4]
|
||||||
|
if appVer in appsVer:
|
||||||
|
appsVer[appVer] += 1
|
||||||
|
else:
|
||||||
|
appsVer[appVer] = 1
|
||||||
else:
|
else:
|
||||||
apps[appid] = 1
|
if not apkname in unknownapks:
|
||||||
# Strip the '.apk' from apkname
|
unknownapks.append(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