Skip to content

Commit

Permalink
Added very simple code to create a wp db.
Browse files Browse the repository at this point in the history
  • Loading branch information
phaero committed Jan 8, 2012
1 parent 115a02d commit 53c88f1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
21 changes: 16 additions & 5 deletions wputils/db.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# -*- coding: utf-8 -*-
import sqlobject

class Wallpaper( sqlobject.SQLObject ):
fname = sqlobject.UnicodeCol()
height = sqlobject.IntCol()
width = sqlobject.IntCol()
import sqlite3

def create_db( config ):
conn = sqlite3.connect( config.get( 'wp', 'db_uri' ) )

c = conn.cursor()
c.execute( '''create table wallpapers ( fname text, tags text, height integer, width integer )''' )
conn.commit()

c.close()

def insert_wp( config, wp_fname, tags, height, width ):
pass

def get_random_wp( config ):
pass
4 changes: 4 additions & 0 deletions wputils/wp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from optparse import OptionParser
from config import load_config

import wputils.db as db

def init_wp( config, args ):
print 'wallpaper directory: ', config.get( 'wp', 'dirs' )
print 'Database uri: ', config.get( 'wp', 'db_uri' )
Expand All @@ -12,6 +14,8 @@ def init_wp( config, args ):
print 'Database last updated (tuple): ', config.get_datetime(
'wp', 'db_last_updated' )

db.create_db( config )

def import_wp( config, args ):
print 'import'

Expand Down

0 comments on commit 53c88f1

Please sign in to comment.