Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added very simple code to create a wp db.

  • Loading branch information...
commit 53c88f16d6d847826738d4f35cfbef7d67cb3f26 1 parent 115a02d
@phaero authored
Showing with 20 additions and 5 deletions.
  1. +16 −5 wputils/db.py
  2. +4 −0 wputils/wp.py
View
21 wputils/db.py
@@ -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
View
4 wputils/wp.py
@@ -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' )
@@ -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'
Please sign in to comment.
Something went wrong with that request. Please try again.