Fix migration script for CLI-only usage (bug 1434)
This commit is contained in:
parent
c4e6d1a86b
commit
2d989647ed
2 changed files with 13 additions and 7 deletions
|
@ -65,20 +65,25 @@ new_database = gpodder.database_file
|
|||
old_config = os.path.expanduser('~/.config/gpodder/gpodder.conf')
|
||||
new_config = gpodder.config_file
|
||||
|
||||
if not all(os.path.exists(x) for x in (old_database, old_config)):
|
||||
if not os.path.exists(old_database):
|
||||
print >>sys.stderr, """
|
||||
Turns out that you never ran gPodder 2.
|
||||
Can't find one of these required files:
|
||||
Can't find this required file:
|
||||
|
||||
%(old_config)s
|
||||
%(old_database)s
|
||||
""" % locals()
|
||||
sys.exit(1)
|
||||
|
||||
parser = ConfigParser.RawConfigParser()
|
||||
parser.read(old_config)
|
||||
if os.path.exists(old_config):
|
||||
parser = ConfigParser.RawConfigParser()
|
||||
parser.read(old_config)
|
||||
old_downloads = parser.get('gpodder-conf-1', 'download_dir')
|
||||
else:
|
||||
# The user has no configuration. This usually happens when
|
||||
# only the CLI version of gPodder is used. In this case, the
|
||||
# download directory is most likely the default (bug 1434)
|
||||
old_downloads = os.path.expanduser('~/gpodder-downloads')
|
||||
|
||||
old_downloads = parser.get('gpodder-conf-1', 'download_dir')
|
||||
new_downloads = gpodder.downloads
|
||||
|
||||
if not os.path.exists(old_downloads):
|
||||
|
|
|
@ -178,8 +178,9 @@ def convert_gpodder2_db(old_db, new_db):
|
|||
"""
|
||||
|
||||
old_db = sqlite.connect(old_db)
|
||||
new_db_filename = new_db
|
||||
new_db = sqlite.connect(new_db)
|
||||
upgrade(new_db)
|
||||
upgrade(new_db, new_db_filename)
|
||||
|
||||
# Copy data for podcasts
|
||||
old_cur = old_db.cursor()
|
||||
|
|
Loading…
Reference in a new issue