Script to Download Fonts in Bulk From dafont.com

This item was filled under [ Uncategorized ]

Being into design related stuff since joining college, I’ve found it a necessity to maintain a decent font collection. In this post, I will share and explain the script which helped me to create my collection.

What my script does is download fonts directly off a top 20 list of fonts from dafont.com, for each sub-category available there.

The website has a very organized way to let users download fonts. First, there are categories like Fancy, Foreign Look, Techno, Gothic etc. Under each of these categories, there are sub-categories. Each subcategory has an ID which will help our purpose.

You can just change the ID range in the script to download fonts of different category.

The Script

#! /usr/bin/python
 
# Name: dafont.com Bulk Download Tool
# Version: 0.3
# Summary: A tool for downloading top 20 fonts of each sub-category of dafont.com
# License: BSD
# Author: Pranav Ashok
# Author-email: iam@pranavashok.com
# Author-homepage: http://pranavashok.com/blog
# Support: http://pranavashok.com/blog/2010/05/script-to-download-fonts-in-bulk-from-dafont-com
# Support: Twitter (@pranavashok)
 
from BeautifulSoup import BeautifulSoup
import re
import os
import commands
import string
 
for cat in range(101, 119): #ID Range 101-119
	url = 'http://www.dafont.com/theme.php?cat=%d&nb_ppp=20' % cat
	contents = commands.getoutput("curl -s '"+url+"'")
 
	w = open('downloader.sh', 'a')
 
	soup = BeautifulSoup(contents)
	directory = soup.find('title').contents
	wholeTag = soup.findAll('a', {"class" : "dl"})
	directory[0] = string.rstrip(directory[0], " | dafont.com")
	fontCat, useless, subCat = directory[0].partition(" > ")
 
	w.write('mkdir \"%s\"\n' % fontCat)
	w.write('cd \"%s\"\n' % fontCat)
 
	w.write('mkdir \"%s\"\n' % subCat)
	w.write('cd \"%s\"\n' % subCat)
	for link in wholeTag:
		name = os.path.basename(link['href'])
		fileName, fileExt = os.path.splitext(name)
		fileName = string.lstrip(fileName, "?f=")
		w.write('wget -c -O \"%s.zip\" \"%s\" \n' % (fileName, link['href']))
	w.write('cd ..\n')
	w.write('cd ..\n')
	w.close()

Continue reading…

Tagged with: [ , , , , ]

Script to Download TED Videos in Bulk

This item was filled under [ Uncategorized ]

I recently became addicted to TED Videos. This inspired me to create a simple python script which helps one download TED Talks in bulk. Here is the main part of the script. Scroll down for download link and usage instructions.

#! /usr/bin/python
 
# Name: TED Video Downloader
# Version: 0.4
# Summary: A bulk TED Talks download tool
# License: BSD
# Author: Pranav Ashok
# Author-email: iam@pranavashok.com
# Author-homepage: http://pranavashok.com/blog
# Support: http://pranavashok.com/blog/2009/12/script-to-download-ted-videos-in-bulk/
# Support: Twitter (@pranavashok)
 
from BeautifulSoup import BeautifulSoup
from urllib2 import urlopen
import re
import os
import sys
 
f = open(sys.argv[1], 'r')
for link in f:
	web = urlopen(link)
	soup = BeautifulSoup(web.read())
	wholeTag = soup.find(href=re.compile("/talks/download/video/.+"))
 
	name = os.path.basename(link)
	fileName, fileExt = os.path.splitext(name)
	outputFile = fileName+".mp4"
 
	# wholeTag['href'] gives the value of the href attribute
	downloadUrl = "http://www.ted.com"+wholeTag['href']
 
	w = open('downloader.sh', 'a')
	w.write('wget -c -O \"%s\" \"%s\"\n' % (outputFile, downloadUrl))
	w.close()
exit()

Continue reading…

Tagged with: [ , , , , ]

Start Using Linux – Basic Terminal Commands

This item was filled under [ Uncategorized ]

This is a compilation of some terminal commands I’ve found useful.

Before starting, I’d like to emphasize on a few things:
- You might want to understand the filesystem hierarchy in linux before you start.
- When you start terminal, your default working directory is /home/user-name
- If you want to get more info on any command, just type ‘
command-name –help‘ without the quotes in terminal.
- In this post, when I say ‘type’ something in terminal, it means ‘execute it’ by typing it and pressing enter.
- Whenever you want to end a looping command, for example, ping in terminal – press Ctrl + C.

Continue reading…

Tagged with: [ , , , ]

Creating a WordPress Sandbox – Installing WordPress Locally

This item was filled under [ Uncategorized ]

Here’s a video I created an hour ago. Basically, it guides you in creating a wordpress sandbox to test your themes/plugins and other features of wordpress.

You’ll need to download:
1. WAMPServer 2 from http://www.wampserver.com/dl.php) and;
2. WordPress from http://wordpress.org/latest.zip)

I’m planning to create more tutorial videos. Please give your suggestions, if any.

Tagged with: [ , , , ]

Batch Script to Generate File/Folder Listing

This item was filled under [ Uncategorized ]

I was chatting with a friend who had a huge music collection and I wanted to know what all he had. This provoked me to make a batch script which would do the job. I did some research online and found out some basics of batch scripts. This is the final thing which I ended up with.

@echo Directory listing will be created at c:\dirList.txt
@dir %1 /S > c:\dirList.txt
@echo Opening c:\dirList.txt in Notepad
@notepad c:\dirList.txt
@pause

I think it’s self explanatory. But still, I’ll go ahead and explain.

1. Prints “Directory listing will be created at c:\dirList.txt”

2. dir is a command which will print the list of directories and files. %1 is a variable which will contain the location from where you run this script. /s is a switch for Continue reading…

Saving YouTube Videos from Firefox Cache

This item was filled under [ Jazzed Up! ]

This was first posted in my old, dead blog Jazzed Up! on Mar 24, 2008 1:44 PM

This article tells your how to download videos, not only from YouTube, but also from other video sharing sites using Firefox. I’ll be considering only YouTube here. The procedure will be the same for any streaming media.

Note (07 Jul, 2009): Though this is a very cool trick, right now, I personally use Internet Download Manager with it’s integrated browser add-ons for downloading embedded stuff (including flash, videos and audio).

Note for linux users: See this comment by Binny V A

Step 1: Go to YouTube and play the video you want to download.

Step 2: After the video has loaded, open a new tab (Ctrl + T) or a new Firefox window and type

about:cache

in the address bar.

Copy the location of the Continue reading…

Tagged with: [ , , , , ]
Page 1 of 3123