ValvePython / steamctl

🤸 Take control of Steam from your terminal
https://pypi.org/project/steamctl/
MIT License
317 stars 17 forks source link

Subscribe to Workshop Item #19

Closed God-damnit-all closed 4 years ago

God-damnit-all commented 4 years ago

While I'm aware there's commands to download workshop items, I specifically want to subscribe to them so that my client auto-updates them.

The web interface is extremely clunky for this purpose. The search returns bizarre results and I would like to be able to essentially collect an array of ids (via a script) and then subscribe to them through a for loop using steamctl.

However it seems like steamctl lacks the webapi hooks to do so. I tried looking into other python packages but they had the same problem. Can you please help me?

rossengeorgiev commented 4 years ago

Hi, that is a use case I didn't consider. There is way to subscribe and unsubscribe, and also enumerate all subscription. I need to look at it further.

You can in the meantime just call the webapi, either via steamctl or directly by other means.

# Subscribe
steamctl webapi call --method=POST IPublishedFileService.Subscribe list_type=1 publishedfileid=<workshop id>
# Unsubscribe
steamctl webapi call --method=POST IPublishedFileService.Unsubscribe list_type=1 publishedfileid=<workshop id>

# Favorite
steamctl webapi call --method=POST IPublishedFileService.Subscribe list_type=2 publishedfileid=<workshop id>
# Unfavorite
steamctl webapi call --method=POST IPublishedFileService.Unsubscribe list_type=2 publishedfileid=<workshop id>

You need to get an apikey for the account you want to do this on

God-damnit-all commented 4 years ago

That worked great! This is going to make my life a hell of a lot easier.

I have a suggestion for implementation, since I notice that the JSON response for these calls is always empty (and given how unreliable the Steam API can be, not knowing if something succeeded or failed isn't great).

While there's no way to do an API call that subscribes to multiple files at once, there is an API call to check all of a user's subscribed workshop items. So perhaps the application could accept a comma-separated list, do an API call for each of them, and then do a single API call at the end and iterate through all of the user's subscribed items to make sure they're all on there?

rossengeorgiev commented 4 years ago

I've added these as commands to the workshop section, and can take multiple workshop ids.