Skip to content

Commit aa03f88

Browse files
committed
first release
1 parent 4997356 commit aa03f88

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

README.txt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Welcome to PySteamTimes! This program is meant to take all your games from Steam,
2+
put them in Excel, and then search HowLongToBeat.com for all of your games and put in
3+
the times. I've written this README as if the user has zero experience with command
4+
line instructions. If that's you, don't worry! This shouldn't be too involved.
5+
If you have ideas for features, please contact me on Discord at TM#7221.
6+
7+
18
Libraries needed:
29
- aiohttp
310
- requests
@@ -22,7 +29,7 @@ cd [file path]
2229

2330
You can get your file path by clicking on the bar to the left of the search bar in File Explorer.
2431
For example:
25-
cd C:\Users\Admin\Documents\PySteamTimer
32+
cd C:\Users\Admin\Documents\PySteamTimes
2633

2734
Once in the folder, run the following command:
2835
python importSteam.py
@@ -81,11 +88,11 @@ Many Steam App IDs in a row are not found.
8188

8289
The game was not found on HowLongToBeat.
8390

84-
- Most likely, the game name isn't exactly what it should be. If the program searches for "[Game] Definitive Edition"
91+
- Most likely, the game name isn't exactly what it should be. If the program searches for "[Game] Definitive Edition"
8592
it won't find "[Game]". This is an unfortunate quirk of HLTB's own search API. You will need to go into Excel and edit
86-
the name of the game if the cell in the time column specifies it was not found in HLTB's database. It is also possible that
87-
HLTB does not have any record of the game whatsoever. If the hours are set to 0, HLTB correctly found the game in its
88-
database, but simply does not have any data on it.
93+
the name of the game if the cell in the time column specifies it was not found in HLTB's database. It is also possible
94+
that HLTB does not have any record of the game's existence whatsoever. If the hours are set to 0, HLTB correctly found
95+
the game in its database, but simply does not have any completion data on it.
8996

9097
Other reasons this may occur:
9198

@@ -98,8 +105,7 @@ Other reasons this may occur:
98105
My Excel file was corrupted.
99106
- Open Excel, go to File -> Open -> Browse. Single-click on SteamGames.xlsx, and navigate to the Open button on the
100107
bottom right. Click the down arrow next to Open, click Open and Repair, Extract Data, Convert to Values. Finally,
101-
go back to File -> Save As, and save the file as SteamGames.xlsx. You may have to change the drop down below the
102-
file name from .xls to .xlsx. After that, you can rerun the export script.
108+
go back to File -> Save As, and save the file. After that, you can rerun the export script.
103109

104110
My error isn't listed here.
105111
- Please try running the script again. Sometimes there are weird errors that I can't reproduce and disappear on the

importSteam.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import time
22
import steamfront
3+
import sys
34
#credit: https://github.com/4Kaylum/Steamfront
45
from openpyxl import Workbook
56

@@ -14,9 +15,14 @@
1415

1516
def appIDList(games):
1617
IDList = []
17-
for i in games:
18-
IDList.append(i.appid)
18+
try:
19+
for i in games:
20+
IDList.append(i.appid)
21+
except:
22+
print("Internet connection required.")
23+
sys.exit()
1924
return IDList
25+
2026

2127
def gameNameList(IDList):
2228
games = []
@@ -75,6 +81,7 @@ def doctorOutput(gameList):
7581
i = i.replace("®","")
7682
i = i.replace("–", "-") #en dash
7783
i = i.replace("—", "-") #em dash
84+
i = i.replace(" - ", " ")
7885
i = i.replace("’", "'")
7986

8087
string = ""
@@ -102,8 +109,6 @@ def main():
102109
user = steamClient.getUser(id64=steamID64)
103110
games = user.apps #list of <steamfront.userapp.UserApp object at 0x00000XXXXXXXXX>
104111
IDList = appIDList(games)
105-
time = round(len(IDList) * waitTime / 60 + (len(IDList)/60/2.5), 1) #roughly 2.5 queries/second at max speed
106-
print("This process is expected to take roughly", time, "minutes.")
107112
gameList = gameNameList(IDList)
108113
doctoredList = doctorOutput(gameList)
109114
exportToExcel(doctoredList)

returnQuery.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def findFile():
2222
print("Multiple .xlsx files detected:")
2323
for i in range(0,len(excelFilesinDir)):
2424
print(i+1, " ", excelFilesinDir[i])
25+
print("If your list contains a file with ~$[file] as its name, please save and close Excel, this is a temporary file.")
2526
x = input("Enter the listed number of the one you would like to use.\n")
2627
try:
2728
x = int(x)
@@ -172,3 +173,13 @@ def searchforGame(name):
172173
else:
173174
print(name, "NOT found. Check the README file for reasons this may be.")
174175
return None
176+
177+
class returnQuery():
178+
179+
def main():
180+
print("This file is not meant to be run. Please refer to the README.")
181+
return 0
182+
183+
if __name__ == "__main__":
184+
main()
185+

0 commit comments

Comments
 (0)