Browse the code
| Revision log Information on the revision | |
|---|---|
| Revision: | 132 (differences) |
| Author: | xbright |
| Log message: |
* Improved support of XEP-0126 |
| Change revision: | |
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# -*- coding: utf-8 -*- # Bluemindo: A really simple but powerful audio player in Python/PyGTK. # Copyright (C) 2007-2009 Erwan Briand # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation version 3 of the License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from os.path import join, exists try: # Load sqlite3 (python 2.5) import sqlite3 as sqlite except ImportError: try: # Load pysqlite2 (python =< 2.4) from pysqlite2 import dbapi2 as sqlite except ImportError: raise SystemExit('You need python-pysqlite2 (see the INSTALL file).') from common.config import ConfigLoader config = ConfigLoader() class SQLite(object): def __init__(self): sqlfile = join(config.datadir, 'songs.db') if not exists(sqlfile): database_exist = False else: database_exist = True self.cx = sqlite.connect(sqlfile) self.cur = self.cx.cursor() self.cx.text_factory = str if not database_exist: self.execute('create table songs ( ' 'title text, ' 'artist text, ' 'album text, ' 'comment text, ' 'genre text, ' 'year text, ' 'track integer, ' 'length integer, ' 'filename text ' ')') self.execute('create table stats_songs ( ' 'filename text, tracks integer )') self.execute('create table stats_albums ( ' 'album text, tracks integer )') self.execute('create table stats_artists ( ' 'artist text, tracks integer )') self.execute('create table radios ( ' 'name text, url text )') def execute(self, sql, param=None): if param is not None: self.cur.execute(sql, param) else: self.cur.execute(sql) self.cx.commit() return self.cur def executemany(self, sql, param): self.cur.executemany(sql, param) self.cx.commit() return self.cur def fetchall(self, cur): return cur.fetchall() def close(self): self.cur.close() self.cx.close()

Bluemindo