Commits

Steven Suwatanapongched  committed b3e92f3

updated stuff, specifically interfacelife script, bad commit message, i know

  • Participants
  • Parent commits f3f946f

Comments (0)

Files changed (3)

File .bash_aliases

 alias sp='source ~/.bash_profile'
 alias rmdir="/bin/rm -fdr"
 alias e='emacs'
+alias pgs='postgres -D /usr/local/var/postgres/'
 
 # if [ "$(uname -s)" == "Darwin" ]; then
 # 	# Specific to Mac

File .bash_profile

 
-export PATH=/Users/sunpech/SDK/android-sdk-mac_86:$PATH
+export PATH=/Users/sunpech/SDK/android-sdk-mac_86/platform-tools:$PATH
 export PATH=/Users/sunpech/bin/mongo/bin:$PATH
 export PATH=/usr/local/mysql/bin:$PATH
 export PATH=/Users/sunpech/bin:$PATH
+export PATH=/usr/local/Cellar/nginx/1.0.5/sbin:$PATH
 
 [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.
 

File bin/interfacelift.py

 #!/usr/bin/env python
 import os
 import urllib2
+import re
 
-# Where this script was originally from:
-# http://www.geekyourmind.com/2010/05/20/interfacelift-wallpaper-downloader-script/
-
+# Original
+#url       = 'http://interfacelift.com/wallpaper/downloads/date/hdtv/1080p/'
+#directory = '/datapool/public/wallpaper/1080p'
 
 #############################################
 # 1080p
-url       = 'http://interfacelift.com/wallpaper/downloads/date/hdtv/1080p/'
-directory = '/Users/sunpech/Pictures/Wallpapers/interfacelift_1080p'
+#url       = 'http://interfacelift.com/wallpaper/downloads/date/hdtv/1080p/'
+#directory = '/Users/sunpech/Pictures/Wallpapers/interfacelift_1080p'
 #############################################
 # 1680x1050
 #url       = 'http://interfacelift.com/wallpaper/downloads/date/widescreen/1680x1050/'
 #url       = 'http://interfacelift.com/wallpaper/downloads/date/google_android/960x800/'
 #directory = '/Users/sunpech/Pictures/Wallpapers/interfacelift_960x800'
 #############################################
-start     = '<a href="/wallpaper/7yz4ma1'  #check interfacelift.com to see what the randomly generated part is at the end
-end       = '">'
+# 1400x1050
+#url       = 'http://interfacelift.com/wallpaper/downloads/date/fullscreen/1400x1050/'
+#directory = '/Users/sunpech/Pictures/Wallpapers/interfacelift_1400x1050'
+#############################################
+# iPad
+url 	  = 'http://interfacelift.com/wallpaper/downloads/date/apple_devices/ipad_1024x1024/'
+directory = '/Users/sunpech/Pictures/Wallpapers/interfacelift_ipad_1024x1024'
+#############################################
+
+
 useragent = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)'
+pattern   = '(?<=<a href=")/wallpaper/.*jpg(?=">)' # The regex pattern used. Check the README
 
 count     = 1
 while count < 999999:
         data       = urllib2.urlopen(url + "index" + str(count) + ".html").read()
-        currentpos = 0
-        urlcount   = 0
-        while True:
-                index      = data.find(start, currentpos)
-                if index == -1:
-                        break
-                endofindex = data.find(end, index)
-                currentpos = index + 1
-                urlcount  += 1
-                if os.path.exists(directory + data[index+25:endofindex]):
+        pictures   = re.findall(pattern, data)
+        urlcount   = len(pictures)
+        for picture in pictures:
+                if os.path.exists(directory + picture):
                         print 'Directory up to date. Found existing file.'
                         quit()
-                os.system('wget -P ' + directory + ' -nc -U "' + useragent + '" ' + 'http://interfacelift.com' + data[index+9:endofindex])
+                os.system('wget -P ' + directory + ' -nc -U "' + useragent + '" ' + 'http://interfacelift.com' + picture)
         if urlcount == 0:
                 quit()
-        count += 1
+        count += 1