Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/steamsales/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
id: steamsales
name: Steam Sales
summary: Displays current Steam sales
desc: Shows your steam's app sales, and wishlists
author: noahpodgurski
fileName: steamsales.star
packageName: steamsales
recommended_interval: 5
Binary file added apps/steamsales/steamsales.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
176 changes: 176 additions & 0 deletions apps/steamsales/steamsales.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
load("http.star", "http")
load("render.star", "render")
load("schema.star", "schema")
load("time.star", "time")

# Your specific Game Info
DATES_URL = "https://partner.steam-api.com/IPartnerFinancialsService/GetChangedDatesForPartner/v001/"
SALES_URL = "https://partner.steam-api.com/IPartnerFinancialsService/GetDetailedSales/v001/"
WISHLIST_URL = "https://partner.steam-api.com/IPartnerFinancialsService/GetAppWishlistReporting/v001/"

def main(config):
salesData = []
wishlistData = []

today = time.now().format("2000-01-01")
Comment thread
noahpodgurski marked this conversation as resolved.
Outdated

game_name = config.get("game_name", "Your Game")
api_key = config.get("api_key")
app_id = config.get("app_id")
if not api_key:
return render.Root(
child = render.Column(
expanded = True,
main_align = "space_around",
cross_align = "center",
children = [
render.Text("set api key", color="#ffaa00", font="6x10"),
render.Row(
children = [
render.Text("Sales: ", color="#fff"),
render.Text(str(0), color="#00ff00"),
]
),
render.Row(
children = [
render.Text("Wishlists: ", color="#fff"),
render.Text(str(0), color="#00aaff"),
]
),
],
)
)
if not app_id:
return render.Root(
child = render.Column(
expanded = True,
main_align = "space_around",
cross_align = "center",
children = [
render.Text("set app id", color="#ffaa00", font="6x10"),
render.Row(
children = [
render.Text("0: ", color="#fff"),
Comment thread
noahpodgurski marked this conversation as resolved.
Outdated
render.Text(str(sales), color="#00ff00"),
Comment thread
noahpodgurski marked this conversation as resolved.
Outdated
]
),
render.Row(
children = [
render.Text("Wishlists: ", color="#fff"),
render.Text(str(0), color="#00aaff"),
]
),
],
)
)

# get total sales
# res = http.get(DATES_URL, params={"key": api_key, "highwatermark": "0"})
# if res.status_code != 200:
# return render.Root(
# child = render.WrappedText("Error fetching Steam data 1")
# )

# data = res.json()["response"]
# available_dates = data["dates"] if "dates" in data else []
# if not available_dates:
# return render.Root(
# child = render.WrappedText("No available dates for sales data")
# )

# for date in available_dates:
# print("Available date:", date)

# params={
# "key": api_key,
# "appid": app_id,
# "date": date,
# "highwatermark_id": "0",
# }
# print("sending", params)
# res = http.get(SALES_URL, params=params)
# if res.status_code == 200:
# data = res.json()["response"]
# print(data)
# for result in data["results"]:
# salesData.append(result)
Comment thread
noahpodgurski marked this conversation as resolved.
Outdated

params={
"key": api_key,
"appid": app_id,
"date": today,
"highwatermark_id": "0",
}
res = http.get(SALES_URL, params=params)
Comment thread
noahpodgurski marked this conversation as resolved.
Outdated
if res.status_code == 200:
data = res.json()["response"]
for result in data.get("results", []):
salesData.append(result)

params={
"key": api_key,
"appid": app_id,
"date": today,
}
res = http.get(WISHLIST_URL, params=params)
Comment thread
noahpodgurski marked this conversation as resolved.
Outdated
if res.status_code == 200:
data = res.json()["response"]
for result in data.get("results", []):
wishlistData.append(result)

sales = 0
wishlistAdds = 0
for sale in salesData:
print("Sales data:", sale)
Comment thread
noahpodgurski marked this conversation as resolved.
Outdated
sales += sale.get("gross_units_sold", 0)
for wishlist in wishlistData:
print("Wishlist data:", wishlist)
Comment thread
noahpodgurski marked this conversation as resolved.
Outdated
wishlistAdds += wishlist.get("wishlist_summary", {}).get("wishlist_adds", 0)

return render.Root(
child = render.Column(
expanded = True,
main_align = "space_around",
cross_align = "center",
children = [
render.Text(game_name, color="#ffaa00", font="6x10"),
render.Row(
children = [
render.Text("Sales: ", color="#fff"),
render.Text(str(sales), color="#00ff00"),
]
),
render.Row(
children = [
render.Text("Wishlists: ", color="#fff"),
render.Text(str(wishlistAdds), color="#00aaff"),
]
),
],
)
)

def get_schema():
return schema.Schema(
version = "1",
fields = [
schema.Text(
id = "game_name",
name = "Game Name",
desc = "The name of your game",
icon = "gamepad",
),
schema.Text(
id = "api_key",
name = "Steam Partner API Key",
desc = "Your IPartnerFinancialsService compatible key",
icon = "key",
),
Comment thread
noahpodgurski marked this conversation as resolved.
schema.Text(
id = "app_id",
name = "Steam App ID",
desc = "The App ID of your game on Steam",
icon = "gamepad",
)
],
)
Loading