bumped: 0.1.3 reformatted code and cleanup

This commit is contained in:
Kaley, Fischer 2024-10-06 23:23:52 +02:00
parent ede3b04552
commit b0afcafb5b
7 changed files with 1170 additions and 166 deletions

View file

@ -1,6 +1,6 @@
pkgname=stc-git pkgname=stc-git
_gitname=stc _gitname=stc
pkgver=0.1.2 pkgver=0.1.3
pkgrel=1 pkgrel=1
pkgdesc="Easily download collections and mods from steam." pkgdesc="Easily download collections and mods from steam."
url="https://github.com/DRAGONTOS/stc" url="https://github.com/DRAGONTOS/stc"

10
assets/ids.txt Normal file
View file

@ -0,0 +1,10 @@
+workshop_download_item 244850 2710575211 \
+workshop_download_item 244850 2742890728 \
+workshop_download_item 244850 2779162581 \
+workshop_download_item 244850 2949388346 \
+workshop_download_item 244850 2821153519 \
+workshop_download_item 244850 3171146773 \
+workshop_download_item 244850 3318269325 \
+workshop_download_item 244850 3342484040 \
+workshop_download_item 244850 2657577202 \
+quit

1034
assets/sources.html Normal file

File diff suppressed because it is too large Load diff

35
ids.txt
View file

@ -1,35 +0,0 @@
+workshop_download_item 294100 2275310562 \
+workshop_download_item 294100 2662457442 \
+workshop_download_item 294100 2873235836 \
+workshop_download_item 294100 2068281501 \
+workshop_download_item 294100 2893572291 \
+workshop_download_item 294100 2748834409 \
+workshop_download_item 294100 2777098392 \
+workshop_download_item 294100 1635901197 \
+workshop_download_item 294100 2816938779 \
+workshop_download_item 294100 3302079637 \
+workshop_download_item 294100 2877292196 \
+workshop_download_item 294100 2944488802 \
+workshop_download_item 294100 3228047321 \
+workshop_download_item 294100 2475965842 \
+workshop_download_item 294100 3302328100 \
+workshop_download_item 294100 2610120706 \
+workshop_download_item 294100 2917732219 \
+workshop_download_item 294100 2865361569 \
+workshop_download_item 294100 3061095040 \
+workshop_download_item 294100 2989238251 \
+workshop_download_item 294100 2888638004 \
+workshop_download_item 294100 2850840457 \
+workshop_download_item 294100 3272822831 \
+workshop_download_item 294100 2016436324 \
+workshop_download_item 294100 3276562906 \
+workshop_download_item 294100 1677616980 \
+workshop_download_item 294100 2937674636 \
+workshop_download_item 294100 1446523594 \
+workshop_download_item 294100 1508850027 \
+workshop_download_item 294100 1569605867 \
+workshop_download_item 294100 3266720501 \
+workshop_download_item 294100 1678847247 \
+workshop_download_item 294100 2775017012 \
+workshop_download_item 294100 2853407446 \
+quit

View file

@ -1,3 +1,3 @@
{ {
"version": "0.1.2" "version": "0.1.3"
} }

View file

@ -1,3 +1,5 @@
#include "includes/getHttp.h"
#include "regex"
#include <cctype> #include <cctype>
#include <cpptoml.h> #include <cpptoml.h>
#include <cstdio> #include <cstdio>
@ -5,11 +7,9 @@
#include <cstring> #include <cstring>
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include "includes/getHttp.h"
#include <ios> #include <ios>
#include <iostream> #include <iostream>
#include <ostream> #include <ostream>
#include "regex"
#include <string> #include <string>
std::string woof(std::ifstream &meow) { std::string woof(std::ifstream &meow) {
@ -24,10 +24,6 @@ LISTING COMMANDS:
-m: Install a specific mod. -m: Install a specific mod.
)#"; )#";
// strings are kinda broken
const std::string invalidvalue = "Invalid value in config: \n";
const std::string invalidconfig = "Not a valid config: \n";
int main(int argc, char **argv, char **envp) { int main(int argc, char **argv, char **envp) {
// need some cleaning in the future ata // need some cleaning in the future ata
@ -88,8 +84,7 @@ int main(int argc, char **argv, char **envp) {
try { try {
getHttp(std::string{"https://steamcommunity.com/sharedfiles/filedetails/?id=" + collectionid}, &cachesc); getHttp(std::string{"https://steamcommunity.com/sharedfiles/filedetails/?id=" + collectionid}, &cachesc);
} } catch (std::string &meow) {
catch(std::string& meow) {
std::cout << meow; std::cout << meow;
return 1; return 1;
} }
@ -109,8 +104,7 @@ int main(int argc, char **argv, char **envp) {
try { try {
getHttp(std::string{"https://steamcommunity.com/sharedfiles/filedetails/?id=" + collectionid}, &cachesc); getHttp(std::string{"https://steamcommunity.com/sharedfiles/filedetails/?id=" + collectionid}, &cachesc);
} } catch (std::string &meow) {
catch(std::string& meow) {
std::cout << meow; std::cout << meow;
return 1; return 1;
} }
@ -188,7 +182,8 @@ int main(int argc, char **argv, char **envp) {
// Process each line // Process each line
while (std::getline(inputFile, line)) { while (std::getline(inputFile, line)) {
//grep-like behavior (only process lines containing the pattern with two spaces) // grep-like behavior (only process lines containing the pattern with two
// spaces)
if (std::regex_search(line, grepRegex)) { if (std::regex_search(line, grepRegex)) {
// sed 's/"><div class=.*//' // sed 's/"><div class=.*//'
@ -224,11 +219,11 @@ int main(int argc, char **argv, char **envp) {
// main command // main command
system(std::string{"sh ~/Steam/steamcmd.sh +force_install_dir " + dir + " +login " + user + pass + wpd + " +quit"}.c_str()); system(std::string{"sh ~/Steam/steamcmd.sh +force_install_dir " + dir + " +login " + user + pass + wpd + " +quit"}.c_str());
return 1; return 1;
} }
// main command // main command
std::ifstream ids{cacheid}; std::ifstream ids{cacheid};
system(std::string{"sh ~/Steam/steamcmd.sh +force_install_dir " + dir + " +login " + user + pass + R"( \ )" + woof(ids)}.c_str()); system(std::string{"sh ~/Steam/steamcmd.sh +force_install_dir " + dir + " +login " + user + pass + R"( \ )" + woof(ids)}.c_str());
return 1;
} }