Test Setup Failed
Push — develop ( e459d6...12ef70 )
by Dean
02:19
created

Push.stop()   A

Complexity

Conditions 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
cc 1
dl 0
loc 7
ccs 0
cts 0
cp 0
crap 2
rs 9.4285
1 1
from plugin.sync.core.enums import SyncMode
2 1
from plugin.sync.modes.core.base import Mode
3 1
from plugin.sync.modes.push.movies import Movies
4 1
from plugin.sync.modes.push.shows import Shows
5
6 1
import elapsed
7
8
9 1
class Push(Mode):
10 1
    mode = SyncMode.Push
11
12 1
    children = [
13
        Movies,
14
        Shows
15
    ]
16
17 1
    @elapsed.clock
18
    def construct(self):
19
        # Start progress tracking
20
        self.current.progress.start()
21
22
        # Construct children
23
        self.execute_children('construct')
24
25
    @elapsed.clock
26
    def start(self):
27
        # Fetch changes from trakt.tv
28
        self.trakt.refresh()
29
30
        # Build key table for lookups
31
        self.trakt.build_table()
32
33
        # Start children
34
        self.execute_children('start')
35
36
    @elapsed.clock
37
    def run(self):
38
        with self.plex.prime():
39
            # Run children
40
            self.execute_children('run')
41
42
        # Send artifacts to trakt
43
        self.current.artifacts.send()
44
45
    @elapsed.clock
46
    def stop(self):
47
        # Stop children
48
        self.execute_children('stop')
49
50
        # Stop progress tracking
51
        self.current.progress.stop()
52