~tomasgroth/openlp/portable-path

« back to all changes in this revision

Viewing changes to openlp/plugins/songs/lib/importers/openlp.py

  • Committer: Tomas Groth
  • Date: 2019-04-30 19:02:42 UTC
  • mfrom: (2829.2.32 openlp)
  • Revision ID: tomasgroth@yahoo.dk-20190430190242-6zwjk8724tyux70m
trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection                                      #
6
6
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2018 OpenLP Developers                                   #
 
7
# Copyright (c) 2008-2019 OpenLP Developers                                   #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it     #
10
10
# under the terms of the GNU General Public License as published by the Free  #
25
25
"""
26
26
import logging
27
27
 
28
 
from sqlalchemy import create_engine, MetaData, Table
 
28
from sqlalchemy import MetaData, Table, create_engine
29
29
from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, sessionmaker
30
30
from sqlalchemy.orm.exc import UnmappedClassError
31
31
 
33
33
from openlp.core.lib.db import BaseModel
34
34
from openlp.core.widgets.wizard import WizardStrings
35
35
from openlp.plugins.songs.lib import clean_song
36
 
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic, MediaFile
 
36
from openlp.plugins.songs.lib.db import Author, Book, MediaFile, Song, Topic
 
37
 
37
38
from .songimport import SongImport
38
39
 
 
40
 
39
41
log = logging.getLogger(__name__)
40
42
 
41
43
 
104
106
            pass
105
107
 
106
108
        # Check the file type
107
 
        if not isinstance(self.import_source, str) or not self.import_source.endswith('.sqlite'):
 
109
        if self.import_source.suffix != '.sqlite':
108
110
            self.log_error(self.import_source, translate('SongsPlugin.OpenLPSongImport',
109
111
                                                         'Not a valid OpenLP 2 song database.'))
110
112
            return