Passed
Push — master ( aeb165...d9ae97 )
by Dean
03:04
created

Push.run()   A

Complexity

Conditions 2

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 1
CRAP Score 3.6875
Metric Value
dl 8
loc 8
ccs 1
cts 4
cp 0.25
rs 9.4285
cc 2
crap 3.6875
1 1
from plugin.sync.core.enums import SyncData, 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 View Code Duplication
class Push(Mode):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10 1
    data = SyncData.All
11 1
    mode = SyncMode.Push
12
13 1
    children = [
14
        Movies,
15
        Shows
16
    ]
17
18 1
    @elapsed.clock
19
    def construct(self):
20
        # Start progress tracking
21
        self.current.progress.start()
22
23
        # Construct children
24
        self.execute_children('construct')
25
26 1
    @elapsed.clock
27
    def start(self):
28
        # Fetch changes from trakt.tv
29
        self.trakt.refresh()
30
31
        # Build key table for lookups
32
        self.trakt.build_table()
33
34
        # Start children
35
        self.execute_children('start')
36
37 1
    @elapsed.clock
38
    def run(self):
39
        with self.plex.prime():
40
            # Run children
41
            self.execute_children('run')
42
43
        # Send artifacts to trakt
44
        self.current.artifacts.send()
45
46 1
    @elapsed.clock
47
    def stop(self):
48
        # Stop children
49
        self.execute_children('stop')
50
51
        # Stop progress tracking
52
        self.current.progress.stop()
53