summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2018-01-11 20:22:33 +0100
committerJens Georg <mail@jensge.org>2018-01-11 20:22:33 +0100
commit2fac7194c7d3a2f8a0c0a6fffd62298a60d5d611 (patch)
tree2484529cef90540e500a92d043adfe0cd5c6cba7 /examples
parent26abf9727ffa19e9baafdb66df42e25d0b5092d9 (diff)
downloadrygel-2fac7194c7d3a2f8a0c0a6fffd62298a60d5d611.tar.gz
examples: Port mx-info to Python 3
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/mx-info18
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')