diff options
author | Jens Georg <mail@jensge.org> | 2018-01-11 20:22:33 +0100 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2018-01-11 20:22:33 +0100 |
commit | 2fac7194c7d3a2f8a0c0a6fffd62298a60d5d611 (patch) | |
tree | 2484529cef90540e500a92d043adfe0cd5c6cba7 /examples | |
parent | 26abf9727ffa19e9baafdb66df42e25d0b5092d9 (diff) | |
download | rygel-2fac7194c7d3a2f8a0c0a6fffd62298a60d5d611.tar.gz |
examples: Port mx-info to Python 3
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/mx-info | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/examples/mx-info b/examples/mx-info index beed10db..30efc10a 100755 --- a/examples/mx-info +++ b/examples/mx-info @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This file is part of Rygel. # Copyright (C) 2015 Jens Georg <mail@jensge.org> @@ -22,7 +22,7 @@ import os.path import time from xdg import BaseDirectory import sys -from urllib import pathname2url +from urllib.request import pathname2url import argparse FILE_QUERY = """ @@ -81,18 +81,16 @@ parser.add_argument ('-u, --unblacklist', action = 'store_true', args = parser.parse_args () rygel_db = os.path.join (BaseDirectory.xdg_cache_home, "rygel", "media-export.db") -conn = sqlite3.connect (rygel_db); +conn = sqlite3.connect (rygel_db) -c = conn.cursor (); -c.execute ("SELECT version FROM schema_info"); +c = conn.cursor () +c.execute ("SELECT version FROM schema_info") info = c.fetchone() -if info[0] < 16: - print "Unsupported schema version or not a Rygel cache" +if int(info[0]) < 16: + print("Unsupported schema version or not a Rygel cache") sys.exit (1) -has_blacklist = False -if info[0] >= 17: - has_blacklist = True +has_blacklist = int(info[0]) >= 17 if not has_blacklist and args.unblacklist: print ('Database version is too old for blacklists, cannot unblacklist') |