Switch to unified view

a/src/mediaserver/cdplugins/uprcl/uprcltags.py b/src/mediaserver/cdplugins/uprcl/uprcltags.py
...
...
29
#sqconn = sqlite3.connect('/tmp/tracks.sqlite')
29
#sqconn = sqlite3.connect('/tmp/tracks.sqlite')
30
30
31
# Tags for which we create auxiliary tables for facet descent.
31
# Tags for which we create auxiliary tables for facet descent.
32
#
32
#
33
# TBD: The list will come from the config file one day
33
# TBD: The list will come from the config file one day
34
# TBD: alias et al configuration
34
#
35
#
35
# TBD: All Artists, Group
36
# TBD: All Artists
36
#
37
#
37
# Maybe we'd actually need a 3rd value for the recoll field name, but
38
# Maybe we'd actually need a 3rd value for the recoll field name, but
38
# it can be the same for the currently relevant fields.
39
# it can be the same for the currently relevant fields.
39
tagtables = {
40
tagtables = {
40
    'Artist' : 'artist',
41
    'Artist' : 'artist',
...
...
89
    
90
    
90
91
91
# Insert new value if not existing, return rowid of new or existing row
92
# Insert new value if not existing, return rowid of new or existing row
92
def auxtableinsert(sqconn, tb, value):
93
def auxtableinsert(sqconn, tb, value):
93
    c = sqconn.cursor()
94
    c = sqconn.cursor()
94
    col = colid(tb)
95
    stmt = 'SELECT ' + col + ' FROM ' + tb + ' WHERE value = ?'
95
    stmt = 'SELECT ' + colid(tb) + ' FROM ' + tb + ' WHERE value = ?'
96
    c.execute(stmt, (value,))
96
    c.execute(stmt, (value,))
97
    r = c.fetchone()
97
    r = c.fetchone()
98
    if r:
98
    if r:
99
        rowid = r[0]
99
        rowid = r[0]
100
    else:
100
    else:
...
...
137
            continue
137
            continue
138
138
139
        album = getattr(doc, 'album', None)
139
        album = getattr(doc, 'album', None)
140
        if not album:
140
        if not album:
141
            if doc.mtype != 'inode/directory':
141
            if doc.mtype != 'inode/directory':
142
                pass
142
                uplog("No album: mtype %s title %s" % (doc.mtype, doc.url))
143
                #uplog("No album: mtype %s title %s" % (doc.mtype, doc.url))
143
            album = '[no album]'
144
            album = '[no album]'
144
            continue
145
            continue
145
146
146
        folder = docfolder(doc).decode('utf-8', errors = 'replace')
147
        folder = docfolder(doc).decode('utf-8', errors = 'replace')
147
148
...
...
340
            
341
            
341
        selwhere = selwhere + ' AND ' if selwhere else ' WHERE '
342
        selwhere = selwhere + ' AND ' if selwhere else ' WHERE '
342
        if i == qlen - 1:
343
        if i == qlen - 1:
343
            # We want to display all unique values for the column
344
            # We want to display all unique values for the column
344
            # artist.artist_id, artist.value
345
            # artist.artist_id, artist.value
345
            selwhat = col + '.' + col + '_id, ' + col + '.value'
346
            selwhat = col + '.' + colid(col) + ', ' + col + '.value'
346
            # tracks.artist_id = artist.artist_id
347
            # tracks.artist_id = artist.artist_id
347
            selwhere += 'tracks.' + colid(col) + ' = ' + col + '.' + colid(col)
348
            selwhere += 'tracks.' + colid(col) + ' = ' + col + '.' + colid(col)
348
        else:
349
        else:
349
            # Look at the value specified for the =xx column. The
350
            # Look at the value specified for the =xx column. The
350
            # selwhat value is only used as a flag
351
            # selwhat value is only used as a flag