Just check for the tracks table before importing from it.

This commit is contained in:
Raoul Snyman 2010-09-06 22:41:11 +02:00
parent f82513f11d
commit 63139e8c3b
1 changed files with 13 additions and 9 deletions

View File

@ -97,15 +97,19 @@ class OpenLP1SongImport(SongImport):
if self.stop_import_flag: if self.stop_import_flag:
success = False success = False
break break
cursor.execute(u'SELECT fulltrackname FROM tracks t ' cursor.execute(u'SELECT name FROM sqlite_master '
u'JOIN songtracks st ON t.trackid = st.trackid ' u'WHERE type = \'table\' NAME name = \'tracks\'')
u'WHERE st.songid = %s ORDER BY st.listindex' % song_id) table_list = cursor.fetchall()
tracks = cursor.fetchall() if len(table_list) > 0:
for track in tracks: cursor.execute(u'SELECT fulltrackname FROM tracks t '
if self.stop_import_flag: u'JOIN songtracks st ON t.trackid = st.trackid '
success = False u'WHERE st.songid = %s ORDER BY st.listindex' % song_id)
break tracks = cursor.fetchall()
self.add_media_file(unicode(track[0], u'cp1252')) for track in tracks:
if self.stop_import_flag:
success = False
break
self.add_media_file(unicode(track[0], u'cp1252'))
if self.stop_import_flag: if self.stop_import_flag:
success = False success = False
break break