| 1 | #! /usr/bin/env python |
| 2 | # |
| 3 | # This file is part of DisOrder |
| 4 | # Copyright (C) 2005 Richard Kettlewell |
| 5 | # |
| 6 | # This program is free software: you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by |
| 8 | # the Free Software Foundation, either version 3 of the License, or |
| 9 | # (at your option) any later version. |
| 10 | # |
| 11 | # This program is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. |
| 15 | # |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | # |
| 19 | |
| 20 | # Example use of disorder.monitor class |
| 21 | |
| 22 | import disorder |
| 23 | |
| 24 | class mymonitor(disorder.monitor): |
| 25 | def completed(self, track): |
| 26 | print "completed %s" % track |
| 27 | return True |
| 28 | |
| 29 | def failed(self, track, error): |
| 30 | print "failed %s (%s)" % (track, error) |
| 31 | return True |
| 32 | |
| 33 | def moved(self, id, offset, user): |
| 34 | print "%s moved by %s (%s)" % (id, offset, user) |
| 35 | return True |
| 36 | |
| 37 | def playing(self, track, user): |
| 38 | print "%s playing" % track |
| 39 | return True |
| 40 | |
| 41 | def queue(self, q): |
| 42 | print "queued %s" % str(q) |
| 43 | return True |
| 44 | |
| 45 | def recent_added(self, q): |
| 46 | print "recent_added %s" % str(q) |
| 47 | return True |
| 48 | |
| 49 | def recent_removed(self, id): |
| 50 | print "recent_removed %s" % id |
| 51 | return True |
| 52 | |
| 53 | def removed(self, id, user): |
| 54 | print "removed %s" % id |
| 55 | return True |
| 56 | |
| 57 | def scratched(self, track, user): |
| 58 | print "%s scratched %s" % (track, user) |
| 59 | return True |
| 60 | |
| 61 | def invalid(self, line): |
| 62 | print "invalid line: %s" % line |
| 63 | return True |
| 64 | |
| 65 | m = mymonitor() |
| 66 | m.run() |