SCalkins Posted November 23, 2015 Share Posted November 23, 2015 (edited) Currently looking for help optimizing this workflow I don't have any programming experience, and anything beyond what I have already done is beyond my realm of knowledge. But, I did want to put this out their for anyone who would like to tidy it up and make it more user-friendly for other Alfred Users! Alfred-Sony-AV-Control An Alfred workflow for controlling Sony AV Receivers Currently working and tested for Sony STR-DN10xx (configured for my AV Unit (IP Address 10.0.0.13)) Poorly designed workflow, but it does in fact work. Problems Ability to pass arguments quicker (ex. it's currently a pain to change the volume multiple times) Configuring IP Address of AV Unit Solutions Combine poorly written code into one library with the ability to modify user's IP address. (Thanks deanishe for suggestions!)https://github.com/SethCalkins/Alfred-Sony-AV-Control Edited November 23, 2015 by SCalkins Link to comment
deanishe Posted November 23, 2015 Share Posted November 23, 2015 One tip: if you're copying and pasting a lot of code, you're doing it wrong. Ideally, you'd write one script (or one library) that contains all the networking code in a generalised manner, and you'd call that script from the workflow. Currently, if you want to change, say the IP address, you have to do it in 8–10 different places. Ideally, it should only need changing in one place. Link to comment
SCalkins Posted November 23, 2015 Author Share Posted November 23, 2015 One tip: if you're copying and pasting a lot of code, you're doing it wrong. Ideally, you'd write one script (or one library) that contains all the networking code in a generalised manner, and you'd call that script from the workflow. Currently, if you want to change, say the IP address, you have to do it in 8–10 different places. Ideally, it should only need changing in one place. Thank you I updated my post to reflect your suggestions! Link to comment
deanishe Posted November 23, 2015 Share Posted November 23, 2015 Seeing as you're using Python, have you looked at Alfred-Workflow? Your workflow has several actions, and the tutorial may give you a better idea how to structure the workflow (e.g. having a separate Python script instead of writing code in Alfred's Script box). This workflow is a bit more complex than yours, but I think it's a reasonable example of how you can combine multiple workflow actions into one script. There are much simpler ways to do the HTTP/SOAP, too. Unfortunately, it's hard to give really concrete input on the workflow because I don't have a Sony receiver. Link to comment
SCalkins Posted November 24, 2015 Author Share Posted November 24, 2015 Thank you for providing your structured workflow and an app that is similar, it's very useful (for me anyway) looking at an app that I can look through the code ! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now