Place Holder Products Code
Bash MySQL
Notes Return of the Fed Login
Admin Control Panel Email Control Panel Product Control Panel Debug Info Beacon Create Snippet Tag Control Panel

Code

*More fully fledged applications can be found on the Products page. The Bash page is dedicated to fully commented oneliners, and a MySQL quick reference is available here.



				
#!/usr/bin/env python # # Will Bergen - 2018 # i3 bar script for mpc integration # Updates status bar, creates iTunes style notifications w/ album art import subprocess import os # Get the info from the call: output = subprocess.check_output("mpc -f '%artist%:::%title%:::%album%:::%file%'", shell=True) line = output.splitlines()[0] artist,title,album, file = line.split(":::") # Remove old image: try: os.remove(icon_path_final) except Exception as e: print e # Call notify: print artist, title, album, "\n", file mdir = "/media/bob/Storage/Music/" path = mdir + file s = str(64) icon_path = "/tmp/changed_icon.png" icon_path_final = "/tmp/changed_icon" + s + ".png" # Try to get an image out of it: ff = ["ffmpeg", "-i", path, icon_path] # Try to resize: sz = ["convert", "-resize", s + "x" + s, icon_path, "-quality", "100", icon_path_final] # Remove: rm = ["rm", icon_path_final] try: subprocess.call(rm) subprocess.call(ff) subprocess.call(sz) except Exception as e: print e # Clean original: try: os.remove(icon_path) # pass except Exception as e: print e dunst_class = "changed_d" c=[] if (os.path.isfile(icon_path_final)): c = ["notify-send", "--urgency=NORMAL", "--expire-time=3000", "--app-name=\"ncmpcpp\"", "--icon=audio", "--icon="+icon_path_final, title, artist+"\n"+album ] else: c = ["notify-send", "--urgency=NORMAL", "--expire-time=3000", "--app-name=\"ncmpcpp\"", "--icon=audio", "--icon=/home/bob/temp/ncmpcpp_work/tunes.png", title, artist+"\n"+album ] subprocess.call(c)