Passed
Push — beta ( 91a9ed...2462f8 )
by Dean
02:58
created

Shows.on_changed()   A

Complexity

Conditions 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 1
CRAP Score 1.2963

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 7
loc 7
ccs 1
cts 3
cp 0.3333
rs 9.4285
c 1
b 0
f 0
cc 1
crap 1.2963
1 1
from plugin.sync.core.enums import SyncData, SyncMedia, SyncMode
2 1
from plugin.sync.handlers.core import DataHandler, PushHandler, bind
3 1
from plugin.sync.handlers.ratings.base import RatingsHandler
4
5 1
import logging
6
7 1
log = logging.getLogger(__name__)
8
9
10 1
class Base(PushHandler, RatingsHandler):
0 ignored issues
show
Bug introduced by
The method fast_pull which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method full which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method on_added which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method on_changed which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method on_removed which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method pull which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
11 1
    pass
12
13
14 1 View Code Duplication
class Movies(Base):
0 ignored issues
show
Bug introduced by
The method fast_pull which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method full which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method on_removed which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method pull which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
15 1
    media = SyncMedia.Movies
16
17 1
    @bind('added', [SyncMode.Full, SyncMode.Push])
18
    def on_added(self, key, guid, p_item, p_value, t_value, **kwargs):
19
        log.debug('Movies.on_added(%r, ...)', key)
20
21
        if t_value:
22
            return
23
24
        self.store_movie('add', guid,
25
             key, p_item,
26
             rating=p_value
27
         )
28
29 1
    @bind('changed', [SyncMode.Full, SyncMode.Push])
30
    def on_changed(self, key, guid, p_item, p_value, **kwargs):
31
        log.debug('Movies.on_changed(%r, ...)', key)
32
33
        self.store_movie('add', guid,
34
             key, p_item,
35
             rating=p_value
36
         )
37
38
39 1 View Code Duplication
class Shows(Base):
0 ignored issues
show
Bug introduced by
The method fast_pull which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method full which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method on_removed which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method pull which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
40 1
    media = SyncMedia.Shows
41
42 1
    @bind('added', [SyncMode.Full, SyncMode.Push])
43
    def on_added(self, key, guid, p_item, p_value, t_value, **kwargs):
44
        log.debug('Shows.on_added(%r, ...)', key)
45
46
        if t_value:
47
            return
48
49
        self.store_show('add', guid,
50
            key, p_item,
51
            rating=p_value
52
        )
53
54 1
    @bind('changed', [SyncMode.Full, SyncMode.Push])
55
    def on_changed(self, key, guid, p_item, p_value, **kwargs):
56
        log.debug('Shows.on_changed(%r, ...)', key)
57
58
        self.store_show('add', guid,
59
            key, p_item,
60
            rating=p_value
61
        )
62
63
64 1 View Code Duplication
class Episodes(Base):
0 ignored issues
show
Bug introduced by
The method fast_pull which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method full which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method on_removed which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method pull which was declared abstract in the super-class MediaHandler
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
65 1
    media = SyncMedia.Episodes
66
67 1
    @bind('added', [SyncMode.Full, SyncMode.Push])
68
    def on_added(self, key, guid, identifier, p_show, p_item, p_value, t_value, **kwargs):
69
        log.debug('Episodes.on_added(%r, ...)', key)
70
71
        if t_value:
72
            return
73
74
        self.store_episode('add', guid,
75
            identifier, key,
76
            p_show, p_item,
77
            rating=p_value
78
        )
79
80 1
    @bind('changed', [SyncMode.Full, SyncMode.Push])
81
    def on_changed(self, key, guid, identifier, p_show, p_item, p_value, **kwargs):
82
        log.debug('Episodes.on_changed(%r, ...)', key)
83
84
        self.store_episode('add', guid,
85
            identifier, key,
86
            p_show, p_item,
87
            rating=p_value
88
        )
89
90
91 1
class Push(DataHandler):
92 1
    data = SyncData.Ratings
93 1
    mode = SyncMode.Push
94
95 1
    children = [
96
        Movies,
97
98
        Shows,
99
        Episodes
100
    ]
101