as otherwise they will fail spuriously on slower systems.
-# Copyright (C) 2004, 2005, 2007 Richard Kettlewell
+# Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
"""
self._simple("reconfigure")
"""
self._simple("reconfigure")
- def rescan(self, pattern):
"""Rescan one or more collections.
"""Rescan one or more collections.
- Arguments:
- pattern -- glob pattern matching collections to rescan.
-
Only trusted users can perform this operation.
"""
Only trusted users can perform this operation.
"""
- self._simple("rescan", pattern)
def version(self):
"""Return the server's version number."""
def version(self):
"""Return the server's version number."""
elif keyword == 'scratched':
if len(bits) == 2:
return self.scratched(bits[0], bits[1])
elif keyword == 'scratched':
if len(bits) == 2:
return self.scratched(bits[0], bits[1])
+ elif keyword == 'rescanned':
+ return self.rescanned()
return self.invalid(line)
def completed(self, track):
return self.invalid(line)
def completed(self, track):
line -- line that could not be understood"""
return True
line -- line that could not be understood"""
return True
+ def rescanned(self):
+ """Called when a rescan completes"""
+ return True
+
# Local Variables:
# mode:python
# py-indent-offset:2
# Local Variables:
# mode:python
# py-indent-offset:2
#! /usr/bin/env python
#
# This file is part of DisOrder.
#! /usr/bin/env python
#
# This file is part of DisOrder.
-# Copyright (C) 2007 Richard Kettlewell
+# Copyright (C) 2007, 2008 Richard Kettlewell
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
open(config, "a").write("dbversion 1\n")
dtest.start_daemon()
dtest.create_user()
open(config, "a").write("dbversion 1\n")
dtest.start_daemon()
dtest.create_user()
dtest.stop_daemon()
# Revert to default configuration
dtest.copyfile(configsave, config)
dtest.stop_daemon()
# Revert to default configuration
dtest.copyfile(configsave, config)
#-*-python-*-
#
# This file is part of DisOrder.
#-*-python-*-
#
# This file is part of DisOrder.
-# Copyright (C) 2007 Richard Kettlewell
+# Copyright (C) 2007 ,2008 Richard Kettlewell
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
"--config", disorder._configfile, "--no-per-user-config",
"--user", "root", "edituser", username, "rights", "all"])
"--config", disorder._configfile, "--no-per-user-config",
"--user", "root", "edituser", username, "rights", "all"])
+def rescan(c=None):
+ class rescan_monitor(disorder.monitor):
+ def rescanned(self):
+ return False
+ if c is None:
+ c = disorder.client()
+ m = rescan_monitor()
+ print " initiating rescan"
+ c.rescan()
+ print " waiting for rescan to complete"
+ m.run()
+ print " rescan completed"
+
def stop_daemon():
"""stop_daemon()
def stop_daemon():
"""stop_daemon()
s2 = []
s2.extend(l2)
s2.sort()
s2 = []
s2.extend(l2)
s2.sort()
+ return map(nfc, s1) == map(nfc, s2)
+def check_files(chatty=True):
c = disorder.client()
failures = 0
for d in dirs_by_dir:
xdirs = dirs_by_dir[d]
dirs = c.directories(d)
if not lists_have_same_contents(xdirs, dirs):
c = disorder.client()
failures = 0
for d in dirs_by_dir:
xdirs = dirs_by_dir[d]
dirs = c.directories(d)
if not lists_have_same_contents(xdirs, dirs):
- print
- print "directory: %s" % d
- print "expected: %s" % xdirs
- print "got: %s" % dirs
+ if chatty:
+ print
+ print "directory: %s" % d
+ print "expected: %s" % xdirs
+ print "got: %s" % dirs
failures += 1
for d in files_by_dir:
xfiles = files_by_dir[d]
files = c.files(d)
if not lists_have_same_contents(xfiles, files):
failures += 1
for d in files_by_dir:
xfiles = files_by_dir[d]
files = c.files(d)
if not lists_have_same_contents(xfiles, files):
- print
- print "directory: %s" % d
- print "expected: %s" % xfiles
- print "got: %s" % files
+ if chatty:
+ print
+ print "directory: %s" % d
+ print "expected: %s" % xfiles
+ print "got: %s" % files
failures += 1
return failures
failures += 1
return failures
#! /usr/bin/env python
#
# This file is part of DisOrder.
#! /usr/bin/env python
#
# This file is part of DisOrder.
-# Copyright (C) 2007 Richard Kettlewell
+# Copyright (C) 2007, 2008 Richard Kettlewell
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
"""Exercise database dumper"""
dtest.start_daemon()
dtest.create_user()
"""Exercise database dumper"""
dtest.start_daemon()
dtest.create_user()
c = disorder.client()
track = "%s/Joe Bloggs/First Album/02:Second track.ogg" % dtest.tracks
dump = "%s/dumpfile" % dtest.testroot
c = disorder.client()
track = "%s/Joe Bloggs/First Album/02:Second track.ogg" % dtest.tracks
dump = "%s/dumpfile" % dtest.testroot
#! /usr/bin/env python
#
# This file is part of DisOrder.
#! /usr/bin/env python
#
# This file is part of DisOrder.
-# Copyright (C) 2007 Richard Kettlewell
+# Copyright (C) 2007, 2008 Richard Kettlewell
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
"""Check that the file listing comes out right"""
dtest.start_daemon()
dtest.create_user()
"""Check that the file listing comes out right"""
dtest.start_daemon()
dtest.create_user()
assert dtest.check_files() == 0, "dtest.check_files"
print " checking regexp file listing"
c = disorder.client()
assert dtest.check_files() == 0, "dtest.check_files"
print " checking regexp file listing"
c = disorder.client()