Skip to content

Commit eb27cbc

Browse files
Michal MitterMichal Mitter
authored andcommitted
unfinished
1 parent 4836bac commit eb27cbc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+600
-2146
lines changed

.gitignore

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
config.py
21
config.cfg
32
__pycache__/
43
*.py[cod]
54
.idea
6-
tasks_config.py
7-
tmp/
8-
flags/
9-
maps/
105
venv/
116
logs/
12-
app/static/node_modules/
13-
/app/static/package-lock.json
14-
/scripts/events/
15-
/scripts/elysium/
7+
tmp/
8+
Anders.Gaming.LibTech3.exe

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,29 @@
11
# Greatshot
2-
Demo analysis, cutting, video rendering for IdTech3 games mainly Wolfenstein: Enemy Territory
2+
Demo analysis, cutting, IdTech3 games mainly Wolfenstein: Enemy Territory (etpro, legacy) and RTCW (RTCWPro)
33
[![Discord](https://img.shields.io/discord/546291405404897290?label=discord)](https://discord.gg/p59kWdF)
44
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=BRRRFPT7N9NP6&currency_code=EUR&source=url)
5-
## what it can do:
5+
6+
## Rewrite branch:
7+
8+
This branch doesn't have rendering stuff and Gamestv integration for simplier installation. Gamestv integration doesn't work anymore because login process was changed.
9+
10+
## Features:
611
- cut demos (dm_84/tv_84) -> dm_84
712
- export demos (dm_84/tv_84) to json and analyze it to output:
813
- hit regions (headshots) counter
914
- fast consecutive kills <img src="/app/static/excellent.png" height="25" width="25"/> [example](https://streamable.com/a5tx7)
1015
- consecutive headshots - [example](https://streamable.com/e4ogi)
11-
- revive stats
12-
- download ETTV demo (tv_84) from [gamestv.org](http://gamestv.org)
13-
- render demo to video and publish it - [example](https://streamable.com/2d77)
14-
- link highlights and statistics in comments of gamestv match
15-
- render highlights from gamestv match
16-
- add player name + flag to highlight [example](https://streamable.com/zn7r4)
17-
18-
## what it could do in future:
19-
- create database of players with statistics
20-
- visualize timeline of match
21-
- retrieve true damage stats when its bugged to 0
22-
- support other IdTech3 games/mods: RTCW, Quake3, ...
16+
- revive stats (only for ETTV)
2317

2418
This project uses [hannes's](http://www.crossfire.nu/user/view/id/6710) modified [Tech3 Demo API - 0.1](http://www.crossfire.nu/news/4632/tech3-demo-api-01) to cut and export demos.
2519
It was modified to be able to cut [ETTV](http://wolfwiki.anime.net/index.php/ETTV:Viewer%27s_Guide) demo with selected player's POV. My modification: [Tech3 Demo API](https://github.com/mittermichal/Anders.Gaming.LibTech3)
2620

27-
## Self-hosting
21+
## Run:
2822

29-
with python3:
23+
with python3.12:
3024
- `pip install -r requirements.txt`
31-
- download parsing application from https://github.com/mittermichal/Anders.Gaming.LibTech3/releases its path is then referenced in `PARSERPATH` in `config.cfg` in the next step
32-
- create `config.cfg` and `config.py` from `config.sample.cfg` and `config.sample.py`
33-
- run `python init_db.py` ... this should create sqlite database
34-
- run `python web.py`
35-
- open `localhost:5111` in browser
25+
- download parsing application from https://github.com/mittermichal/Anders.Gaming.LibTech3/releases its path is then referenced in `PARSERPATH` in `config.cfg`
26+
- run `python greatshot_web.py`
27+
- open `localhost:5000` in browser
28+
29+
alternatively use poetry to install dependencies

alembic.ini

Lines changed: 0 additions & 68 deletions
This file was deleted.

alembic/env.py

Lines changed: 0 additions & 87 deletions
This file was deleted.

alembic/script.py.mako

Lines changed: 0 additions & 24 deletions
This file was deleted.

alembic/versions/027df6ec26ee_.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

alembic/versions/3215e476a33a_.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

app/Libtech3.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import subprocess
2-
import sys
32
import os
43
from enum import Enum
54
from sqlalchemy import Column, Integer, String, ForeignKey, SmallInteger
@@ -392,3 +391,8 @@ class RtcwWeapon(Enum):
392391
WP_SMOKE_GRENADE = 45
393392
WP_BINOCULARS = 46
394393
WP_NUM_WEAPONS = 47
394+
395+
396+
class LegacyWeapon(Enum):
397+
# TODO rewrite
398+
pass

app/__init__.py

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
1-
from flask import Flask, config
2-
from flask_socketio import SocketIO
1+
import os
2+
import secrets
3+
from flask import Flask
34

4-
app_config = config.Config('.')
5-
app_config.from_pyfile('config.cfg')
6-
socketio = SocketIO(async_mode="eventlet", engineio_logger=True, cors_allowed_origins=app_config['APPHOST'])
5+
config_path = 'config.cfg'
76

87

9-
def create_app(debug=False):
8+
def create_app():
109
"""Create an application."""
1110
app = Flask(__name__)
12-
app.config.from_pyfile('../config.cfg')
13-
from app.views.renders import renders
14-
app.register_blueprint(renders)
15-
11+
app.config.from_pyfile(f'../{config_path}')
12+
if 'INDEXER' not in app.config:
13+
if os.name == 'nt': # windows
14+
app.config['INDEXER'] = r'indexTarget/app\upload\%s/exportJsonFile/app\download\exports\%s.txt/exportBulletEvents/1/exportDemo/1/exportChatMessages/1/exportRevives/1'
15+
else:
16+
app.config['INDEXER'] = r'indexTarget\\app/upload/%s\\exportJsonFile\\app/download/exports/%s.txt\\exportBulletEvents\\1\\exportDemo\\1\\exportChatMessages\\1\\exportRevives\\1'
1617
from app.views.main import flask_app as main_blueprint
1718
app.register_blueprint(main_blueprint)
18-
19-
socketio.init_app(app, cookie=None)
2019
return app
2120

22-
# flask_app = Flask(__name__)
23-
# flask_app.config.from_pyfile('config.cfg')
24-
# flask_app.register_blueprint(renders)
25-
# socketio = SocketIO(flask_app, cookie=None)
2621

22+
def init_config():
23+
if not os.path.exists(config_path):
24+
print(f'{config_path} not found, creating one with default values')
25+
if os.name == 'nt': # windows
26+
parser_path = 'Anders.Gaming.LibTech3.exe'
27+
else:
28+
parser_path = 'LibTech3-linux-x86-64'
29+
with open(config_path, 'w') as f:
30+
f.write(
31+
f"SECRET_KEY='{secrets.token_hex()}'\n"
32+
f"PARSERPATH='{parser_path}'\n"
33+
f"MAX_CONTENT_LENGTH = 50 * 1024 * 1024"
34+
f"DEBUG=True # set to false for production"
35+
)

0 commit comments

Comments
 (0)