# This program will pick an artist from a list of artists in a .txt file # You have to have the text file in the same place this code is in # In the text file, it's one artist per line # After it picks the artist, it asks if you want to open the artist page # on last.fm. If you say 'n', it skips the piratebay and youtube search # and asks if you want to pick another artist. If not, you type 'end'. # If you do open the artist page, it asks if you want to search an album # on piratebay and search a song on youtube. # !!!IMPORTANT!!! # BE SURE TO HAVE A BROWSER ALREADY OPEN, ELSE IT WILL OPEN NEW WINDOWS # Python version, 3.x import random import time import webbrowser import urllib.parse import subprocess musicChecked = 0 # These are optional and can be taken out openss = input('Is SoulSeek open? >> ') if openss == 'y': print('Ok, going on.') pass elif openss == 'n': openss1 = input('Do you want to open SoulSeek? >> ') if openss1 == 'y': print("Opening SoulSeek...") time.sleep(1.5) subprocess.Popen(r"C:\Program Files (x86)\SoulseekQt\SoulseekQt.exe") elif openss1 == 'n': print('Ok, going on.') pass openutor = input('Is µTorrent open? >> ') if openutor == 'y': print('Ok, going on.') pass elif openutor == 'n': openutor1 = input('Do you want to open µTorrent? >> ') if openutor1 == 'y': print("Opening µTorrent...") time.sleep(1.5) # Where it says '[User]' enter your username subprocess.Popen(r"C:\Users\[User]\AppData\Roaming\uTorrent\uTorrent.exe") elif openutor1 == 'n': print('Ok, going on.') pass time.sleep(1) while True: print("\n") file = open('a.txt', 'r') line = random.choice(file.readlines()) print("----------------------------------------------") print("Band/Artist: ", line) musicChecked = musicChecked + 1 print("You checked out " + str(musicChecked) + " band(s)/artist(s)") openpage = input('\nWant to open the artist page on last.fm? >> ') if openpage == 'y': url = urllib.parse.urljoin('http://www.last.fm/music/',line) elif openpage == 'n': pass if openpage == 'y': print('\nOpening last.fm page... ') webbrowser.open(url) time.sleep(1) openalbum = input('\nSearch album on piratebay? >> ') if openalbum == 'y': nameofalb = input('Name of album >> ') url3 = urllib.parse.urljoin('http://www.thepiratebay.sx/search/',nameofalb + ' ' + line) print('Opening thepiratebay page... ') webbrowser.open(url3) searchyt = input('\nSearch for a song on youtube? >> ') if searchyt == 'y': nameofsng = input('Name of song >> ') url4 = urllib.parse.urljoin('http://www.youtube.com/','results?search_query=' + nameofsng + ' ' + line + '&sm=3') print('Opening search on youtube... ') webbrowser.open(url4) elif openalbum == 'n': pass elif searchyt== 'n': pass time.sleep(.5) again = input("\nAgain? >> ") print("----------------------------------------------") if again == "end": print("ok") break