Last active
December 2, 2020 20:44
-
-
Save treeherder/f909dcab32dc20643c77a71716a65746 to your computer and use it in GitHub Desktop.
first draft of a tool for working on steam workshop mods without having to sort through them by hand.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob, argparse, re | |
from collections import Counter | |
from pathlib import Path | |
class Mod_Checker: | |
def __init__(self): | |
arg_par = argparse.ArgumentParser(description='Print the names and corresponding file paths for mods in your workshop folder.') | |
arg_par.add_argument('path', metavar='P', type=str, | |
help='The filepath of the desired workshop folder.') | |
arg_par.add_argument('--name', dest='term', type=str, help='Search mods by name or partial match.') | |
arg_par.add_argument('--server', dest='dest_path', type=str, help='The directory where the dayz server runs.') | |
self.args = arg_par.parse_args() | |
realpath = Path(self.args.path) | |
self.metafiles = realpath.glob('**/meta.cpp') | |
self.list_of_mods = [] | |
def search_mod_names_and_IDs(self): | |
for metafile in self.metafiles: | |
with open(str.format('{0}', metafile)) as metacpp: | |
lines = metacpp.readlines() | |
workshop_ID = lines[1].split(';')[0].split('=')[-1] | |
workshop_name = lines[2].split(';')[0].split('=')[-1] | |
mod_listing = {'name':workshop_name, 'id':workshop_ID} | |
self.list_of_mods.append(mod_listing) | |
def query_list(self): | |
self.search_mod_names_and_IDs() | |
all_installed_mods = {item['name']:item['id'] for item in self.list_of_mods} | |
if self.args.term: | |
for mod_metas in all_installed_mods.items(): | |
if self.args.term.lower() in mod_metas[0].lower(): | |
print(mod_metas) | |
m = Mod_Checker() | |
m.query_list() | |
# E:/SteamLibrary/steamapps/workshop/content/221100/ | |
#change path to point from SteamLibrary directory level | |
#todo: create pipeline for checking upadates and moving / renaming files to the game server directory | |
#allow selection of mod from list returned by term search? | |
# flag for copying files | |
# copy keys | |
# daemon mode? | |
# --> | |
#find workshop files by searching the extant mod folders in the server directory | |
C:\Users\Jane\Documents\dayz_server\deerisle>python find_mods.py "E:\SteamLibrary\steamapps\workshop\content\221100" --name sunnyvale
(' "Sunnyvale_Helicopters"', ' 2061631929')
(' "Sunnyvale_Fix"', ' 2142595672')
(' "Sunnyvale_Original"', ' 2167664405')
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
treeherder@SWEETNESS:/mnt/e$ python3 search_mods.py /mnt/e/SteamLibrary/steamapps/workshop/content/221100/$UNT$ "', ' 1563811199')
(' "CF"', ' 1559212036')
(' "WeaponReduxPack"', ' 1559317235')
(' "Unlimited Stamina"', ' 1560819773')
(' "Classic Names & Descriptions - No
(' "Community-Online-Tools"', ' 1564026768')
(' "BuilderItems"', ' 1565871491')
(' "Mass'sManyItemOverhaul"', ' 1566911166')
(' "KillFeed"', ' 1567872567')
(' "DisableBaseDestruction"', ' 1571965849')
(' "InventoryPlus"', ' 1572541337')
(' "BadgerBuildings"', ' 1573788098')
(' "BuildAnywhere"', ' 1574054508')
(' "BaseBuildingLogs"', ' 1576057168')
(' "MosinScope"', ' 1579016654')
(' "PartyMe"', ' 1582671564')
(' "ZomBerry Admin Tools"', ' 1582756848')
(' "SQUAD MSF-C"', ' 1583941197')
(' "DayZ-Expansion-Notifications"', ' 1585487785')
(' "Trader"', ' 1590841260')
(' "DeerIsle"', ' 1602372402')
(' "FIDOv PACK 4"', ' 1605653648')
(' "Gold Nuggets"', ' 1607030682')
(' "NewNVG"', ' 1609266386')
(' "TweakRaidTools"', ' 1611450782')
(' "OP_BaseItems"', ' 1617874376')
(' "Modern's Drink Pack"', ' 1619208263')
(' "VanillaPlusPlusMap"', ' 1623711988')
(' "Cl0ud's Military Gear"', ' 1630943713')
(' "Summer_Chernarus"', ' 1644467354')
(' "Code Lock"', ' 1646187754')
(' "GoreZ"', ' 1648967877')
(' "More Wolves"', ' 1655899239')
(' "MoreGuns"', ' 1665663702')
(' "Modern's Weapon Pack"', ' 1667906095')
(' "SkinInfected"', ' 1668199233')
(' "Dystopia Server Mod"', ' 1671313616')
(' "Camosplus"', ' 1677796889')
(' "Server_Information_Panel"', ' 1680019590')
(' "VPPNotifications"', ' 1680673106')
(' "dbo_surfaces"', ' 1688306459')
(' "CPBWeapons"', ' 1705066179')
(' "RaidBuff"', ' 1705741403')
(' "VPPAdminTools"', ' 1708571078')
(' "Infected Wolf"', ' 1709502410')
(' "BaseBuildingPlus"', ' 1710977250')
(' "BulletStacksPlusPlus"', ' 1711179264')
(' "CheckPulse"', ' 1713355959')
(' "DisableGardenPlots"', ' 1719445243')
(' "BountyHunter"', ' 1724127494')
(' "MunghardsItempack"', ' 1734713776')
(' "NoVehicleDamage"', ' 1735947752')
(' "Saline Bag+"', ' 1736675168')
(' "ItemCollisionNerf"', ' 1739822459')
(' "BetterSuppressors"', ' 1748044748')
(' "TimeDestruction"', ' 1751210247')
(' "ToxicZone"', ' 1752669393')
(' "NoTentFenceOrWatchtowerCollisions"', ' 1753551799')
(' "Merky's_ItemPlusRevamp"', ' 1765820940')
(' "NoPaperLitter"', ' 1772487183')
(' "CJ187_Drinks_Food"', ' 1775478803')
(' "SIX-DayZ-Auto-Run"', ' 1781132597')
(' "No Shoe Damage"', ' 1782854982')
(' "Dayz Navigation"', ' 1791033033')
(' "[Remastered] Arma Weapon Pack"', ' 1793351435')
(' "WindstridesClothingPack"', ' 1797720064')
(' "CheckIdentity"', ' 1813296260')
(' "Simple Base"', ' 1814422822')
(' "PaunaesClothes"', ' 1815107281')
(' "[CrSk] VAZ-2107"', ' 1818957231')
(' "Ear-Plugs"', ' 1819514788')
(' "Cheytac M200 from ArmA 2 Port"', ' 1819921337')
(' "Gerphelius Zil-130"', ' 1826872082')
(' "Breachingcharge"', ' 1827241477')
(' "Close/Open Anywhere"', ' 1830634513')
(' "Airdrop"', ' 1831039845')
(' "FlipTransport"', ' 1832448183')
(' "Banking"', ' 1836257061')
(' "PSR2_NewZombie_Pack"', ' 1838477746')
(' "Base Furniture Mods 2.0"', ' 1847114006')
(' "Base Fortifications"', ' 1849039435')
(' "Zeroy-FishingZ"', ' 1850623448')
(' "(WIP) TrailBrozer SUV"', ' 1856309515')
(' "DayZ Humanity"', ' 1859688689')
(' "Docs_Weapon_Pack_Standalone"', ' 1864482799')
(' "CreepyZombies"', ' 1866298408')
(' "[CrSk] BMW 525i E34"', ' 1869021368')
(' "Base_Storage"', ' 1870357551')
(' "Airdrop-Upgraded"', ' 1870524790')
(' "RaG_Hummer_Refresh"', ' 1879540249')
(' "The-Hideout-Server-Pack"', ' 1884464693')
(' "Bounty_fix"', ' 1889481910')
(' "Freaks of Nature"', ' 1892283821')
(' "Atv_mung"', ' 1892412278')
(' "yRun_Pack1"', ' 1893949404')
(' "Kamaz_Truck"', ' 1895398348')
(' "[VPP]DeathMatch"', ' 1898004795')
(' "GetShredded"', ' 1904356380')
(' "IRP-Land-Rover-Defender-110"', ' 1912237302')
(' "Sibka"', ' 1913998107')
(' "Tweaks Items Pack"', ' 1920236921')
(' "BreachingchargeBaseBuildingPlus"', ' 1920610398')
(' "DayZ-Expansion-Chat"', ' 1927567004')
(' "dbo_surfaces_bliss"', ' 1928118716')
(' "CannabisPlus"', ' 1932611410')
(' "Plus200_Mining"', ' 1939591537')
(' "Better Inspect"', ' 1940434090')
(' "Specialist Weapon Pack"', ' 1945945241')
(' "Modular Vest System"', ' 1962144102')
(' "Lightsword"', ' 1964490092')
(' "yRun_SA"', ' 1969492570')
(' "1966_Ford_Mustang"', ' 1971972993')
(' "Dark_Wolf"', ' 1972696165')
(' "SunnyvaleServer"', ' 1977822263')
(' "Milkacow"', ' 1979612763')
(' "Devils Dandruff"', ' 1982323784')
(' "Cl0ud's Military Gear Expansion"', ' 2000606064')
(' "zSpawnSelection"', ' 2017605880')
(' "Animal-Pack"', ' 2021106568')
(' "Sunnyvale_UI"', ' 2041861539')
(' "PartyLayout"', ' 2047925101')
(' "MoreGuns_Test"', ' 2061674116')
(' "ChernarusRP AE86"', ' 2064965521')
(' "SchanaModCompass"', ' 2067834152')
(' "ENDZONEMOD"', ' 2080827170')
(' "EVTest"', ' 2093011129')
(' "Anarchy_Isle"', ' 2094135526')
(' "DayZ-Expansion"', ' 2116151222')
(' "DayZ-Expansion-Licensed"', ' 2116157322')