## Nic's OGG hack to update the .meta_storage file with ogg
## data. Could it be simpler?
##
## Cheers to all ogg users around there. I had a profecy this
## morning. A vision of Ogg. He told me: 'We will prevail'.
##
## ++nicolau 20090810
from pysqlite2 import dbapi2 as sqlite
from mutagen.oggvorbis import OggVorbis
con = sqlite.connect("/home/user/.meta_storage",isolation_level=None)
cur = con.cursor()
cur.execute("select Filename from Metadata where Filename LIKE '%.ogg' AND (Album IS NULL OR Track IS NULL OR Artist IS NULL)")
for k in cur.fetchall():
print k[0]
try:
a=OggVorbis(k[0])
except:
print 'fanofau'
continue
#print a
for t in ['artist', 'album', 'title', 'date', 'tracknumber', 'cat']:
if not t in a.keys():
a[t]=''