Automatic GitHub Hook Puller for Easy Deployment

In developing websites I would often find myself committing to its git repository, pushing to GitHub, and then SSH-ing to the web host and manually triggering a pull. While being very tedious it sufficed to get the job done. For months I had vowed to employ GitHub’s post-receive hooks to automatically pull in changes on the deployment location. Well, I finally got around to it: http://gist.github.com/228427

Deploying this is as easy as putting this in hookpuller.py, updating the branches dictionary, running chmod 770 hookpuller.py, and protecting it with simple authentication credentials.

Then in your GitHub project go to the “Service Hooks” sub-page under the “Admin” section and enter the URL to the script.
post-receive-hook

Now whenever you push to GitHub your changes will be instantly pulled onto your deployment server.

Continue reading » · Rating: · Written on: 11-06-09 · No Comments »

DXVA/Awesome Compliant Checker

Checking an encode for DXVA compliance or the much more strict Awesome compliance has involved checking the MediaInfo output for up to 16 different settings. While most encoders understand these settings, a lot of end-users and potential uploaders do not. It is for this reason that I have created a pyy-based web application which automatically parses MediaInfo outputs and checks all these rules.

You can find the working version of it running at http://awesome.jakewharton.com/. Simply paste the text output from MediaInfo of any media file which you wish to check against DXVA or Awesome rules and submit. It will show you a green box if it is compliant and a red box if it is not. It will also list all the settings which violate the rules at the bottom.

As with most of my projects, the source is available on GitHub here and any contribution is welcome.

Update: JSON and XML requests can now be served via http://awesome.jakewharton.com/json/ and http://awesome.jakewharton.com/xml/, respectively. The MediaInfo text should be POSTed in ‘mediainfo’ and include ‘is_animation’ to denote the encode is animated. You can view example responses here.

Continue reading » · Rating: · Written on: 07-11-09 · No Comments »

Python Import Trickery

The use of 3rd party packages (i.e. through git submodules) you might run into an instance where a package requires a library that is not installed. If you use a 3rd party hosting solution and cannot modify your main installation there is an easy trick to aid in making these missing libraries importable.
Continue reading…

Continue reading » · Rating: · Written on: 07-07-09 · 1 Comment »

Scenerename – Automated TV Show File Renaming

scenerename is a python script which will automatically parse and rename your TV media files. It uses the tvdb_api library to access thetvdb.com’s extensive TV information.

Example (be sure to scroll to the right to see new names):

/mnt/media/.Downloads/Scrubs.S08.720p.HDTV.x264$ ~/scenerename.py
Fetching series data for "scrubs"...
--------------------------------------------------------------------------------------------------------------------------------------------
Original Name                                                          New Name
--------------------------------------------------------------------------------------------------------------------------------------------
e7-scrubs.s08e09.720p-x264.mkv                                         Scrubs 8x09 - My Absence.mkv
scrubs.s08e16.720p.hdtv.x264-0tv.mkv                                   Scrubs 8x16 - My Cuz.mkv
scrubs.s08e11.720p.hdtv.x264-ctu.mkv                                   Scrubs 8x11 - My Nah Nah Nah.mkv
Scrubs.S08E07.720p.HDTV.X264-DIMENSION.mkv                             Scrubs 8x07 - My New Role.mkv
Scrubs.S08E06.720p.HDTV.X264-DIMENSION.mkv                             Scrubs 8x06 - My Cookie Pants.mkv
scrubs.s08e14.720p.hdtv.x264-ctu.mkv                                   Scrubs 8x14 - My Soul on Fire (1).mkv
scrubs.s08e15.720p.hdtv.x264-ctu.mkv                                   Scrubs 8x15 - My Soul on Fire (2).mkv
scrubs.s08e01.720p.hdtv.x264-ctu.mkv                                   Scrubs 8x01 - My Jerks.mkv
e7-scrubs.s08e10.720p-x264.mkv                                         Scrubs 8x10 - My Comedy Show.mkv
scrubs.812.proper.720p.hdtv.x264-sys.mkv                               Scrubs 8x12 - Their Story II.mkv
scrubs.s08e17.720p.hdtv.x264-ctu.mkv                                   Scrubs 8x17 - My Chief Concern.mkv
Scrubs.S08E18.720p.HDTV.X264-DIMENSION.mkv                             Scrubs 8x18 - My Finale.mkv
Scrubs.S08E13.720p.HDTV.X264-DIMENSION.mkv                             Scrubs 8x13 - My Full Moon.mkv
Scrubs.S08E02.720p.HDTV.X264-DIMENSION.mkv                             Scrubs 8x02 - My Last Words.mkv
scrubs.s08e04.720p.hdtv.x264-ctu.mkv                                   Scrubs 8x04 - My Happy Place.mkv
Scrubs.S08E05.720p.HDTV.X264-DIMENSION.mkv                             Scrubs 8x05 - My ABC's.mkv
Scrubs.S08E08.720p.HDTV.X264-DIMENSION.mkv                             Scrubs 8x08 - My Lawyer's in Love.mkv
scrubs.s08e03.720p.hdtv.x264-ctu.mkv                                   Scrubs 8x03 - My Saving Grace.mkv

Run with "--confirm" to rename files

There are a variety of arguments which allow you to control the parsing and output format. Documentation and downloads can be found at Knio’s GitHub project page.

Continue reading » · Rating: · Written on: 05-20-09 · 3 Comments »

PyCache, a Python port of PHPCache

If you write web pages in Python and find your complex database queries are slowing down you page load times then you might want to consider a caching solution. While most advanced frameworks (like Django) provide their own internal caching solution, basic frameworks and barebone sites are left to dry. Continue reading…

Continue reading » · Rating: · Written on: 02-05-09 · No Comments »