From fac27a34ade0fe391bc0b698099737afde0a2e25 Mon Sep 17 00:00:00 2001 From: Matthew Berry Date: Sun, 7 Apr 2019 19:25:43 -0400 Subject: [PATCH 1/3] major changes (dockerize / auto-update skin ids on restart) --- docker-compose.yml | 20 + skin_ids/Dockerfile | 36 + skin_ids/main.py | 82 ++ skin_ids/requirements.txt | 2 + skinstats/Dockerfile | 9 + const.py => skinstats/const.py | 744 +----------------- csgo_worker.py => skinstats/csgo_worker.py | 3 + .../requirements.txt | 2 +- skinstats.py => skinstats/skinstats.py | 2 +- {static => skinstats/static}/css/styles.css | 0 {static => skinstats/static}/index.html | 0 {static => skinstats/static}/js/post.js | 0 12 files changed, 155 insertions(+), 745 deletions(-) create mode 100644 docker-compose.yml create mode 100644 skin_ids/Dockerfile create mode 100644 skin_ids/main.py create mode 100644 skin_ids/requirements.txt create mode 100644 skinstats/Dockerfile rename const.py => skinstats/const.py (73%) rename csgo_worker.py => skinstats/csgo_worker.py (98%) rename requirements.txt => skinstats/requirements.txt (79%) rename skinstats.py => skinstats/skinstats.py (99%) rename {static => skinstats/static}/css/styles.css (100%) rename {static => skinstats/static}/index.html (100%) rename {static => skinstats/static}/js/post.js (100%) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8f0796b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3' + +services: + skinstats: + build: ./skinstats + depends_on: + - skin_ids + environment: + - steam_user=${steam_user} + - steam_pass=${steam_pass} + ports: + - "5000:5000" + restart: on-failure + skin_ids: + build: ./skin_ids + healthcheck: + test: wget -qO - skin_ids:5001/get_skin_ids > /dev/null || exit 1 + interval: 0s + timeout: 1s + retries: 300 \ No newline at end of file diff --git a/skin_ids/Dockerfile b/skin_ids/Dockerfile new file mode 100644 index 0000000..8551685 --- /dev/null +++ b/skin_ids/Dockerfile @@ -0,0 +1,36 @@ +FROM debian:stretch-slim + +RUN apt-get update +RUN apt-get install -y --no-install-recommends --no-install-suggests \ + lib32stdc++6 \ + lib32gcc1 \ + wget \ + ca-certificates \ + python3 \ + python3-pip \ + python3-setuptools \ + htop \ + vim \ + ipython3 +RUN useradd -m steam +RUN su steam -c \ + "mkdir -p /home/steam/steamcmd \ + && cd /home/steam/steamcmd \ + && wget -qO- 'https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz' | tar zxf -" +RUN apt-get clean autoclean +RUN apt-get autoremove -y +RUN rm -rf /var/lib/{apt,dpkg,cache,log}/ + +USER steam + +WORKDIR /home/steam + +RUN steamcmd/steamcmd.sh +login anonymous +force_install_dir ../games +app_update 740 +quit + +RUN mkdir static + +COPY . . + +RUN pip3 install --user --no-cache-dir -r requirements.txt + +CMD [ "python3", "main.py" ] \ No newline at end of file diff --git a/skin_ids/main.py b/skin_ids/main.py new file mode 100644 index 0000000..5c7adbc --- /dev/null +++ b/skin_ids/main.py @@ -0,0 +1,82 @@ +import atexit +import json +import logging +import re +import subprocess + +from apscheduler.schedulers.background import BackgroundScheduler +from flask import Flask + +logging.basicConfig(format="%(asctime)s | %(name)s | thread:%(thread)s | %(levelname)s | %(message)s", + level=logging.INFO) +LOG = logging.getLogger('SKIN ID GETTER') + +app = Flask(__name__, static_url_path='') + + +@app.route('/') +def main(): + return "SUP FUCKERS" + + +@app.route('/get_skin_ids') +def get_items(): + return app.send_static_file('skin_ids.json') + + +def update_csgo_items(): + p = subprocess.run(['steamcmd/steamcmd.sh', '+login', 'anonymous', '+force_install_dir', '../games', '+app_update', '740', '+quit'], stdout=subprocess.DEVNULL) + if p.returncode == 0: + update_items_json() + else: + LOG.error('Failed to update game') + + +def update_items_json(): + name_matcher = re.compile(r'^\s*"(Paint[^"]+_Tag)"\s*"([^"]+)"$', re.I) + names = {} + with open('games/csgo/resource/csgo_english.txt', 'r', encoding='utf-16-le') as f: + for line in f.readlines(): + match = name_matcher.match(line) + if match: + tag, name = match.groups() + tag = tag.lower() + names[tag] = name + + id_matcher = re.compile(r'^.*"(\d+)"$') + tag_matcher = re.compile(r'^.*"description_tag".*"#(.*)"$') + ids = {} + with open('games/csgo/scripts/items/items_game.txt', 'r') as f: + in_paint_kits = True + for line in f.readlines(): + if not in_paint_kits and '"paint_kits"' in line: + in_paint_kits = True + continue + + id_match = id_matcher.match(line) + if id_match: + cur_id = id_match.groups()[0] + continue + + tag_match = tag_matcher.match(line) + if tag_match: + tag = tag_match.groups()[0] + tag = tag.lower() + ids[cur_id] = tag + + final_map = {} + for id_num, tag in ids.items(): + final_map[id_num] = names.get(tag) + + with open('static/skin_ids.json', 'w') as f: + f.write(json.dumps(final_map)) + + +if __name__ == '__main__': + update_csgo_items() + sched = BackgroundScheduler() + sched.add_job(update_csgo_items, 'interval', minutes=30) + sched.start() + atexit.register(lambda: sched.shutdown()) + + app.run(debug=True, use_reloader=False, host='0.0.0.0', port=5001) diff --git a/skin_ids/requirements.txt b/skin_ids/requirements.txt new file mode 100644 index 0000000..1dcebfb --- /dev/null +++ b/skin_ids/requirements.txt @@ -0,0 +1,2 @@ +Flask +apscheduler \ No newline at end of file diff --git a/skinstats/Dockerfile b/skinstats/Dockerfile new file mode 100644 index 0000000..9fbec2a --- /dev/null +++ b/skinstats/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3 + +WORKDIR /usr/src/app + +COPY . . + +RUN pip install --no-cache-dir -r requirements.txt + +CMD [ "python", "./skinstats.py" ] \ No newline at end of file diff --git a/const.py b/skinstats/const.py similarity index 73% rename from const.py rename to skinstats/const.py index 9e5c8fd..e742b16 100644 --- a/const.py +++ b/skinstats/const.py @@ -29,748 +29,6 @@ 619:'Sapphire' } -skins = { - "2":"Groundwater", - "3":"Candy Apple", - "5":"Forest DDPAT", - "6":"Arctic Camo", - "8":"Desert Storm", - "9":"Bengal Tiger", - "10":"Copperhead", - "11":"Skulls", - "12":"Crimson Web", - "13":"Blue Streak", - "14":"Red Laminate", - "15":"Gunsmoke", - "16":"Jungle Tiger", - "17":"Urban DDPAT", - "20":"Virus", - "21":"Granite Marbleized", - "22":"Contrast Spray", - "25":"Forest Leaves", - "26":"Lichen Dashed", - "27":"Bone Mask", - "28":"Anodized Navy", - "30":"Snake Camo", - "32":"Silver", - "33":"Hot Rod", - "34":"Metallic DDPAT", - "36":"Ossified", - "37":"Blaze", - "38":"Fade", - "39":"Bulldozer", - "40":"Night", - "41":"Copper", - "42":"Blue Steel", - "43":"Stained", - "44":"Case Hardened", - "46":"Contractor", - "47":"Colony", - "48":"Dragon Tattoo", - "51":"Lightning Strike", - "59":"Slaughter", - "60":"Dark Water", - "61":"Hypnotic", - "62":"Bloomstick", - "67":"Cold Blooded", - "70":"Carbon Fiber", - "71":"Scorpion", - "72":"Safari Mesh", - "73":"Wings", - "74":"Polar Camo", - "75":"Blizzard Marbleized", - "76":"Winter Forest", - "77":"Boreal Forest", - "78":"Forest Night", - "83":"Orange DDPAT", - "84":"Pink DDPAT", - "90":"Mudder", - "92":"Cyanospatter", - "93":"Caramel", - "95":"Grassland", - "96":"Blue Spruce", - "98":"Ultraviolet", - "99":"Sand Dune", - "100":"Storm", - "101":"Tornado", - "102":"Whiteout", - "104":"Grassland Leaves", - "107":"Polar Mesh", - "110":"Condemned", - "111":"Glacier Mesh", - "116":"Sand Mesh", - "119":"Sage Spray", - "122":"Jungle Spray", - "124":"Sand Spray", - "135":"Urban Perforated", - "136":"Waves Perforated", - "141":"Orange Peel", - "143":"Urban Masked", - "147":"Jungle Dashed", - "148":"Sand Dashed", - "149":"Urban Dashed", - "151":"Jungle", - "153":"Demolition", - "154":"Afterimage", - "155":"Bullet Rain", - "156":"Death by Kitty", - "157":"Palm", - "158":"Walnut", - "159":"Brass", - "162":"Splash", - "164":"Modern Hunter", - "165":"Splash Jam", - "166":"Blaze Orange", - "167":"Radiation Hazard", - "168":"Nuclear Threat", - "169":"Fallout Warning", - "170":"Predator", - "171":"Irradiated Alert", - "172":"Black Laminate", - "174":"BOOM", - "175":"Scorched", - "176":"Faded Zebra", - "177":"Memento", - "178":"Doomkitty", - "179":"Nuclear Threat", - "180":"Fire Serpent", - "181":"Corticera", - "182":"Emerald Dragon", - "183":"Overgrowth", - "184":"Corticera", - "185":"Golden Koi", - "186":"Wave Spray", - "187":"Zirka", - "188":"Graven", - "189":"Bright Water", - "190":"Black Limba", - "191":"Tempest", - "192":"Shattered", - "193":"Bone Pile", - "194":"Spitfire", - "195":"Demeter", - "196":"Emerald", - "197":"Anodized Navy", - "198":"Hazard", - "199":"Dry Season", - "200":"Mayan Dreams", - "201":"Palm", - "202":"Jungle DDPAT", - "203":"Rust Coat", - "204":"Mosaico", - "205":"Jungle", - "206":"Tornado", - "207":"Facets", - "208":"Sand Dune", - "209":"Groundwater", - "210":"Anodized Gunmetal", - "211":"Ocean Foam", - "212":"Graphite", - "213":"Ocean Foam", - "214":"Graphite", - "215":"X-Ray", - "216":"Blue Titanium", - "217":"Blood Tiger", - "218":"Hexane", - "219":"Hive", - "220":"Hemoglobin", - "221":"Serum", - "222":"Blood in the Water", - "223":"Nightshade", - "224":"Water Sigil", - "225":"Ghost Camo", - "226":"Blue Laminate", - "227":"Electric Hive", - "228":"Blind Spot", - "229":"Azure Zebra", - "230":"Steel Disruption", - "231":"Cobalt Disruption", - "232":"Crimson Web", - "233":"Tropical Storm", - "234":"Ash Wood", - "235":"VariCamo", - "236":"Night Ops", - "237":"Urban Rubble", - "238":"VariCamo Blue", - "240":"CaliCamo", - "241":"Hunting Blind", - "242":"Army Mesh", - "243":"Gator Mesh", - "244":"Teardown", - "245":"Army Recon", - "246":"Amber Fade", - "247":"Damascus Steel", - "248":"Red Quartz", - "249":"Cobalt Quartz", - "250":"Full Stop", - "251":"Pit Viper", - "252":"Silver Quartz", - "253":"Acid Fade", - "254":"Nitro", - "255":"Asiimov", - "256":"The Kraken", - "257":"Guardian", - "258":"Mehndi", - "259":"Redline", - "260":"Pulse", - "261":"Marina", - "262":"Rose Iron", - "263":"Rising Skull", - "264":"Sandstorm", - "265":"Kami", - "266":"Magma", - "267":"Cobalt Halftone", - "268":"Tread Plate", - "269":"The Fuschia Is Now", - "270":"Victoria", - "271":"Undertow", - "272":"Titanium Bit", - "273":"Heirloom", - "274":"Copper Galaxy", - "275":"Red FragCam", - "276":"Panther", - "277":"Stainless", - "278":"Blue Fissure", - "279":"Asiimov", - "280":"Chameleon", - "281":"Corporal", - "282":"Redline", - "283":"Trigon", - "284":"Heat", - "285":"Terrain", - "286":"Antique", - "287":"Pulse", - "288":"Sergeant", - "289":"Sandstorm", - "290":"Guardian", - "291":"Heaven Guard", - "293":"Death Rattle", - "294":"Green Apple", - "295":"Franklin", - "296":"Meteorite", - "297":"Tuxedo", - "298":"Army Sheen", - "299":"Caged Steel", - "300":"Emerald Pinstripe", - "301":"Atomic Alloy", - "302":"Vulcan", - "303":"Isaac", - "304":"Slashed", - "305":"Torque", - "306":"Antique", - "307":"Retribution", - "308":"Kami", - "309":"Howl", - "310":"Curse", - "311":"Desert Warfare", - "312":"Cyrex", - "313":"Orion", - "314":"Heaven Guard", - "315":"Poison Dart", - "316":"Jaguar", - "317":"Bratatat", - "318":"Road Rash", - "319":"Detour", - "320":"Red Python", - "321":"Master Piece", - "322":"Nitro", - "323":"Rust Coat", - "325":"Chalice", - "326":"Knight", - "327":"Chainmail", - "328":"Hand Cannon", - "329":"Dark Age", - "330":"Briar", - "332":"Royal Blue", - "333":"Indigo", - "334":"Twist", - "335":"Module", - "336":"Desert-Strike", - "337":"Tatter", - "338":"Pulse", - "339":"Caiman", - "340":"Jet Set", - "341":"First Class", - "342":"Leather", - "343":"Commuter", - "344":"Dragon Lore", - "345":"First Class", - "346":"Coach Class", - "347":"Pilot", - "348":"Red Leather", - "349":"Osiris", - "350":"Tigris", - "351":"Conspiracy", - "352":"Fowl Play", - "353":"Water Elemental", - "354":"Urban Hazard", - "355":"Desert-Strike", - "356":"Koi", - "357":"Ivory", - "358":"Supernova", - "359":"Asiimov", - "360":"Cyrex", - "361":"Abyss", - "362":"Labyrinth", - "363":"Traveler", - "364":"Business Class", - "365":"Olive Plaid", - "366":"Green Plaid", - "367":"Reactor", - "368":"Setting Sun", - "369":"Nuclear Waste", - "370":"Bone Machine", - "371":"Styx", - "372":"Nuclear Garden", - "373":"Contamination", - "374":"Toxic", - "375":"Radiation Hazard", - "376":"Chemical Green", - "377":"Hot Shot", - "378":"Fallout Warning", - "379":"Cerberus", - "380":"Wasteland Rebel", - "381":"Grinder", - "382":"Murky", - "383":"Basilisk", - "384":"Griffin", - "385":"Firestarter", - "386":"Dart", - "387":"Urban Hazard", - "388":"Cartel", - "389":"Fire Elemental", - "390":"Highwayman", - "391":"Cardiac", - "392":"Delusion", - "393":"Tranquility", - "394":"Cartel", - "395":"Man-o'-war", - "396":"Urban Shock", - "397":"Naga", - "398":"Chatterbox", - "399":"Catacombs", - "400":"龍王 (Dragon King)", - "401":"System Lock", - "402":"Malachite", - "403":"Deadly Poison", - "404":"Muertos", - "405":"Serenity", - "406":"Grotto", - "407":"Quicksilver", - "409":"Tiger Tooth", - "410":"Damascus Steel", - "411":"Damascus Steel", - "413":"Marble Fade", - "414":"Rust Coat", - "415":"Doppler", - "416":"Doppler", - "417":"Doppler", - "418":"Doppler", - "419":"Doppler", - "420":"Doppler", - "421":"Doppler", - "422":"Elite Build", - "423":"Armor Core", - "424":"Worm God", - "425":"Bronze Deco", - "426":"Valence", - "427":"Monkey Business", - "428":"Eco", - "429":"Djinn", - "430":"Hyper Beast", - "431":"Heat", - "432":"Man-o'-war", - "433":"Neon Rider", - "434":"Origami", - "435":"Pole Position", - "436":"Grand Prix", - "437":"Twilight Galaxy", - "438":"Chronos", - "439":"Hades", - "440":"Icarus Fell", - "441":"Minotaur's Labyrinth", - "442":"Asterion", - "443":"Pathfinder", - "444":"Daedalus", - "445":"Hot Rod", - "446":"Medusa", - "447":"Duelist", - "448":"Pandora's Box", - "449":"Poseidon", - "450":"Moon in Libra", - "451":"Sun in Leo", - "452":"Shipping Forecast", - "453":"Emerald", - "454":"Para Green", - "455":"Akihabara Accept", - "456":"Hydroponic", - "457":"Bamboo Print", - "458":"Bamboo Shadow", - "459":"Bamboo Forest", - "460":"Aqua Terrace", - "462":"Counter Terrace", - "463":"Terrace", - "464":"Neon Kimono", - "465":"Orange Kimono", - "466":"Crimson Kimono", - "467":"Mint Kimono", - "468":"Midnight Storm", - "469":"Sunset Storm 壱", - "470":"Sunset Storm 弐", - "471":"Daybreak", - "472":"Impact Drill", - "473":"Seabird", - "474":"Aquamarine Revenge", - "475":"Hyper Beast", - "476":"Yellow Jacket", - "477":"Neural Net", - "478":"Rocket Pop", - "479":"Bunsen Burner", - "480":"Evil Daimyo", - "481":"Nemesis", - "482":"Ruby Poison Dart", - "483":"Loudmouth", - "484":"Ranger", - "485":"Handgun", - "486":"Elite Build", - "487":"Cyrex", - "488":"Riot", - "489":"Torque", - "490":"Frontside Misty", - "491":"Dualing Dragons", - "492":"Survivor Z", - "493":"Flux", - "494":"Stone Cold", - "495":"Wraiths", - "496":"Nebula Crusader", - "497":"Golden Coil", - "498":"Rangeen", - "499":"Cobalt Core", - "500":"Special Delivery", - "501":"Wingshot", - "502":"Green Marine", - "503":"Big Iron", - "504":"Kill Confirmed", - "505":"Scumbria", - "506":"Point Disarray", - "507":"Ricochet", - "508":"Fuel Rod", - "509":"Corinthian", - "510":"Retrobution", - "511":"The Executioner", - "512":"Royal Paladin", - "514":"Power Loader", - "515":"Imperial", - "516":"Shapewood", - "517":"Yorick", - "518":"Outbreak", - "519":"Tiger Moth", - "520":"Avalanche", - "521":"Teclu Burner", - "522":"Fade", - "523":"Amber Fade", - "524":"Fuel Injector", - "525":"Elite Build", - "526":"Photic Zone", - "527":"Kumicho Dragon", - "528":"Cartel", - "529":"Valence", - "530":"Triumvirate", - "532":"Royal Legion", - "533":"The Battlestar", - "534":"Lapis Gator", - "535":"Praetorian", - "536":"Impire", - "537":"Hyper Beast", - "538":"Necropos", - "539":"Jambiya", - "540":"Lead Conduit", - "541":"Fleet Flock", - "542":"Judgement of Anubis", - "543":"Red Astor", - "544":"Ventilators", - "545":"Orange Crash", - "546":"Firefight", - "547":"Spectre", - "548":"Chantico's Fire", - "549":"Bioleak", - "550":"Oceanic", - "551":"Asiimov", - "552":"Fubar", - "553":"Atlas", - "554":"Ghost Crusader", - "555":"Re-Entry", - "556":"Primal Saber", - "557":"Black Tie", - "558":"Lore", - "559":"Lore", - "560":"Lore", - "561":"Lore", - "562":"Lore", - "563":"Black Laminate", - "564":"Black Laminate", - "565":"Black Laminate", - "566":"Black Laminate", - "567":"Black Laminate", - "568":"Gamma Doppler", - "569":"Gamma Doppler", - "570":"Gamma Doppler", - "571":"Gamma Doppler", - "572":"Gamma Doppler", - "573":"Autotronic", - "574":"Autotronic", - "575":"Autotronic", - "576":"Autotronic", - "577":"Autotronic", - "578":"Bright Water", - "579":"Bright Water", - "580":"Freehand", - "581":"Freehand", - "582":"Freehand", - "583":"Aristocrat", - "584":"Phobos", - "585":"Violent Daimyo", - "586":"Wasteland Rebel", - "587":"Mecha Industries", - "588":"Desolate Space", - "589":"Carnivore", - "590":"Exo", - "591":"Imperial Dragon", - "592":"Iron Clad", - "593":"Chopper", - "594":"Harvester", - "595":"Reboot", - "596":"Limelight", - "597":"Bloodsport", - "598":"Aerial", - "599":"Ice Cap", - "600":"Neon Revolution", - "601":"Syd Mead", - "602":"Imprint", - "603":"Directive", - "604":"Roll Cage", - "605":"Scumbria", - "606":"Ventilator", - "607":"Weasel", - "608":"Petroglyph", - "609":"Airlock", - "610":"Dazzle", - "611":"Grim", - "612":"Powercore", - "613":"Triarch", - "614":"Fuel Injector", - "615":"Briefing", - "616":"Slipstream", - "617":"Doppler", - "618":"Doppler", - "619":"Doppler", - "620":"Ultraviolet", - "621":"Ultraviolet", - "622":"Polymer", - "623":"Ironwork", - "624":"Dragonfire", - "625":"Royal Consorts", - "626":"Mecha Industries", - "627":"Cirrus", - "628":"Stinger", - "629":"Black Sand", - "630":"Sand Scale", - "631":"Flashback", - "632":"Buzz Kill", - "633":"Sonar", - "634":"Gila", - "635":"Turf", - "636":"Shallow Grave", - "637":"Cyrex", - "638":"Wasteland Princess", - "639":"Bloodsport", - "640":"Fever Dream", - "641":"Jungle Slipstream", - "642":"Blueprint", - "643":"Xiangliu", - "644":"Decimator", - "645":"Oxide Blaze", - "646":"Capillary", - "647":"Crimson Tsunami", - "648":"Emerald Poison Dart", - "649":"Akoben", - "650":"Ripple", - "651":"Last Dive", - "652":"Scaffold", - "653":"Neo-Noir", - "654":"Seasons", - "655":"Zander", - "656":"Orbit Mk01", - "657":"Blueprint", - "658":"Cobra Strike", - "659":"Macabre", - "660":"Hyper Beast", - "661":"Sugar Rush", - "662":"Oni Taiji", - "663":"Briefing", - "664":"Hellfire", - "665":"Aloha", - "666":"Hard Water", - "667":"Woodsman", - "668":"Red Rock", - "669":"Death Grip", - "670":"Death's Head", - "671":"Cut Out", - "672":"Metal Flowers", - "673":"Morris", - "674":"Triqua", - "675":"The Empress", - "676":"High Roller", - "677":"Hunter", - "678":"See Ya Later", - "679":"Goo", - "680":"Off World", - "681":"Leaded Glass", - "682":"Oceanic", - "683":"Llama Cannon", - "684":"Cracked Opal", - "685":"Jungle Slipstream", - "686":"Phantom", - "687":"Tacticat", - "688":"Exposure", - "689":"Ziggy", - "690":"Stymphalian", - "691":"Mortis", - "692":"Night Riot", - "693":"Flame Test", - "694":"Moonrise", - "695":"Neo-Noir", - "696":"Bloodsport", - "697":"Black Sand", - "698":"Lionfish", - "699":"Wild Six", - "700":"Urban Hazard", - "701":"Grip", - "702":"Aloha", - "703":"SWAG-7", - "704":"Arctic Wolf", - "705":"Cortex", - "706":"Oxide Blaze", - "707":"Neon Rider", - "708":"Amber Slipstream", - "709":"Eco", - "710":"Shred", - "711":"Code Red", - "712":"High Seas", - "713":"Warhawk", - "714":"Nightmare", - "715":"Capillary", - "716":"Toy Soldier", - "717":"Traction", - "718":"PAW", - "719":"Powercore", - "720":"Devourer", - "721":"Survivalist", - "722":"Snek-9", - "723":"Eye of Athena", - "735":"Night Stripe", - "747":"Twin Turbo", - "748":"Calf Skin", - "749":"Vino Primo", - "750":"Integrale", - "751":"Hand Brake", - "752":"Fade", - "753":"Dirt Drop", - "754":"Rust Coat", - "755":"Slide", - "775":"Facility Sketch", - "776":"Facility Negative", - "777":"Facility Draft", - "778":"Facility Dark", - "779":"Random Access", - "780":"Mainframe", - "781":"Co-Processor", - "782":"Motherboard", - "783":"Bulkhead", - "784":"Coolant", - "785":"Mandrel", - "786":"Exchanger", - "787":"Core Breach", - "788":"Acheron", - "789":"Nuclear Garden", - "790":"Cold Fusion", - "791":"Remote Control", - "792":"Control Panel", - "793":"Converter", - "794":"Sweeper", - "795":"Safety Net", - "796":"Check Engine", - "797":"Brake Light", - "798":"Nitro", - "799":"High Beam", - "800":"Lab Rats", - "801":"Asiimov", - "802":"Momentum", - "803":"Neo-Noir", - "804":"Modest Threat", - "805":"Mecha Industries", - "806":"Scavenger", - "807":"Signal", - "808":"Oxide Blaze", - "809":"Wood Fired", - "810":"Phosphor", - "811":"Magnesium", - "812":"Pipe Down", - "813":"Nevermore", - "814":"Black Sand", - "815":"Danger Close", - "816":"Fubar", - "817":"Flashback", - "10006":"Charred", - "10007":"Snakebite", - "10008":"Bronzed", - "10009":"Leather", - "10010":"Spruce DDPAT", - "10013":"Lunar Weave", - "10015":"Convoy", - "10016":"Crimson Weave", - "10018":"Superconductor", - "10019":"Arid", - "10021":"Slaughter", - "10024":"Eclipse", - "10026":"Spearmint", - "10027":"Boom!", - "10028":"Cool Mint", - "10030":"Forest DDPAT", - "10033":"Crimson Kimono", - "10034":"Emerald Web", - "10035":"Foundation", - "10036":"Badlands", - "10037":"Pandora's Box", - "10038":"Hedge Maze", - "10039":"Guerrilla", - "10040":"Diamondback", - "10041":"King Snake", - "10042":"Imperial Plaid", - "10043":"Overtake", - "10044":"Racing Green", - "10045":"Amphibious", - "10046":"Bronze Morph", - "10047":"Omega", - "10048":"Vice", - "10049":"POW!", - "10050":"Turtle", - "10051":"Transport", - "10052":"Polygon", - "10053":"Cobalt Skulls", - "10054":"Overprint", - "10055":"Duct Tape", - "10056":"Arboreal", - "10057":"Emerald", - "10058":"Mangrove", - "10059":"Rattler", - "10060":"Case Hardened", - "10061":"Crimson Web", - "10062":"Buckshot", - "10063":"Fade", - "10064":"Mogul" -} - marbles = { "Karambit":{ "3":"FFI", @@ -2154,4 +1412,4 @@ "20123":"Pinups Sticker Capsule", "20124":"Slid3 Sticker Capsule", "20125":"Team Roles Sticker Capsule" -} +} \ No newline at end of file diff --git a/csgo_worker.py b/skinstats/csgo_worker.py similarity index 98% rename from csgo_worker.py rename to skinstats/csgo_worker.py index 34b26c7..501b803 100644 --- a/csgo_worker.py +++ b/skinstats/csgo_worker.py @@ -7,10 +7,13 @@ import json import sqlite3 from typing import Tuple +import requests LOG = logging.getLogger("CSGO Worker") +const.skins = requests.get('http://skin_ids:5001/get_skin_ids').json() + class CSGOWorker(object): def __init__(self): diff --git a/requirements.txt b/skinstats/requirements.txt similarity index 79% rename from requirements.txt rename to skinstats/requirements.txt index b4e5084..f0b646a 100644 --- a/requirements.txt +++ b/skinstats/requirements.txt @@ -1,4 +1,4 @@ Flask gevent steam -csgo +csgo \ No newline at end of file diff --git a/skinstats.py b/skinstats/skinstats.py similarity index 99% rename from skinstats.py rename to skinstats/skinstats.py index d9fdbeb..d888886 100644 --- a/skinstats.py +++ b/skinstats/skinstats.py @@ -94,4 +94,4 @@ def ping() -> str: http_server.serve_forever() except KeyboardInterrupt: LOG.info("Exit requested") - worker.close() + worker.close() \ No newline at end of file diff --git a/static/css/styles.css b/skinstats/static/css/styles.css similarity index 100% rename from static/css/styles.css rename to skinstats/static/css/styles.css diff --git a/static/index.html b/skinstats/static/index.html similarity index 100% rename from static/index.html rename to skinstats/static/index.html diff --git a/static/js/post.js b/skinstats/static/js/post.js similarity index 100% rename from static/js/post.js rename to skinstats/static/js/post.js From 90501d0e679de5fa7e1b9521e75703f3553224cc Mon Sep 17 00:00:00 2001 From: Matthew Berry Date: Sun, 7 Apr 2019 23:07:51 -0400 Subject: [PATCH 2/3] added newlines --- docker-compose.yml | 2 +- skin_ids/Dockerfile | 2 +- skinstats/Dockerfile | 2 +- skinstats/const.py | 2 +- skinstats/skinstats.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8f0796b..4c0a178 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,4 +17,4 @@ services: test: wget -qO - skin_ids:5001/get_skin_ids > /dev/null || exit 1 interval: 0s timeout: 1s - retries: 300 \ No newline at end of file + retries: 300 diff --git a/skin_ids/Dockerfile b/skin_ids/Dockerfile index 8551685..ef3435e 100644 --- a/skin_ids/Dockerfile +++ b/skin_ids/Dockerfile @@ -33,4 +33,4 @@ COPY . . RUN pip3 install --user --no-cache-dir -r requirements.txt -CMD [ "python3", "main.py" ] \ No newline at end of file +CMD [ "python3", "main.py" ] diff --git a/skinstats/Dockerfile b/skinstats/Dockerfile index 9fbec2a..42b9f43 100644 --- a/skinstats/Dockerfile +++ b/skinstats/Dockerfile @@ -6,4 +6,4 @@ COPY . . RUN pip install --no-cache-dir -r requirements.txt -CMD [ "python", "./skinstats.py" ] \ No newline at end of file +CMD [ "python", "./skinstats.py" ] diff --git a/skinstats/const.py b/skinstats/const.py index e742b16..c69b8e6 100644 --- a/skinstats/const.py +++ b/skinstats/const.py @@ -1412,4 +1412,4 @@ "20123":"Pinups Sticker Capsule", "20124":"Slid3 Sticker Capsule", "20125":"Team Roles Sticker Capsule" -} \ No newline at end of file +} diff --git a/skinstats/skinstats.py b/skinstats/skinstats.py index d888886..d9fdbeb 100644 --- a/skinstats/skinstats.py +++ b/skinstats/skinstats.py @@ -94,4 +94,4 @@ def ping() -> str: http_server.serve_forever() except KeyboardInterrupt: LOG.info("Exit requested") - worker.close() \ No newline at end of file + worker.close() From 8766105a560edb2973eff71a126efadc2530ba6d Mon Sep 17 00:00:00 2001 From: Matthew Berry Date: Wed, 24 Jun 2020 15:02:27 -0700 Subject: [PATCH 3/3] updated to support new versions of steam and csgo --- skinstats/csgo_worker.py | 4 ++-- skinstats/requirements.txt | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/skinstats/csgo_worker.py b/skinstats/csgo_worker.py index 501b803..e350674 100644 --- a/skinstats/csgo_worker.py +++ b/skinstats/csgo_worker.py @@ -1,6 +1,6 @@ import logging -from steam import SteamClient -from csgo import CSGOClient +from steam.client import SteamClient +from csgo.client import CSGOClient from csgo.enums import ECsgoGCMsg import struct import const diff --git a/skinstats/requirements.txt b/skinstats/requirements.txt index f0b646a..f24c88b 100644 --- a/skinstats/requirements.txt +++ b/skinstats/requirements.txt @@ -1,4 +1,3 @@ Flask -gevent -steam -csgo \ No newline at end of file +steam[client] +csgo