A python script to transform a list of subreddits in the clipboard into a paste-able format to be used in an Alien Blue group. Copy the list from your multireddit, run the script in Pythonista, then create a new group in Alien Blue and paste. Thats it!
| import console | |
| import clipboard | |
| import webbrowser | |
| def main(): | |
| text = clipboard.get() | |
| noNewlines = text.replace('\n',' ') | |
| array = noNewlines.split(' ') | |
| ABString = finalStringFromArray(array) | |
| clipboard.set(ABString) | |
| webbrowser.open('alienblue://') | |
| def finalStringFromArray(array): | |
| removeX = shouldRemoveX(array) | |
| finalString = '' | |
| i = 0 | |
| for i in range(0,len(array)): | |
| if array[i] != None: | |
| if array[i][:3] == 'add': | |
| break | |
| if array[i][:3] == '/r/': | |
| if removeX: | |
| finalString = finalString + array[i][3:-1] | |
| else: | |
| finalString = finalString + array[i][3:] | |
| finalString = finalString + "+" | |
| finalString = finalString[:-1] | |
| return finalString | |
| def shouldRemoveX(array): | |
| numX = 0 | |
| numReddits = 0 | |
| for i in range(0,len(array)): | |
| if array[i] != None: | |
| if array[i][:3] == 'add': | |
| break | |
| if array[i][:3] == '/r/': | |
| numReddits +=1 | |
| if array[i][-1:] == 'x': | |
| numX += 1 | |
| return numReddits == numX | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment