trackma 0.7.5__py3.6.egg

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. EGG-INFO/PKG-INFO +22 -0
  2. EGG-INFO/SOURCES.txt +55 -0
  3. EGG-INFO/dependency_links.txt +1 -0
  4. EGG-INFO/entry_points.txt +9 -0
  5. EGG-INFO/not-zip-safe +1 -0
  6. EGG-INFO/requires.txt +8 -0
  7. EGG-INFO/top_level.txt +1 -0
  8. trackma/__init__.py +0 -0
  9. trackma/__pycache__/__init__.cpython-36.pyc +0 -0
  10. trackma/__pycache__/accounts.cpython-36.pyc +0 -0
  11. trackma/__pycache__/data.cpython-36.pyc +0 -0
  12. trackma/__pycache__/engine.cpython-36.pyc +0 -0
  13. trackma/__pycache__/messenger.cpython-36.pyc +0 -0
  14. trackma/__pycache__/utils.cpython-36.pyc +0 -0
  15. trackma/accounts.py +145 -0
  16. trackma/data/anilist.jpg +0 -0
  17. trackma/data/icon.png +0 -0
  18. trackma/data/kitsu.png +0 -0
  19. trackma/data/mal.jpg +0 -0
  20. trackma/data/shikimori.jpg +0 -0
  21. trackma/data/vndb.jpg +0 -0
  22. trackma/data.py +620 -0
  23. trackma/engine.py +979 -0
  24. trackma/extras/AnimeInfoExtractor.py +317 -0
  25. trackma/extras/__init__.py +1 -0
  26. trackma/extras/__pycache__/AnimeInfoExtractor.cpython-36.pyc +0 -0
  27. trackma/extras/__pycache__/__init__.cpython-36.pyc +0 -0
  28. trackma/lib/__init__.py +0 -0
  29. trackma/lib/__pycache__/__init__.cpython-36.pyc +0 -0
  30. trackma/lib/__pycache__/lib.cpython-36.pyc +0 -0
  31. trackma/lib/__pycache__/libanilist.cpython-36.pyc +0 -0
  32. trackma/lib/__pycache__/libkitsu.cpython-36.pyc +0 -0
  33. trackma/lib/__pycache__/libmal.cpython-36.pyc +0 -0
  34. trackma/lib/__pycache__/libshikimori.cpython-36.pyc +0 -0
  35. trackma/lib/__pycache__/libvndb.cpython-36.pyc +0 -0
  36. trackma/lib/lib.py +162 -0
  37. trackma/lib/libanilist.py +474 -0
  38. trackma/lib/libkitsu.py +506 -0
  39. trackma/lib/libmal.py +707 -0
  40. trackma/lib/libshikimori.py +340 -0
  41. trackma/lib/libvndb.py +387 -0
  42. trackma/messenger.py +42 -0
  43. trackma/tracker/__init__.py +0 -0
  44. trackma/tracker/__pycache__/__init__.cpython-36.pyc +0 -0
  45. trackma/tracker/__pycache__/inotify.cpython-36.pyc +0 -0
  46. trackma/tracker/__pycache__/inotifyBase.cpython-36.pyc +0 -0
  47. trackma/tracker/__pycache__/plex.cpython-36.pyc +0 -0
  48. trackma/tracker/__pycache__/polling.cpython-36.pyc +0 -0
  49. trackma/tracker/__pycache__/pyinotify.cpython-36.pyc +0 -0
  50. trackma/tracker/__pycache__/tracker.cpython-36.pyc +0 -0
  51. trackma/tracker/__pycache__/win32.cpython-36.pyc +0 -0
  52. trackma/tracker/inotify.py +69 -0
  53. trackma/tracker/inotifyBase.py +107 -0
  54. trackma/tracker/plex.py +144 -0
  55. trackma/tracker/polling.py +55 -0
  56. trackma/tracker/pyinotify.py +90 -0
  57. trackma/tracker/tracker.py +226 -0
  58. trackma/tracker/win32.py +74 -0
  59. trackma/ui/__init__.py +0 -0
  60. trackma/ui/__pycache__/__init__.cpython-36.pyc +0 -0
  61. trackma/ui/__pycache__/cli-single.cpython-36.pyc +0 -0
  62. trackma/ui/__pycache__/cli.cpython-36.pyc +0 -0
  63. trackma/ui/__pycache__/curses.cpython-36.pyc +0 -0
  64. trackma/ui/__pycache__/gtkui.cpython-36.pyc +0 -0
  65. trackma/ui/__pycache__/qt4ui.cpython-36.pyc +0 -0
  66. trackma/ui/__pycache__/qtui.cpython-36.pyc +0 -0
  67. trackma/ui/cli-single.py +3 -0
  68. trackma/ui/cli.py +1035 -0
  69. trackma/ui/curses.py +1156 -0
  70. trackma/ui/gtkui.py +2847 -0
  71. trackma/ui/qt4ui.py +25 -0
  72. trackma/ui/qtui.py +3273 -0
  73. trackma/utils.py +416 -0
@@ -0,0 +1,317 @@
1
+ # This file is part of Trackma.
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+ #
16
+
17
+ import re
18
+ from decimal import Decimal
19
+
20
+ class AnimeInfoExtractor():
21
+ """
22
+ Extracts lots of information about anime from filename alone
23
+ @author: Tyris
24
+ @author: Uriziel
25
+ @note: Thanks for Tyris for providing easy way to extract data
26
+ @note: Does more than what's needed, but that behaviour is well tested
27
+ """
28
+ def __init__(self, filename):
29
+ self.originalFilename = filename
30
+ self.resolution = ''
31
+ self.hash = ''
32
+ self.subberTag = ''
33
+ self.videoType = []
34
+ self.audioType = []
35
+ self.releaseSource = []
36
+ self.extension = ''
37
+ self.episodeStart = None
38
+ self.episodeEnd = None
39
+ self.volumeStart = None
40
+ self.volumeEnd = None
41
+ self.version = 1
42
+ self.name = ''
43
+ self.pv = -1
44
+ self._processFilename()
45
+
46
+ def getName(self):
47
+ return self.name
48
+
49
+ def getEpisodeNumbers(self, force_numbers=False):
50
+ ep_start = self.episodeStart
51
+ ep_end = self.episodeEnd
52
+ if force_numbers:
53
+ if ep_start is None:
54
+ ep_start = 1
55
+ if ep_end is None:
56
+ ep_end = ep_start
57
+ ep_start = int(ep_start)
58
+ ep_end = int(ep_end)
59
+ return ep_start, ep_end
60
+
61
+ def getEpisode(self):
62
+ ep = self.episodeStart if self.episodeEnd is None else self.episodeEnd
63
+ ep = ep if ep is not None else 1
64
+
65
+ return int(ep)
66
+
67
+ def __extractExtension(self, filename):
68
+ m = re.search("\.(\w{3})$", filename)
69
+ if m:
70
+ self.extension = m.group(1)
71
+ filename = filename[:-4]
72
+ return filename
73
+
74
+ def __cleanUpSpaces(self, filename):
75
+ filename = filename.replace('_', ' ')
76
+ if not ' ' in filename:
77
+ filename = re.sub('([^.])\.([^.])', r'\1 \2', filename)
78
+ # to handle .-. case (where - is any single chara)
79
+ filename = re.sub('([^.])\.([^.])', r'\1 \2', filename)
80
+ # If there are still no spaces try replacing hyphens with spaces
81
+ if not ' ' in filename:
82
+ filename = re.sub('([^\-])-([^\-])', r'\1 \2', filename)
83
+ # to handle -.- case (where . is any single chara)
84
+ filename = re.sub('([^\-])-([^\-])', r'\1 \2', filename)
85
+ return filename
86
+
87
+ def __extractSpecialTags(self, filename):
88
+ tags = {'video': ['H264', 'H.264', 'x264', 'XviD', 'DivX', 'MP4'],
89
+ 'audio': ['AC3', 'AAC', 'MP3', 'FLAC'],
90
+ 'source': ['TV', 'DVD', 'BluRay', 'BD', 'Blu-Ray', 'BDMV']}
91
+ for k, v in tags.items():
92
+ for tag in v:
93
+ m = re.search('(?:[\(\[](?:|[^\)\]]*?[^0-9a-zA-Z\)\]]))(' + tag + ')(?:[^0-9a-zA-Z]|$)', filename, flags=re.IGNORECASE)
94
+ if m:
95
+ if (k == 'video'):
96
+ self.videoType.append(tag)
97
+ elif (k == 'audio'):
98
+ self.audioType.append(tag)
99
+ elif (k == 'source'):
100
+ self.releaseSource.append(tag)
101
+ filename = filename[:m.start(1)] + '###NO#SUBBER#HERE###' + filename[m.end(1):] # remove the match
102
+ return filename
103
+
104
+ def __extractVideoProfile(self, filename):
105
+ # Check for 8bit/10bit
106
+ tags_10bit = ['Hi10P', 'Hi10', '10bit', '10 bit', '10-bit']
107
+ tags_8bit = ['8bit', '8-bit']
108
+ for tag in tags_10bit:
109
+ if tag in filename:
110
+ self.videoType = ['H264', 'Hi10P']
111
+ # Don't replace Hi10 coz its a subber name
112
+ if tag != 'Hi10':
113
+ filename = filename.replace(tag, '')
114
+ return filename
115
+ if not self.videoType == ['H264', 'Hi10P']:
116
+ for tag in tags_8bit:
117
+ if tag in filename:
118
+ self.videoType = ['H264', '8bit']
119
+ filename = filename.replace(tag, '')
120
+ return filename
121
+ return filename
122
+
123
+ def __extractResolution(self, filename):
124
+ # Match 3 or 4 chars followed by p, i, or x and 3 or 4 more chars, surrounded by any non-alphanumberic chars
125
+ m = re.search('(?:[^0-9a-zA-Z])(\d{3,4}(?:p|i|x\d{3,4}))(?:[^0-9a-zA-Z]|$)', filename)
126
+ if m:
127
+ self.resolution = m.group(1)
128
+ filename = filename[:m.start(1)] + filename[m.end(1):]
129
+ else:
130
+ m = re.search('(?:\[|\(|\d)(HD|SD)(?:\]|\)| |\.)', filename)
131
+ if m:
132
+ self.resolution = m.group(1)
133
+ filename = filename[:m.start(1)] + filename[m.end(1):]
134
+ else:
135
+ m = re.search('(?:\d{1,3})(HD|SD)(?:[^a-zA-Z])', filename)
136
+ if m:
137
+ self.resolution = m.group(1)
138
+ filename = filename[:m.start(1)] + filename[m.end(1):] # Super special case for HD/SD imediately after episode
139
+ return filename
140
+
141
+ def __extractHash(self, filename):
142
+ # Match anything in square or round brackets that is 8 hex digits
143
+ m = re.search('(?:\[|\()((?:[A-F]|[a-f]|\d){8})(?:\]|\))', filename)
144
+ if m:
145
+ self.hash = m.group(1)
146
+ filename = filename[:m.start()] + filename[m.end():]
147
+ return filename
148
+
149
+ def __checkIfRemux(self, filename):
150
+ m = re.search('(?:[\(\[][^\)\]]*?[^0-9a-zA-Z\)\]]?)(Remux)(?:[^0-9a-zA-Z]|$)', filename, flags=re.IGNORECASE)
151
+ return True if m else False
152
+
153
+ def __cleanUpBrackets(self, filename):
154
+ # Can get rid of the brackets that won't contain subber
155
+ filename = re.sub('\((?:[^\)]*?)###NO#SUBBER#HERE##(?:.*?)\)', '', filename)
156
+ filename = re.sub('\[(?:[^\]]*?)###NO#SUBBER#HERE##(?:.*?)\]', '', filename)
157
+ # Strip any empty sets of brackets
158
+ filename = re.sub('(?:\[(?:[^0-9a-zA-Z]*?)\])|(?:\((?:[^0-9a-zA-Z]*?)\))', ' ', filename)
159
+ return filename
160
+
161
+ def __extractSubber(self, filename, remux):
162
+ # Extract the subber from square brackets (or round failing that)
163
+ m = re.search('\[([^\. ].*?)\]', filename)
164
+ if m:
165
+ self.subberTag = m.group(1)
166
+ filename = filename[:m.start()] + filename[m.end():]
167
+ else:
168
+ m = re.search('\(([^\. ].*?)\)', filename)
169
+ if m:
170
+ self.subberTag = m.group(1)
171
+ filename = filename[:m.start()] + filename[m.end():]
172
+ else:
173
+ m = re.search('{([^\. ].*?)}', filename)
174
+ if m:
175
+ self.subberTag = m.group(1)
176
+ filename = filename[:m.start()] + filename[m.end():]
177
+ self.subberTag = self.subberTag.strip(' -')
178
+ # Add the remux string if this was a remux and its not found in the subber tag
179
+ if remux and not 'remux' in self.subberTag.lower():
180
+ # refind remux and remove it
181
+ m = re.search('(?:[\(\[][^\)\]]*?[^0-9a-zA-Z\)\]]?)(Remux)(?:[^0-9a-zA-Z]|$)', filename, flags=re.IGNORECASE)
182
+ if m:
183
+ filename = filename[:m.start(1)] + filename[m.end(1):]
184
+ if self.subberTag:
185
+ self.subberTag = self.subberTag + '-Remux'
186
+ else:
187
+ self.subberTag = 'Remux'
188
+ return filename
189
+
190
+ def __extractVersion(self, filename):
191
+ # Extract the version number (limit at v7 since V8 is possible in a title...)
192
+ m = re.search('(?:[^a-zA-Z])v([0-7])(?:[^0-9a-zA-Z]|$)', filename, flags=re.IGNORECASE)
193
+ if m:
194
+ self.version = int(m.group(1))
195
+ filename = filename[:m.start(1) - 1] + filename[m.end(1):]
196
+ return filename
197
+
198
+ def __extractVolumeIfPack(self, filename, title_len):
199
+ # Check if this is a volume pack - only relevant for no extension
200
+ if not self.extension:
201
+ m = re.search('[^0-9a-zA-Z](?:vol(?:ume)?\.? ?)(\d{1,3})(?: ?- ?(?:vol(?:ume)?\.? ?)?(\d{1,3}))?(?:[^0-9a-zA-Z]|$)', filename, flags=re.IGNORECASE)
202
+ if m:
203
+ self.volumeStart = int(m.group(1))
204
+ if m.group(2):
205
+ self.volumeEnd = int(m.group(2))
206
+ filename = filename[:m.start()] + filename[m.end():]
207
+ title_len = m.start()
208
+ return filename, title_len
209
+
210
+ def __extractPv(self, filename):
211
+ # Check if this is a PV release (not relevant if its a pack)
212
+ m = re.search(' PV ?(\d)?(?:[^a-zA-Z0-9]|$)', filename)
213
+ if not self.volumeStart and m:
214
+ self.pv = 0
215
+ if m.group(1):
216
+ self.pv = int(m.group(1))
217
+ filename = filename[:m.start(0)]
218
+ return filename
219
+
220
+ def __extractEpisodeNumbers(self, filename):
221
+ # First check for concurrent episodes (with a + or &)
222
+ m = re.search('[^0-9a-zA-Z](?:E\.?|Ep(?:i|isode)?s?(?: |\.)?)?(\d{1,4})[\+\&](\d{1,4})(?:[^0-9a-zA-Z]|$)', filename, flags=re.IGNORECASE)
223
+ if m:
224
+ start = int(m.group(1))
225
+ end = int(m.group(2))
226
+ if end == start + 1:
227
+ self.episodeStart = start
228
+ self.episodeEnd = end
229
+ filename = filename[:m.start() + 1]
230
+ if not self.episodeStart:
231
+ # Check for multiple episodes
232
+ if self.extension:
233
+ # no spaces allowed around the hyphen
234
+ ep_search_string = '[^0-9a-zA-Z](?:E\.?|Ep(?:i|isode)?(?: |\.)?)?((?:\d{1,3}|1[0-8]\d{2})(?:\.\d{1})?)-(\d{1,4}(?:\.\d{1})?)(?:[^0-9a-zA-Z]|$)'
235
+ else:
236
+ ep_search_string = '[^0-9a-zA-Z](?:E\.?|Ep(?:i|isode)?(?: |\.)?)?((?:\d{1,3}|1[0-8]\d{2})(?:\.\d{1})?) ?- ?(\d{1,4}(?:\.\d{1})?)(?:[^0-9a-zA-Z]|$)' # probably a pack... so allow spaces around the hyphen
237
+ m = re.search(ep_search_string, filename, flags=re.IGNORECASE)
238
+ if m:
239
+ self.episodeStart = Decimal(m.group(1))
240
+ self.episodeEnd = Decimal(m.group(2))
241
+ filename = filename[:m.start() + 1]
242
+ if not self.episodeStart:
243
+ # Check if there is an episode specifier
244
+ m = re.search('(?:[^0-9a-zA-Z])(E\.?|Ep(?:i|isode)?(?: |\.)?)(\d{1,}(?:\.\d{1})?)(?:[^\d]|$)', filename, flags=re.IGNORECASE)
245
+ if m:
246
+ self.episodeStart = Decimal(m.group(2))
247
+ filename = filename[:m.start() + 1]
248
+ if not self.episodeStart:
249
+ # Check any remaining lonely numbers as episode (towards the end has priority)
250
+ # First try outside brackets
251
+ m = re.search('(?:.*)(?:[^0-9a-zA-Z\.])((?:\d{1,3}|1[0-8]\d{2})(?:\.\d{1})?)(?:[^0-9a-zA-Z]|$)', filename)
252
+ if m:
253
+ self.episodeStart = Decimal(m.group(1))
254
+ filename = filename[:m.start(1)]
255
+ if not self.episodeStart:
256
+ # then allow brackets
257
+ m = re.search('(?:.*)(?:[^0-9a-zA-Z\.\[\(])((?:\d{1,3}|1[0-8]\d{2})(?:\.\d{1})?)(?:[^0-9a-zA-Z\]\)]|$)', filename)
258
+ if m:
259
+ self.episodeStart = Decimal(m.group(1))
260
+ filename = filename[:m.start(1)]
261
+ return filename
262
+
263
+ def __extractShowName(self, filename):
264
+ # Unfortunately its very hard to know if there should be brackets in the title...
265
+ # We really should strip brackets... so to anything with brackets in the title: sorry =(
266
+ # Strip anything thats still in brackets, but backup the first case incase it IS the title...
267
+ m = re.search('\[([^\. ].*?)\]', filename)
268
+ backup_title = ''
269
+ if m:
270
+ backup_title = m.group(1)
271
+ filename = filename[:m.start()] + filename[m.end():]
272
+ else:
273
+ m = re.search('\(([^\. ].*?)\)', filename)
274
+ if m:
275
+ backup_title = m.group(1)
276
+ filename = filename[:m.start()] + filename[m.end():]
277
+ else:
278
+ m = re.search('{([^\. ].*?)}', filename)
279
+ if m:
280
+ backup_title = m.group(1)
281
+ filename = filename[:m.start()] + filename[m.end():]
282
+ filename = re.sub('(?:\[.*?\])|(?:\(.*?\))', ' ', filename)
283
+ filename = filename.strip(' -')
284
+ filename = re.sub(' (?:.*)', '', filename)
285
+ # Strip any unclosed brackets and anything after them
286
+ filename = re.sub('(.*)(?:[\(\[({].*)$', r'\1', filename)
287
+ self.name = filename.strip(' -')
288
+ if self.name == '':
289
+ self.name = backup_title
290
+ # If we have a subber but no title!? then it must have been a title...
291
+ if self.name == '' and self.subberTag != '':
292
+ self.name = self.subberTag
293
+ self.subberTag = ''
294
+
295
+ def _processFilename(self):
296
+ filename = self.originalFilename
297
+ filename = self.__extractExtension(filename)
298
+ filename = self.__cleanUpSpaces(filename)
299
+ filename = self.__extractSpecialTags(filename)
300
+ filename = self.__extractVideoProfile(filename)
301
+ filename = self.__extractResolution(filename)
302
+ filename = self.__extractHash(filename)
303
+ remux = self.__checkIfRemux(filename)
304
+ filename = self.__cleanUpBrackets(filename)
305
+ filename = self.__extractSubber(filename, remux)
306
+ filename = self.__extractVersion(filename)
307
+ # Store the possible length of the title
308
+ title_len = len(filename)
309
+ filename, title_len = self.__extractVolumeIfPack(filename, title_len)
310
+ filename = self.__extractPv(filename)
311
+ if self.pv == -1:
312
+ filename = self.__extractEpisodeNumbers(filename)
313
+ # Truncate remainder to title length if needed (for where volume was found)
314
+ filename = filename[:title_len]
315
+ # Strip any trailing opening brackets
316
+ filename = filename.rstrip('([{')
317
+ self.__extractShowName(filename)
@@ -0,0 +1 @@
1
+ from trackma.extras.AnimeInfoExtractor import AnimeInfoExtractor
File without changes
trackma/lib/lib.py ADDED
@@ -0,0 +1,162 @@
1
+ # This file is part of Trackma.
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+ #
16
+
17
+ from trackma import utils
18
+
19
+ class lib():
20
+ """
21
+ Base interface for creating API implementations for Trackma.
22
+
23
+ messenger: Messenger object to send useful messages to
24
+ mediatype: String containing the media type to be used
25
+ """
26
+ name = 'lib'
27
+ version = 'dummy'
28
+ msg = None
29
+
30
+ api_info = { 'name': 'BaseAPI', 'version': 'undefined', 'merge': False }
31
+ """
32
+ api_info is a dictionary containing useful information about the API itself
33
+ name: API name
34
+ version: API version
35
+ """
36
+
37
+ mediatypes = dict()
38
+ """
39
+ mediatypes is a dictionary containing the possible mediatypes for the current API.
40
+ An example mediatype should look like this:
41
+ ::
42
+
43
+ mediatypes['anime'] = {
44
+ 'has_progress': True,
45
+ 'can_add': True,
46
+ 'can_delete': True,
47
+ 'can_score': True,
48
+ 'can_status': True,
49
+ 'can_update': True,
50
+ 'can_play': True,
51
+ 'status_start': 1,
52
+ 'status_finish': 2,
53
+ 'statuses': [1, 2, 3, 4, 6],
54
+ 'statuses_dict': { 1: 'Watching', 2: 'Completed', 3: 'On Hold', 4: 'Dropped', 6: 'Plan to Watch' },
55
+ }
56
+
57
+ """
58
+
59
+ default_mediatype = None
60
+
61
+ # Supported signals for the data handler
62
+ signals = {
63
+ 'show_info_changed': None,
64
+ 'userconfig_changed': None,
65
+ }
66
+
67
+ def __init__(self, messenger, account, userconfig):
68
+ """Initializes the API"""
69
+ self.userconfig = userconfig
70
+ self.msg = messenger
71
+ self.msg.info(self.name, 'Initializing...')
72
+
73
+ if not userconfig.get('mediatype'):
74
+ userconfig['mediatype'] = self.default_mediatype
75
+
76
+ if userconfig['mediatype'] in self.mediatypes:
77
+ self.mediatype = userconfig['mediatype']
78
+ else:
79
+ raise utils.APIFatal('Unsupported mediatype %s.' % userconfig['mediatype'])
80
+
81
+ self.api_info['mediatype'] = self.mediatype
82
+ self.api_info['supported_mediatypes'] = list(self.mediatypes.keys())
83
+
84
+ def _emit_signal(self, signal, *args):
85
+ try:
86
+ if self.signals[signal]:
87
+ self.signals[signal](*args)
88
+ except KeyError:
89
+ raise Exception("Call to undefined signal.")
90
+
91
+ def _get_userconfig(self, key):
92
+ return self.userconfig.get(key)
93
+
94
+ def _set_userconfig(self, key, value):
95
+ self.userconfig[key] = value
96
+
97
+ def connect_signal(self, signal, callback):
98
+ try:
99
+ self.signals[signal] = callback
100
+ except KeyError:
101
+ raise utils.EngineFatal("Invalid signal.")
102
+
103
+ def check_credentials(self):
104
+ """Checks if credentials are correct; returns True or False."""
105
+ raise NotImplementedError
106
+
107
+ def fetch_list(self):
108
+ """
109
+ Fetches the remote list and returns a dictionary of show dictionaries.
110
+
111
+ It should return a dictionary with the show ID as the key and a show dictionary as its value.
112
+ You can create an empty show dictionary with the :func:`utils.show` function.
113
+ """
114
+ raise NotImplementedError
115
+
116
+ def add_show(self, item):
117
+ """
118
+ Adds the **item** in the remote server list. The **item** is a show dictionary passed by the Data Handler.
119
+ """
120
+ raise NotImplementedError
121
+
122
+ def update_show(self, item):
123
+ """
124
+ Sends the updates of a show to the remote site.
125
+
126
+ This function gets called every time a show should be updated remotely,
127
+ and in a queue it may be called many times consecutively, so you should
128
+ use a boolean (or other method) to login only once.
129
+
130
+ """
131
+ raise NotImplementedError
132
+
133
+ def delete_show(self, item):
134
+ """
135
+ Deletes the **item** in the remote server list. The **item** is a show dictionary passed by the Data Handler.
136
+ """
137
+ raise NotImplementedError
138
+
139
+ def search(self, criteria):
140
+ """
141
+ Called when the data handler needs a detailed list of shows from the remote server.
142
+ It should return a list of show dictionaries with the additional 'extra' key (which is a list of tuples)
143
+ containing any additional detailed information about the show.
144
+ """
145
+ raise NotImplementedError
146
+
147
+ def request_info(self, items):
148
+ # Request detailed information for requested shows
149
+ raise NotImplementedError
150
+
151
+ def logout(self):
152
+ # This is called whenever the API won't be required
153
+ # for a good while
154
+ pass
155
+
156
+ def media_info(self):
157
+ """Return information about the currently selected mediatype."""
158
+ return self.mediatypes[self.mediatype]
159
+
160
+ def set_message_handler(self, message_handler):
161
+ self.msg = message_handler
162
+