# HG changeset patch # User Goffi # Date 1482264653 -3600 # Node ID b84dadbab62b259d18fd72f1d4653de7a7db82c9 # Parent 88e3071079a7a0e3e69174bd4b8b3d826d3047e6 core: added a platform check in on_start: on_start is also called on non-android platform, so a check has been added to ignore android-specific code diff -r 88e3071079a7 -r b84dadbab62b src/cagou/core/cagou_main.py --- a/src/cagou/core/cagou_main.py Mon Dec 19 23:50:19 2016 +0100 +++ b/src/cagou/core/cagou_main.py Tue Dec 20 21:10:53 2016 +0100 @@ -228,18 +228,19 @@ return os.path.expanduser(path).format(*args, media=self.host.media_dir, **kwargs) def on_start(self): - # XXX: we use memory map instead of bridge because if we try to call a bridge method - # in on_pause method, the call data is not written before the actual pause - # we create a memory map on .cagou_status file with a 1 byte status - # status is: - # R => running - # P => paused - # S => stopped - self._first_pause = True - self.cagou_status_fd = open('.cagou_status', 'wb+') - self.cagou_status_fd.write('R') - self.cagou_status_fd.flush() - self.cagou_status = mmap.mmap(self.cagou_status_fd.fileno(), 1, prot=mmap.PROT_WRITE) + if sys.platform == "android": + # XXX: we use memory map instead of bridge because if we try to call a bridge method + # in on_pause method, the call data is not written before the actual pause + # we create a memory map on .cagou_status file with a 1 byte status + # status is: + # R => running + # P => paused + # S => stopped + self._first_pause = True + self.cagou_status_fd = open('.cagou_status', 'wb+') + self.cagou_status_fd.write('R') + self.cagou_status_fd.flush() + self.cagou_status = mmap.mmap(self.cagou_status_fd.fileno(), 1, prot=mmap.PROT_WRITE) def on_pause(self): self.cagou_status[0] = 'P'