Skip to content
This repository was archived by the owner on Oct 28, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
idlemaster.log
settings.txt
7 changes: 4 additions & 3 deletions Releases/Linux/Linux-readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ In the spirit of open source and free software there are no Linux binaries provi
The script needs these Python 2 packages to run:
requests
beautifulsoup4
pillow (with jpeg and tk support)
colorama
gtk2
notify

Examples for packages that meet the dependencies:
Ubuntu: python-bs4, python-requests, python-pil.imagetk, python-colorama
Arch Linux: python2-beautifulsoup4, python2-requests, python2-pillow, tk, python2-colorama
Ubuntu: python-bs4 python-requests python-colorama python-gtk2 python-notify
Arch Linux: python2-beautifulsoup4 python2-requests python2-pillow python2-colorama pygtk python2-notify
4 changes: 0 additions & 4 deletions Releases/Linux/settings.txt

This file was deleted.

6 changes: 6 additions & 0 deletions Releases/Linux/settings.txt.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sessionid = ""
steamId = "your-account"
steamLogin = ""
steamLoginSecure = ""
steamparental = ""
sort = ""
44 changes: 30 additions & 14 deletions Releases/Linux/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,42 @@
authData["steamparental"]=""
authData["hasPlayTime"]="false"
execfile("./settings.txt",authData)
myProfileURL = "http://steamcommunity.com/profiles/"+authData["steamLogin"][:17]
myProfileURL = "https://steamcommunity.com/id/"+authData["steamId"]
except:
logging.warning(Fore.RED + "Error loading config file" + Fore.RESET)
raw_input("Press Enter to continue...")
sys.exit()

if not authData["sessionid"]:
logging.warning(Fore.RED + "No sessionid set" + Fore.RESET)
raw_input("Press Enter to continue...")
sys.exit()

if not authData["steamLogin"]:
logging.warning(Fore.RED + "No steamLogin set" + Fore.RESET)
logging.warning(Fore.YELLOW + "No steamLogin set" + Fore.RESET)

if not authData["steamLoginSecure"]:
logging.warning(Fore.YELLOW + "No steamLoginSecure set" + Fore.RESET)

if not authData["steamLoginSecure"] and not authData["steamLogin"]:
logging.warning(Fore.RED + "No steamLogin and steamLoginSecure set" + Fore.RESET)
raw_input("Press Enter to continue...")
sys.exit()

def generateCookies():
global authData
try:
cookies = dict(sessionid=authData["sessionid"], steamLogin=authData["steamLogin"], steamparental=authData["steamparental"])
cookies = dict(
sessionid=authData["sessionid"],
timezoneOffset=authData["timezoneOffset"],
steamCountry=authData["steamCountry"]
)
if "steamLogin" in authData:
cookies["steamLogin"] = authData["steamLogin"]
if "steamLoginSecure" in authData:
cookies["steamLoginSecure"] = authData["steamLoginSecure"]
if "steamparental" in authData:
cookies["steamparental"] = authData["steamparental"]
except:
logging.warning(Fore.RED + "Error setting cookies" + Fore.RESET)
raw_input("Press Enter to continue...")
Expand All @@ -65,7 +81,7 @@ def dropDelay(numDrops):
else:
baseDelay = (5*60)
return baseDelay

def idleOpen(appID):
try:
logging.warning("Starting game " + getAppName(appID) + " to idle cards")
Expand All @@ -79,7 +95,7 @@ def idleOpen(appID):
elif sys.platform.startswith('darwin'):
process_idle = subprocess.Popen(["./steam-idle", str(appID)])
elif sys.platform.startswith('linux'):
process_idle = subprocess.Popen(["python2", "steam-idle.py", str(appID)])
process_idle = subprocess.Popen(["python2", "steam-idle.py", str(appID), getPlainAppName(appID)])
except:
logging.warning(Fore.RED + "Error launching steam-idle with game ID " + str(appID) + Fore.RESET)
raw_input("Press Enter to continue...")
Expand All @@ -105,7 +121,7 @@ def chillOut(appID):
time.sleep(5*60)
try:
rBadge = requests.get(myProfileURL+"/gamecards/" + str(appID) + "/",cookies=cookies)
indBadgeData = bs4.BeautifulSoup(rBadge.text)
indBadgeData = bs4.BeautifulSoup(rBadge.text, 'lxml')
badgeLeftString = indBadgeData.find_all("span",{"class": "progress_info_bold"})[0].contents[0]
if "card drops" in badgeLeftString:
stillDown = False
Expand All @@ -116,15 +132,15 @@ def chillOut(appID):

def getAppName(appID):
try:
api = requests.get("http://store.steampowered.com/api/appdetails/?appids=" + str(appID) + "&filters=basic")
api = requests.get("https://store.steampowered.com/api/appdetails/?appids=" + str(appID) + "&filters=basic")
api_data = json.loads(api.text)
return Fore.CYAN + api_data[str(appID)]["data"]["name"].encode('ascii', 'ignore') + Fore.RESET
except:
return Fore.CYAN + "App "+str(appID) + Fore.RESET

def getPlainAppName(appid):
try:
api = requests.get("http://store.steampowered.com/api/appdetails/?appids=" + str(appID) + "&filters=basic")
api = requests.get("https://store.steampowered.com/api/appdetails/?appids=" + str(appID) + "&filters=basic")
api_data = json.loads(api.text)
return api_data[str(appID)]["data"]["name"].encode('ascii', 'ignore')
except:
Expand Down Expand Up @@ -155,7 +171,7 @@ def get_blacklist():

try:
badgesLeft = []
badgePageData = bs4.BeautifulSoup(r.text)
badgePageData = bs4.BeautifulSoup(r.text, 'lxml')
badgeSet = badgePageData.find_all("div",{"class": "badge_title_stats"})
except:
logging.warning(Fore.RED + "Error finding drop info" + Fore.RESET)
Expand All @@ -170,7 +186,7 @@ def get_blacklist():
currentpage = 2
while currentpage <= badgePages:
r = requests.get(myProfileURL+"/badges/?p="+str(currentpage),cookies=cookies)
badgePageData = bs4.BeautifulSoup(r.text)
badgePageData = bs4.BeautifulSoup(r.text, 'lxml')
badgeSet = badgeSet + badgePageData.find_all("div",{"class": "badge_title_stats"})
currentpage = currentpage + 1
except:
Expand Down Expand Up @@ -208,7 +224,7 @@ def get_blacklist():
continue
else:
if authData["sort"]=="mostvalue" or authData["sort"]=="leastvalue":
gameValue = requests.get("http://api.enhancedsteam.com/market_data/average_card_price/?appid=" + str(badgeId) + "&cur=usd")
gameValue = requests.get("https://api.enhancedsteam.com/market_data/average_card_price/?appid=" + str(badgeId) + "&cur=usd")
push = [badgeId, dropCountInt, float(str(gameValue.text))]
badgesLeft.append(push)
else:
Expand Down Expand Up @@ -263,7 +279,7 @@ def getKey(item):

logging.warning("Checking to see if " + getAppName(appID) + " has remaining card drops")
rBadge = requests.get(myProfileURL + "/gamecards/" + str(appID) + "/",cookies=cookies)
indBadgeData = bs4.BeautifulSoup(rBadge.text)
indBadgeData = bs4.BeautifulSoup(rBadge.text, 'lxml')
badgeLeftString = indBadgeData.find_all("span",{"class": "progress_info_bold"})[0].contents[0]
if "No card drops" in badgeLeftString:
logging.warning("No card drops remaining")
Expand Down
51 changes: 22 additions & 29 deletions Releases/Linux/steam-idle.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
import os
import sys
import platform
import io
from PIL import Image, ImageTk
from ctypes import CDLL
try: #Python 2
from urllib2 import urlopen
except ImportError: # Python 3
from urllib.request import urlopen
try:
import Tkinter as tk
except ImportError:
import tkinter as tk

import gtk
import gtk.gdk
import pynotify

def get_steam_api():
if sys.platform.startswith('win32'):
Expand All @@ -37,39 +35,34 @@ def get_steam_api():

return steam_api


def init_gui(str_app_id):
gui = tk.Tk()
gui.title('App ' + str_app_id)
gui.resizable(0,0)
try:
url = "http://cdn.akamai.steamstatic.com/steam/apps/" + str_app_id + "/header_292x136.jpg"
image_bytes = urlopen(url).read()
data_stream = io.BytesIO(image_bytes)
pil_image = Image.open(data_stream)
tk_image = ImageTk.PhotoImage(pil_image)
label = tk.Label(gui, image=tk_image)
label.image = tk_image
except:
label = tk.Label(gui, text="Couldn't load image")

label.pack()
return gui

if __name__ == '__main__':
if len(sys.argv) != 2:
if len(sys.argv) != 3:
print("Wrong number of arguments")
sys.exit()

str_app_id = sys.argv[1]
str_app_name = sys.argv[2]

os.environ["SteamAppId"] = str_app_id
os.environ["SteamAppName"] = str_app_name
try:
get_steam_api().SteamAPI_Init()
except:
print("Couldn't initialize Steam API")
sys.exit()

gui = init_gui(str_app_id)
gui.mainloop()

if pynotify.init("Idle-Master"):
# Image URI
uri = "https://cdn.akamai.steamstatic.com/steam/apps/" + str_app_id + "/header_292x136.jpg"
image_bytes = urlopen(uri).read()

loader = gtk.gdk.PixbufLoader();
loader.write(image_bytes)
loader.close()

n = pynotify.Notification("Now idling", "App (" + str_app_id + ") - <b>" + str_app_name + "</b>")
n.set_icon_from_pixbuf(loader.get_pixbuf())
if not n.show():
print("Failed to send notification")
else:
print("Failed to init notifications")