|
1 | | -''' |
| 1 | +""" |
2 | 2 | Kodi video capturer for Hyperion |
3 | | - |
4 | | - Copyright (c) 2013-1016 Hyperion Team |
5 | | -
|
6 | | - Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | | - of this software and associated documentation files (the "Software"), to deal |
8 | | - in the Software without restriction, including without limitation the rights |
9 | | - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 | | - copies of the Software, and to permit persons to whom the Software is |
11 | | - furnished to do so, subject to the following conditions: |
12 | | -
|
13 | | - The above copyright notice and this permission notice shall be included in |
14 | | - all copies or substantial portions of the Software. |
15 | | -
|
16 | | - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | | - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | | - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | | - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 | | - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21 | | - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | | - THE SOFTWARE. |
23 | | -''' |
| 3 | + |
| 4 | + Copyright (c) 2013-1016 Hyperion Team |
| 5 | +
|
| 6 | + Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | + of this software and associated documentation files (the "Software"), to deal |
| 8 | + in the Software without restriction, including without limitation the rights |
| 9 | + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | + copies of the Software, and to permit persons to whom the Software is |
| 11 | + furnished to do so, subject to the following conditions: |
| 12 | +
|
| 13 | + The above copyright notice and this permission notice shall be included in |
| 14 | + all copies or substantial portions of the Software. |
| 15 | +
|
| 16 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | + THE SOFTWARE. |
| 23 | +""" |
24 | 24 |
|
25 | 25 | import xbmc |
26 | 26 | import xbmcaddon |
27 | | -import xbmcgui |
28 | | -import os |
29 | | - |
30 | | -# Add the library path before loading Hyperion |
31 | | -__addon__ = xbmcaddon.Addon() |
32 | | -__cwd__ = __addon__.getAddonInfo('path') |
33 | | -sys.path.append(xbmc.translatePath(os.path.join(__cwd__, 'resources', 'lib'))) |
34 | | - |
35 | | -from settings import Settings |
36 | | -from state import DisconnectedState |
37 | | -from hyperion.Hyperion import Hyperion |
38 | | - |
39 | | -if __name__ == "__main__": |
40 | | - # read settings |
41 | | - settings = Settings() |
42 | | - |
43 | | - # initialize the state |
44 | | - state = DisconnectedState(settings) |
45 | | - |
46 | | - # start looping |
47 | | - while not settings.abort: |
48 | | - # execute the current state |
49 | | - next_state = state.execute() |
50 | | - |
51 | | - # delete the old state if necessary |
52 | | - if state != next_state: |
53 | | - del state |
54 | | - |
55 | | - # advance to the next state |
56 | | - state = next_state |
57 | | - |
58 | | - # clean up the state closing the connection if present |
59 | | - del state |
60 | | - del settings |
| 27 | + |
| 28 | +from resources.lib.misc import MessageHandler |
| 29 | +from resources.lib.settings import Settings |
| 30 | +from resources.lib.monitor import HyperionMonitor |
| 31 | + |
| 32 | + |
| 33 | +def main(): |
| 34 | + addon = xbmcaddon.Addon() |
| 35 | + player = xbmc.Player() |
| 36 | + settings = Settings(addon.getSettings()) |
| 37 | + output_handler = MessageHandler(addon) |
| 38 | + monitor = HyperionMonitor(settings, player, output_handler) |
| 39 | + monitor.main_loop() |
| 40 | + |
| 41 | + |
| 42 | +if __name__ == "__main__": |
| 43 | + main() |
0 commit comments