trackma 0.6.2__py3.4.egg → 0.7__py3.4.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 (62) hide show
  1. EGG-INFO/PKG-INFO +1 -1
  2. EGG-INFO/SOURCES.txt +9 -6
  3. trackma/__pycache__/__init__.cpython-34.pyc +0 -0
  4. trackma/__pycache__/accounts.cpython-34.pyc +0 -0
  5. trackma/__pycache__/data.cpython-34.pyc +0 -0
  6. trackma/__pycache__/engine.cpython-34.pyc +0 -0
  7. trackma/__pycache__/messenger.cpython-34.pyc +0 -0
  8. trackma/__pycache__/utils.cpython-34.pyc +0 -0
  9. trackma/data/kitsu.png +0 -0
  10. trackma/data.py +26 -16
  11. trackma/engine.py +60 -16
  12. trackma/extras/AnimeInfoExtractor.py +1 -1
  13. trackma/extras/__pycache__/AnimeInfoExtractor.cpython-34.pyc +0 -0
  14. trackma/extras/__pycache__/__init__.cpython-34.pyc +0 -0
  15. trackma/lib/__pycache__/__init__.cpython-34.pyc +0 -0
  16. trackma/lib/__pycache__/lib.cpython-34.pyc +0 -0
  17. trackma/lib/__pycache__/libanilist.cpython-34.pyc +0 -0
  18. trackma/lib/__pycache__/libkitsu.cpython-34.pyc +0 -0
  19. trackma/lib/__pycache__/libmal.cpython-34.pyc +0 -0
  20. trackma/lib/__pycache__/libshikimori.cpython-34.pyc +0 -0
  21. trackma/lib/__pycache__/libvndb.cpython-34.pyc +0 -0
  22. trackma/lib/libanilist.py +3 -3
  23. trackma/lib/libkitsu.py +478 -0
  24. trackma/lib/libmal.py +6 -6
  25. trackma/lib/libshikimori.py +3 -3
  26. trackma/lib/libvndb.py +12 -9
  27. trackma/messenger.py +1 -1
  28. trackma/tracker/__init__.py +0 -0
  29. trackma/tracker/__pycache__/__init__.cpython-34.pyc +0 -0
  30. trackma/tracker/__pycache__/inotify.cpython-34.pyc +0 -0
  31. trackma/tracker/__pycache__/plex.cpython-34.pyc +0 -0
  32. trackma/tracker/__pycache__/polling.cpython-34.pyc +0 -0
  33. trackma/tracker/__pycache__/pyinotify.cpython-34.pyc +0 -0
  34. trackma/tracker/__pycache__/tracker.cpython-34.pyc +0 -0
  35. trackma/tracker/__pycache__/win32.cpython-34.pyc +0 -0
  36. trackma/tracker/inotify.py +123 -0
  37. trackma/tracker/plex.py +99 -0
  38. trackma/tracker/polling.py +55 -0
  39. trackma/tracker/pyinotify.py +143 -0
  40. trackma/tracker/tracker.py +213 -0
  41. trackma/tracker/win32.py +74 -0
  42. trackma/ui/__pycache__/__init__.cpython-34.pyc +0 -0
  43. trackma/ui/__pycache__/cli.cpython-34.pyc +0 -0
  44. trackma/ui/__pycache__/curses.cpython-34.pyc +0 -0
  45. trackma/ui/__pycache__/gtkui.cpython-34.pyc +0 -0
  46. trackma/ui/__pycache__/qt4ui.cpython-34.pyc +0 -0
  47. trackma/ui/__pycache__/qtui.cpython-34.pyc +0 -0
  48. trackma/ui/cli.py +109 -12
  49. trackma/ui/curses.py +87 -29
  50. trackma/ui/gtkui.py +81 -45
  51. trackma/ui/qtui.py +95 -34
  52. trackma/utils.py +15 -9
  53. trackma/__pycache__/tracker.cpython-34.pyc +0 -0
  54. trackma/data/hb.jpg +0 -0
  55. trackma/data/melative.jpg +0 -0
  56. trackma/extras/__pycache__/plex.cpython-34.pyc +0 -0
  57. trackma/extras/plex.py +0 -101
  58. trackma/lib/__pycache__/libhb.cpython-34.pyc +0 -0
  59. trackma/lib/__pycache__/libmelative.cpython-34.pyc +0 -0
  60. trackma/lib/libhb.py +0 -239
  61. trackma/lib/libmelative.py +0 -204
  62. trackma/tracker.py +0 -430
@@ -0,0 +1,478 @@
1
+ # -*- coding: utf-8 -*-
2
+ # This file is part of Trackma.
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, either version 3 of the License, or
7
+ # (at your option) any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ #
17
+
18
+ import datetime
19
+ import time
20
+ import urllib.parse
21
+ import urllib.request
22
+ import json
23
+ import gzip
24
+ import socket
25
+
26
+ #import http.client
27
+ #http.client.HTTPConnection.debuglevel = 1
28
+
29
+ from trackma.lib.lib import lib
30
+ from trackma import utils
31
+
32
+
33
+ class libkitsu(lib):
34
+ """
35
+ API class to communicate with Kitsu
36
+ Should inherit a base library interface.
37
+
38
+ Website: https://kitsu.io/
39
+ API documentation:
40
+ Designed by:
41
+
42
+ """
43
+ name = 'libkitsu'
44
+ user_agent = 'Trackma/{}'.format(utils.VERSION)
45
+
46
+ auth = ''
47
+ logged_in = False
48
+
49
+ api_info = {
50
+ 'name': 'Kitsu',
51
+ 'shortname': 'kitsu',
52
+ 'version': 'v0.3',
53
+ 'merge': True
54
+ }
55
+
56
+ default_mediatype = 'anime'
57
+ default_statuses = ['current', 'completed', 'on_hold', 'dropped', 'planned']
58
+ default_statuses_dict = {
59
+ 'current': 'Watching',
60
+ 'completed': 'Completed',
61
+ 'on_hold': 'On Hold',
62
+ 'dropped': 'Dropped',
63
+ 'planned': 'Plan to Watch'
64
+ }
65
+
66
+ mediatypes = dict()
67
+ mediatypes['anime'] = {
68
+ 'has_progress': True,
69
+ 'can_add': True,
70
+ 'can_delete': True,
71
+ 'can_score': True,
72
+ 'can_status': True,
73
+ 'can_update': True,
74
+ 'can_play': True,
75
+ 'status_start': 'current',
76
+ 'status_finish': 'completed',
77
+ 'statuses': default_statuses,
78
+ 'statuses_dict': default_statuses_dict,
79
+ 'score_max': 5,
80
+ 'score_step': 0.5,
81
+ }
82
+ mediatypes['manga'] = {
83
+ 'has_progress': True,
84
+ 'can_add': True,
85
+ 'can_delete': True,
86
+ 'can_score': True,
87
+ 'can_status': True,
88
+ 'can_update': True,
89
+ 'can_play': False,
90
+ 'status_start': 'current',
91
+ 'status_finish': 'completed',
92
+ 'statuses': default_statuses,
93
+ 'statuses_dict': default_statuses_dict,
94
+ 'score_max': 5,
95
+ 'score_step': 0.5,
96
+ }
97
+ mediatypes['drama'] = {
98
+ 'has_progress': True,
99
+ 'can_add': True,
100
+ 'can_delete': True,
101
+ 'can_score': True,
102
+ 'can_status': True,
103
+ 'can_update': True,
104
+ 'can_play': True,
105
+ 'status_start': 'current',
106
+ 'status_finish': 'completed',
107
+ 'statuses': default_statuses,
108
+ 'statuses_dict': default_statuses_dict,
109
+ 'score_max': 5,
110
+ 'score_step': 0.5,
111
+ }
112
+
113
+ url = 'https://kitsu.io/api'
114
+ prefix = 'https://kitsu.io/api/edge'
115
+
116
+ # TODO : These values are previsional.
117
+ _client_id = 'dd031b32d2f56c990b1425efe6c42ad847e7fe3ab46bf1299f05ecd856bdb7dd'
118
+ _client_secret = '54d7307928f63414defd96399fc31ba847961ceaecef3a5fd93144e960c0e151'
119
+
120
+ status_translate = {'Currently Airing': utils.STATUS_AIRING,
121
+ 'Finished Airing': utils.STATUS_FINISHED,
122
+ 'Not Yet Aired': utils.STATUS_NOTYET}
123
+
124
+ def __init__(self, messenger, account, userconfig):
125
+ """Initializes the useragent through credentials."""
126
+ super(libkitsu, self).__init__(messenger, account, userconfig)
127
+
128
+ self.username = account['username']
129
+ self.password = account['password']
130
+
131
+ # Build opener with the mashape API key
132
+ self.opener = urllib.request.build_opener()
133
+ self.opener.addheaders = [
134
+ ('User-Agent', self.user_agent),
135
+ ('Accept', 'application/vnd.api+json'),
136
+ ('Accept-Encoding', 'gzip'),
137
+ ('Accept-Charset', 'utf-8'),
138
+ ]
139
+
140
+ def _request(self, method, url, get=None, post=None, body=None, auth=False):
141
+ content_type = None
142
+
143
+ if get:
144
+ url += "?%s" % urllib.parse.urlencode(get)
145
+ if post:
146
+ post = urllib.parse.urlencode(post).encode('utf-8')
147
+ content_type = 'application/x-www-form-urlencoded'
148
+ if body:
149
+ post = body.encode('utf-8')
150
+ content_type = 'application/vnd.api+json'
151
+
152
+ request = urllib.request.Request(url, post)
153
+ request.get_method = lambda: method
154
+
155
+ if content_type:
156
+ request.add_header('Content-Type', content_type)
157
+
158
+ if auth:
159
+ request.add_header('Authorization', '{0} {1}'.format(
160
+ self._get_userconfig('token_type').capitalize(),
161
+ self._get_userconfig('access_token'),
162
+ ))
163
+
164
+ try:
165
+ response = self.opener.open(request)
166
+
167
+ # The response most probably will be gzipped so we
168
+ # have to take care of that first
169
+ if response.info().get('content-encoding') == 'gzip':
170
+ return gzip.GzipFile(fileobj=response).read().decode('utf-8')
171
+ else:
172
+ return response.read().decode('utf-8')
173
+ except urllib.request.HTTPError as e:
174
+ if e.code == 401:
175
+ raise utils.APIError("Incorrect credentials.")
176
+ else:
177
+ api_error = self._parse_errors(e)
178
+ if api_error:
179
+ raise utils.APIError("API error: %s" % api_error)
180
+ else:
181
+ raise utils.APIError("Connection error: %s" % e)
182
+ except urllib.request.URLError as e:
183
+ raise utils.APIError("URL error: %s" % e)
184
+ except socket.timeout:
185
+ raise utils.APIError("Operation timed out.")
186
+
187
+ def _parse_errors(self, e):
188
+ try:
189
+ data = json.loads(e.read().decode('utf-8'))
190
+ errors = ""
191
+ for error in data['errors']:
192
+ errors += "{}: {}".format(error['code'], error['detail'])
193
+
194
+ return errors
195
+ except:
196
+ return None
197
+
198
+ def _request_access_token(self, refresh=False):
199
+ params = {
200
+ 'client_id': self._client_id,
201
+ 'client_secret': self._client_secret,
202
+ }
203
+
204
+ if refresh:
205
+ self.msg.info(self.name, 'Refreshing access token...')
206
+
207
+ params['grant_type'] = 'refresh_token'
208
+ params['refresh_token'] = self._get_userconfig('refresh_token')
209
+ else:
210
+ self.msg.info(self.name, 'Requesting access token...')
211
+
212
+ params['grant_type'] = 'password'
213
+ params['username'] = self.username
214
+ params['password'] = self.password
215
+
216
+ response = self._request('POST', self.url + '/oauth/token', post=params)
217
+ data = json.loads(response)
218
+
219
+ timestamp = int(time.time())
220
+
221
+ self._set_userconfig('access_token', data['access_token'])
222
+ self._set_userconfig('token_type', data['token_type'])
223
+ self._set_userconfig('expires', timestamp + data['expires_in'])
224
+ self._set_userconfig('refresh_token', data['refresh_token'])
225
+
226
+ self.logged_in = True
227
+ self._refresh_user_info()
228
+ self._emit_signal('userconfig_changed')
229
+
230
+ def _refresh_user_info(self):
231
+ self.msg.info(self.name, 'Refreshing user details...')
232
+ params = {
233
+ "filter[name]": self.username,
234
+ }
235
+ data = self._request('GET', self.prefix + "/users", get=params)
236
+ json_data = json.loads(data)
237
+ user = json_data['data'][0]
238
+
239
+ # Parse user information
240
+ self._set_userconfig('userid', user['id'])
241
+ self._set_userconfig('username', user['attributes']['name'])
242
+
243
+ def check_credentials(self):
244
+ """
245
+ Log into Kitsu. If there isn't an acess token, request it, or
246
+ refresh it if necessary.
247
+ """
248
+ timestamp = int(time.time())
249
+
250
+ if not self._get_userconfig('access_token'):
251
+ self._request_access_token(False)
252
+ elif (timestamp+60) > self._get_userconfig('expires'):
253
+ self._request_access_token(True)
254
+ else:
255
+ self.logged_in = True
256
+
257
+ return True
258
+
259
+ def fetch_list(self):
260
+ """Queries the full list from the remote server.
261
+ Returns the list if successful, False otherwise."""
262
+ self.check_credentials()
263
+ self.msg.info(self.name, 'Downloading list...')
264
+
265
+ try:
266
+ showlist = dict()
267
+ infolist = list()
268
+
269
+ # Get first page and continue from there
270
+ params = {
271
+ "filter[user_id]": self._get_userconfig('userid'),
272
+ "filter[kind]": self.mediatype,
273
+ #"include": self.mediatype, # TODO : This returns a 500 for some reason.
274
+ "include": "media",
275
+ # TODO : List for manga should be different
276
+ "fields[anime]": "id,slug,canonicalTitle,titles,episodeCount,synopsis,subtype,posterImage",
277
+ "page[limit]": "250",
278
+ }
279
+
280
+ url = "{}/library-entries?{}".format(self.prefix, urllib.parse.urlencode(params))
281
+ i = 1
282
+
283
+ while url:
284
+ self.msg.info(self.name, 'Getting page {}...'.format(i))
285
+
286
+ data = self._request('GET', url)
287
+ data_json = json.loads(data)
288
+
289
+ #print(json.dumps(data_json, sort_keys=True, indent=2))
290
+ #return []
291
+
292
+ entries = data_json['data']
293
+ links = data_json['links']
294
+
295
+ for entry in entries:
296
+ # TODO : Including the mediatype returns a 500 for some reason.
297
+ #showid = int(entry['relationships'][self.mediatype]['data']['id'])
298
+ showid = int(entry['relationships']['media']['data']['id'])
299
+ status = entry['attributes']['status']
300
+ rating = entry['attributes']['rating']
301
+
302
+ showlist[showid] = utils.show()
303
+ showlist[showid].update({
304
+ 'id': showid,
305
+ 'my_id': entry['id'],
306
+ 'my_progress': entry['attributes']['progress'],
307
+ 'my_score': float(rating) if rating is not None else 0.0,
308
+ 'my_status': entry['attributes']['status'],
309
+ })
310
+
311
+ if 'included' in data_json:
312
+ medias = data_json['included']
313
+ for media in medias:
314
+ info = self._parse_info(media)
315
+ infolist.append(info)
316
+
317
+ self._emit_signal('show_info_changed', infolist)
318
+
319
+ url = links.get('next')
320
+ i += 1
321
+
322
+ return showlist
323
+ except urllib.request.HTTPError as e:
324
+ raise utils.APIError("Error getting list.")
325
+
326
+ def merge(self, show, info):
327
+ show['title'] = info['title']
328
+ show['aliases'] = info['aliases']
329
+ show['url'] = info['url']
330
+ show['total'] = info['total']
331
+ show['image'] = info['image']
332
+ show['image_thumb'] = info['image_thumb']
333
+
334
+ def request_info(self, item_list):
335
+ print("These are missing: " + repr(item_list))
336
+ # TODO implement
337
+ raise NotImplementedError
338
+
339
+ def add_show(self, item):
340
+ """Adds a new show in the server"""
341
+ self.check_credentials()
342
+ self.msg.info(self.name, "Adding show %s..." % item['title'])
343
+
344
+ data = self._build_data(item)
345
+
346
+ try:
347
+ data = self._request('POST', self.prefix + "/library-entries", body=data, auth=True)
348
+
349
+ data_json = json.loads(data)
350
+ return int(data_json['data']['id'])
351
+ except urllib.request.HTTPError as e:
352
+ raise utils.APIError('Error adding: ' + str(e.code))
353
+
354
+ def update_show(self, item):
355
+ """Sends a show update to the server"""
356
+ self.check_credentials()
357
+ self.msg.info(self.name, "Updating show %s..." % item['title'])
358
+
359
+ data = self._build_data(item)
360
+
361
+ try:
362
+ self._request('PATCH', self.prefix + "/library-entries/%s" % item['my_id'], body=data, auth=True)
363
+ except urllib.request.HTTPError as e:
364
+ raise utils.APIError('Error updating: ' + str(e.code))
365
+
366
+ def delete_show(self, item):
367
+ """Sends a show delete to the server"""
368
+ self.check_credentials()
369
+ self.msg.info(self.name, "Deleting show %s..." % item['title'])
370
+
371
+ try:
372
+ self._request('DELETE', self.prefix + "/library-entries/%s" % item['my_id'], auth=True)
373
+ except urllib.request.HTTPError as e:
374
+ raise utils.APIError('Error deleting: ' + str(e.code))
375
+
376
+ def search(self, query):
377
+ self.msg.info(self.name, "Searching for %s..." % query)
378
+
379
+ values = {
380
+ "filter[text]": query,
381
+ "page[limit]": 20,
382
+ }
383
+
384
+ try:
385
+ data = self._request('GET', self.prefix + "/" + self.mediatype, get=values)
386
+ shows = json.loads(data)
387
+
388
+ infolist = []
389
+ for media in shows['data']:
390
+ info = self._parse_info(media)
391
+ infolist.append(info)
392
+
393
+ self._emit_signal('show_info_changed', infolist)
394
+
395
+ if not infolist:
396
+ raise utils.APIError('No results.')
397
+
398
+ return infolist
399
+ except urllib.request.HTTPError as e:
400
+ raise utils.APIError('Error searching: ' + str(e.code))
401
+
402
+ def _build_data(self, item):
403
+ values = {'data': {
404
+ 'type': 'libraryEntries',
405
+ 'attributes': {},
406
+ 'relationships': {
407
+ 'media': {
408
+ 'data': {
409
+ 'type': self.mediatype,
410
+ 'id': item['id'],
411
+ }
412
+ },
413
+ 'user': {
414
+ 'data': {
415
+ 'type': 'users',
416
+ 'id': self._get_userconfig('userid'),
417
+ }
418
+ },
419
+ }
420
+ }
421
+ }
422
+
423
+ # Update necessary keys
424
+ if item['my_id']:
425
+ values['data']['id'] = str(item['my_id'])
426
+ if 'my_progress' in item:
427
+ values['data']['attributes']['progress'] = item['my_progress']
428
+ if 'my_status' in item:
429
+ values['data']['attributes']['status'] = item['my_status']
430
+ if 'my_score' in item:
431
+ values['data']['attributes']['rating'] = item['my_score'] or None
432
+
433
+ return json.dumps(values)
434
+
435
+ def _str2date(self, string):
436
+ if string != '0000-00-00':
437
+ try:
438
+ return datetime.datetime.strptime(string, "%Y-%m-%d")
439
+ except:
440
+ return None # Ignore date if it's invalid
441
+ else:
442
+ return None
443
+
444
+ def _parse_info(self, media):
445
+ info = utils.show()
446
+ attr = media['attributes']
447
+
448
+ #print(json.dumps(media, indent=2))
449
+ #raise NotImplementedError
450
+
451
+ if media['type'] == 'anime':
452
+ total = attr['episodeCount']
453
+ type_str = 'showType'
454
+ elif media['type'] == 'manga':
455
+ total = attr['chapterCount']
456
+ type_str = 'mangaType'
457
+ elif media['type'] == 'drama':
458
+ total = attr['episodeCount'] # TODO Unconfirmed
459
+ type_str = 'dramaType'
460
+
461
+ info.update({
462
+ 'id': int(media['id']),
463
+ # TODO : Some shows actually don't have a canonicalTitle; this should be fixed in the future.
464
+ # For now I'm just picking the romaji title in these cases.
465
+ 'title': attr['canonicalTitle'] or attr['titles']['en_jp'],
466
+ 'total': total or 0,
467
+ 'image': attr['posterImage']['small'],
468
+ 'image_thumb': attr['posterImage']['tiny'],
469
+ 'url': "https://kitsu.io/{}/{}".format(self.mediatype, attr['slug']),
470
+ 'aliases': list(filter(None, attr['titles'].values())),
471
+ 'extra': [
472
+ ('Synopsis', attr['synopsis']),
473
+ ('Type', attr['subtype']),
474
+ ]
475
+ })
476
+
477
+ return info
478
+
trackma/lib/libmal.py CHANGED
@@ -399,22 +399,22 @@ class libmal(lib):
399
399
  progressname = 'chapter'
400
400
 
401
401
  # Update necessary keys
402
- if 'my_progress' in item.keys():
402
+ if 'my_progress' in item:
403
403
  episode = ET.SubElement(root, progressname)
404
404
  episode.text = str(item['my_progress'])
405
- if 'my_status' in item.keys():
405
+ if 'my_status' in item:
406
406
  status = ET.SubElement(root, "status")
407
407
  status.text = str(item['my_status'])
408
- if 'my_score' in item.keys():
408
+ if 'my_score' in item:
409
409
  score = ET.SubElement(root, "score")
410
410
  score.text = str(item['my_score'])
411
- if 'my_start_date' in item.keys():
411
+ if 'my_start_date' in item:
412
412
  start_date = ET.SubElement(root, "date_start")
413
413
  start_date.text = self._date2str(item['my_start_date'])
414
- if 'my_finish_date' in item.keys():
414
+ if 'my_finish_date' in item:
415
415
  finish_date = ET.SubElement(root, "date_finish")
416
416
  finish_date.text = self._date2str(item['my_finish_date'])
417
- if 'my_tags' in item.keys():
417
+ if 'my_tags' in item:
418
418
  tags = ET.SubElement(root, "tags")
419
419
  tags.text = str(item['my_tags'])
420
420
 
@@ -304,11 +304,11 @@ class libshikimori(lib):
304
304
  user_rate = {}
305
305
  dest_url = "/api/user_rates/{}".format(item['my_id'])
306
306
 
307
- if 'my_progress' in item.keys():
307
+ if 'my_progress' in item:
308
308
  user_rate[self.watched_str] = item['my_progress']
309
- if 'my_status' in item.keys():
309
+ if 'my_status' in item:
310
310
  user_rate['status'] = item['my_status']
311
- if 'my_score' in item.keys():
311
+ if 'my_score' in item:
312
312
  user_rate['score'] = item['my_score']
313
313
 
314
314
  values = {'user_rate': user_rate}
trackma/lib/libvndb.py CHANGED
@@ -37,11 +37,14 @@ class libvndb(lib):
37
37
  api_info = {
38
38
  'name': 'VNDB',
39
39
  'shortname': 'vndb',
40
- 'version': 'v0.3',
40
+ 'version': 2,
41
41
  'merge': True,
42
42
  }
43
43
 
44
44
  default_mediatype = 'vnlist'
45
+ pagesize_list = 100
46
+ pagesize_details = 25
47
+
45
48
  mediatypes = dict()
46
49
  mediatypes['vnlist'] = {
47
50
  'has_progress': False,
@@ -177,7 +180,7 @@ class libvndb(lib):
177
180
 
178
181
  (name, data) = self._sendcmd('get %s basic (uid = 0)' % self.mediatype,
179
182
  {'page': page,
180
- 'results': 25
183
+ 'results': self.pagesize_list
181
184
  })
182
185
 
183
186
  # Something is wrong if we don't get a results response.
@@ -204,7 +207,7 @@ class libvndb(lib):
204
207
 
205
208
  (name, data) = self._sendcmd('get votelist basic (uid = 0)',
206
209
  {'page': page,
207
- 'results': 25
210
+ 'results': self.pagesize_list
208
211
  })
209
212
 
210
213
  # Something is wrong if we don't get a results response.
@@ -234,11 +237,11 @@ class libvndb(lib):
234
237
  remaining = [ show['id'] for show in itemlist ]
235
238
  while True:
236
239
  self.msg.info(self.name, 'Requesting details...(%d)' % start)
237
- end = start + 25
240
+ end = start + self.pagesize_details
238
241
 
239
242
  (name, data) = self._sendcmd('get vn basic,details (id = %s)' % repr(remaining[start:end]),
240
243
  {'page': 1,
241
- 'results': 25,
244
+ 'results': self.pagesize_details,
242
245
  })
243
246
 
244
247
  # Something is wrong if we don't get a results response.
@@ -249,7 +252,7 @@ class libvndb(lib):
249
252
  for item in data['items']:
250
253
  infos.append(self._parse_info(item))
251
254
 
252
- start += 25
255
+ start += self.pagesize_details
253
256
  if start >= len(itemlist):
254
257
  # We're going beyond the list, finish
255
258
  break
@@ -267,7 +270,7 @@ class libvndb(lib):
267
270
  self.check_credentials()
268
271
 
269
272
  # Update status with set vnlist
270
- if 'my_status' in item.keys():
273
+ if 'my_status' in item:
271
274
  self.msg.info(self.name, 'Updating VN %s (status)...' % item['title'])
272
275
 
273
276
  if self.mediatype == 'wishlist':
@@ -281,7 +284,7 @@ class libvndb(lib):
281
284
  raise utils.APIError("Invalid response (%s)" % name)
282
285
 
283
286
  # Update vote with set votelist
284
- if 'my_score' in item.keys():
287
+ if 'my_score' in item:
285
288
  self.msg.info(self.name, 'Updating VN %s (vote)...' % item['title'])
286
289
 
287
290
  if item['my_score'] > 0:
@@ -314,7 +317,7 @@ class libvndb(lib):
314
317
 
315
318
  (name, data) = self._sendcmd('get vn basic,details (search ~ "%s")' % criteria,
316
319
  {'page': 1,
317
- 'results': 25,
320
+ 'results': self.pagesize_details,
318
321
  })
319
322
 
320
323
  # Something is wrong if we don't get a results response.
trackma/messenger.py CHANGED
@@ -1,4 +1,4 @@
1
- # This file is part of wMAL.
1
+ # This file is part of Trackma.
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
File without changes