Brought over my workplace scripts

This commit is contained in:
2014-12-08 10:12:55 -08:00
commit 1df6316ec7
12 changed files with 81 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
import urllib.request,re,getopt
def get_links(**options):
url="http://builder.blender.org/download"
ptn='(?<=href\=\")[^\"]*'
source=urllib.request.urlopen(url).read().decode("utf-8")
links=(re.findall(ptn,source))
masked_links = []
for l in range(0,len(links)):
if links[l].find("blender") != -1:
masked_links.append(links[l])
try:
opt = options.get()
except TypeError:
opt = "none"
return masked_links
links = get_links()
for l in links:
print(l)
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/python
# Creates a timestamp for today, and checks if a folder of that description exists, if id doesn't it creates it.
import os, datetime
def get_timestamp():
today = datetime.date.today()
curr_year = str(today.year)[2:4]
curr_month = str(today.month)
curr_day = str(today.day)
if len(curr_month) < 2 :
curr_month = '0' + curr_month
if len(curr_day) < 2 :
curr_day = '0' + curr_day
time_stamp = curr_month + curr_day + curr_year
return time_stamp
tentative_path = os.getcwd() + os.sep + get_timestamp()
if not os.path.exists(tentative_path):
os.mkdir(tentative_path)
print('folder_created at : '+ tentative_path)
else:
print('folder already exists')