trackma 0.6__py3.5.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 (60) hide show
  1. EGG-INFO/PKG-INFO +19 -0
  2. EGG-INFO/SOURCES.txt +37 -0
  3. EGG-INFO/dependency_links.txt +1 -0
  4. EGG-INFO/entry_points.txt +8 -0
  5. EGG-INFO/not-zip-safe +1 -0
  6. EGG-INFO/requires.txt +10 -0
  7. EGG-INFO/top_level.txt +1 -0
  8. trackma/__init__.py +0 -0
  9. trackma/__pycache__/__init__.cpython-35.pyc +0 -0
  10. trackma/__pycache__/accounts.cpython-35.pyc +0 -0
  11. trackma/__pycache__/data.cpython-35.pyc +0 -0
  12. trackma/__pycache__/engine.cpython-35.pyc +0 -0
  13. trackma/__pycache__/messenger.cpython-35.pyc +0 -0
  14. trackma/__pycache__/tracker.cpython-35.pyc +0 -0
  15. trackma/__pycache__/utils.cpython-35.pyc +0 -0
  16. trackma/accounts.py +145 -0
  17. trackma/data/anilist.jpg +0 -0
  18. trackma/data/hb.jpg +0 -0
  19. trackma/data/icon.png +0 -0
  20. trackma/data/mal.jpg +0 -0
  21. trackma/data/melative.jpg +0 -0
  22. trackma/data/shikimori.jpg +0 -0
  23. trackma/data/vndb.jpg +0 -0
  24. trackma/data.py +597 -0
  25. trackma/engine.py +818 -0
  26. trackma/extras/AnimeInfoExtractor.py +308 -0
  27. trackma/extras/__init__.py +1 -0
  28. trackma/extras/__pycache__/AnimeInfoExtractor.cpython-35.pyc +0 -0
  29. trackma/extras/__pycache__/__init__.cpython-35.pyc +0 -0
  30. trackma/extras/__pycache__/plex.cpython-35.pyc +0 -0
  31. trackma/extras/plex.py +101 -0
  32. trackma/lib/__init__.py +0 -0
  33. trackma/lib/__pycache__/__init__.cpython-35.pyc +0 -0
  34. trackma/lib/__pycache__/lib.cpython-35.pyc +0 -0
  35. trackma/lib/__pycache__/libanilist.cpython-35.pyc +0 -0
  36. trackma/lib/__pycache__/libhb.cpython-35.pyc +0 -0
  37. trackma/lib/__pycache__/libmal.cpython-35.pyc +0 -0
  38. trackma/lib/__pycache__/libmelative.cpython-35.pyc +0 -0
  39. trackma/lib/__pycache__/libshikimori.cpython-35.pyc +0 -0
  40. trackma/lib/__pycache__/libvndb.cpython-35.pyc +0 -0
  41. trackma/lib/lib.py +162 -0
  42. trackma/lib/libanilist.py +406 -0
  43. trackma/lib/libhb.py +237 -0
  44. trackma/lib/libmal.py +707 -0
  45. trackma/lib/libmelative.py +204 -0
  46. trackma/lib/libshikimori.py +340 -0
  47. trackma/lib/libvndb.py +375 -0
  48. trackma/messenger.py +42 -0
  49. trackma/tracker.py +390 -0
  50. trackma/ui/__init__.py +0 -0
  51. trackma/ui/__pycache__/__init__.cpython-35.pyc +0 -0
  52. trackma/ui/__pycache__/cli.cpython-35.pyc +0 -0
  53. trackma/ui/__pycache__/curses.cpython-35.pyc +0 -0
  54. trackma/ui/__pycache__/gtkui.cpython-35.pyc +0 -0
  55. trackma/ui/__pycache__/qtui.cpython-35.pyc +0 -0
  56. trackma/ui/cli.py +835 -0
  57. trackma/ui/curses.py +1061 -0
  58. trackma/ui/gtkui.py +2647 -0
  59. trackma/ui/qtui.py +3046 -0
  60. trackma/utils.py +379 -0
trackma/data.py ADDED
@@ -0,0 +1,597 @@
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 os.path
18
+ import sys
19
+ import threading
20
+ import time
21
+
22
+ from trackma import messenger
23
+ from trackma import utils
24
+
25
+ class Data():
26
+ """
27
+ Data Handler Class
28
+
29
+ Class for keeping data in memory, handling list cache and
30
+ update queues. This module cares about keeping the data
31
+ safe and up to date, and it handles commands given by the engine,
32
+ and communicates with the API whenever it's necessary.
33
+
34
+ messenger: Messenger object to send useful messages to
35
+ config: Parsed configuration dictionary (given by the engine)
36
+
37
+ """
38
+ name = 'Data'
39
+ version = 5
40
+
41
+ msg = None
42
+ api = None
43
+ showlist = None
44
+ infocache = dict()
45
+ queue = list()
46
+ config = dict()
47
+ meta = {'lastget': 0, 'lastsend': 0, 'version': '', 'altnames': {}, 'library': {}, 'library_cache': {}, }
48
+
49
+ autosend_timer = None
50
+
51
+ signals = {
52
+ 'show_synced': None,
53
+ 'sync_complete': None,
54
+ 'queue_changed': None,
55
+ }
56
+
57
+ def __init__(self, messenger, config, account, mediatype):
58
+ """Checks if the config is correct and creates an API object."""
59
+ self.msg = messenger
60
+ self.config = config
61
+ self.msg.info(self.name, "Initializing...")
62
+
63
+ # Get filenames
64
+ userfolder = "%s.%s" % (account['username'], account['api'])
65
+ self.userconfig_file = utils.get_filename(userfolder, 'user.json')
66
+
67
+ # Handle userconfig and media type to load
68
+ self._load_userconfig()
69
+ if mediatype:
70
+ self.userconfig['mediatype'] = mediatype
71
+ self._save_userconfig()
72
+
73
+ # Import the API
74
+ libbase = account['api']
75
+ libname = "lib{0}".format(libbase)
76
+ try:
77
+ modulename = "trackma.lib.{0}".format(libname)
78
+ __import__(modulename)
79
+ apimodule = sys.modules[modulename]
80
+ except ImportError as e:
81
+ raise utils.DataFatal("Couldn't import API module: %s" % e)
82
+
83
+ # Instance API
84
+ libclass = getattr(apimodule, libname)
85
+ self.api = libclass(self.msg, account, self.userconfig)
86
+
87
+ # Set mediatype
88
+ mediatype = self.userconfig.get('mediatype')
89
+ self.msg.info(self.name, "Using %s (%s)" % (libname, mediatype))
90
+
91
+ # Get filenames
92
+ self.queue_file = utils.get_filename(userfolder, '%s.queue' % mediatype)
93
+ self.info_file = utils.get_filename(userfolder, '%s.info' % mediatype)
94
+ self.cache_file = utils.get_filename(userfolder, '%s.list' % mediatype)
95
+ self.meta_file = utils.get_filename(userfolder, '%s.meta' % mediatype)
96
+ self.lock_file = utils.get_filename(userfolder, 'lock')
97
+
98
+ # Connect signals
99
+ self.api.connect_signal('show_info_changed', self.info_update)
100
+ self.api.connect_signal('userconfig_changed', self.userconfig_update)
101
+
102
+ def _emit_signal(self, signal, *args):
103
+ if self.signals[signal]:
104
+ self.signals[signal](*args)
105
+
106
+ def connect_signal(self, signal, callback):
107
+ try:
108
+ self.signals[signal] = callback
109
+ except KeyError:
110
+ raise utils.DataFatal("Invalid signal.")
111
+
112
+ def set_message_handler(self, message_handler):
113
+ self.msg = message_handler
114
+ self.api.set_message_handler(self.msg)
115
+
116
+ def start(self):
117
+ """
118
+ Does all necessary tasks to start the data handler
119
+
120
+ This should be called before doing any other operation with the data handler,
121
+ as it loads the list cache (or downloads it if necessary) and queue.
122
+
123
+ """
124
+ # Lock the database
125
+ self.msg.debug(self.name, "Locking database...")
126
+ self._lock()
127
+
128
+ # Load different caches
129
+ if self._meta_exists():
130
+ self._load_meta()
131
+
132
+ if self._queue_exists() and self.meta.get('version') == self.version:
133
+ self._load_queue()
134
+
135
+ if self._info_exists() and self.meta.get('version') == self.version:
136
+ # Load info cache only if we're on the same database version
137
+ self._load_info()
138
+
139
+ # If there is a list cache, load from it
140
+ # otherwise query the API for a remote list
141
+ if self._cache_exists() and self.meta.get('version') == self.version:
142
+ # Auto-send: Process the queue if we're beyond the auto-send time limit for some reason
143
+ if self.config['autosend'] == 'hours' and time.time() - self.meta['lastsend'] > self.config['autosend_hours'] * 3600:
144
+ self.process_queue()
145
+
146
+ # Auto-retrieve: Redownload list if any autoretrieve condition is met
147
+ if (self.config['autoretrieve'] == 'always' or
148
+ (self.config['autoretrieve'] == 'days' and time.time() - self.meta['lastget'] > self.config['autoretrieve_days'] * 84600) or
149
+ self.meta.get('version') != self.version):
150
+ try:
151
+ # Make sure we process the queue first before overwriting the list
152
+ # We don't want users losing their changes
153
+ self.process_queue()
154
+ self.download_data()
155
+ except utils.APIError as e:
156
+ self.msg.warn(self.name, "Couldn't download list! Using cache.")
157
+ self._load_cache()
158
+ elif not self.showlist:
159
+ # If the cache wasn't loaded before, do it now
160
+ self._load_cache()
161
+ else:
162
+ try:
163
+ self.download_data()
164
+ except utils.APIError as e:
165
+ raise utils.APIFatal(str(e))
166
+
167
+ # Create autosend thread if needed
168
+ if self.config['autosend'] == 'hours':
169
+ self.autosend()
170
+
171
+ return (self.api.api_info, self.api.media_info())
172
+
173
+ def unload(self, force=False):
174
+ """
175
+ Does unloading of the data handler
176
+
177
+ This should be called whenever the data handler won't be used anymore,
178
+ as it does necessary operations to close the API and the data handler itself.
179
+
180
+ """
181
+ self.msg.debug(self.name, "Unloading...")
182
+
183
+ # Cancel autosend thread
184
+ if self.autosend_timer:
185
+ self.autosend_timer.cancel()
186
+
187
+ # We push changes if specified on config file
188
+ if not force:
189
+ if self.config['autosend_at_exit']:
190
+ self.process_queue()
191
+
192
+ self._save_meta()
193
+
194
+ self._unlock()
195
+
196
+ def get(self):
197
+ """Get list from memory"""
198
+ return self.showlist
199
+
200
+ def search(self, criteria):
201
+ # Tell API to search
202
+ results = self.api.search(criteria)
203
+ self.api.logout()
204
+ if results:
205
+ return results
206
+ else:
207
+ raise utils.DataError('No results.')
208
+
209
+ def queue_add(self, show):
210
+ """
211
+ Queues a show add
212
+
213
+ Calls this to add a show to the list, and the remote add
214
+ will be queued.
215
+
216
+ show: Show dictionary
217
+
218
+ """
219
+ showid = show['id']
220
+
221
+ # Add to the list
222
+ if self.showlist.get(showid):
223
+ raise utils.DataError("Show already in the list.")
224
+
225
+ self.showlist[showid] = show
226
+
227
+ # Check if the show add is already in queue
228
+ exists = False
229
+ for q in self.queue:
230
+ if q['id'] == showid and q['action'] == 'add':
231
+ # This shouldn't happen
232
+ raise utils.DataError("Show already in the queue.")
233
+
234
+ if not exists:
235
+ # Use the whole show as a queue item
236
+ item = show
237
+ item['action'] = 'add'
238
+ self.queue.append(item)
239
+
240
+ show['queued'] = True
241
+
242
+ self._save_queue()
243
+ self._save_cache()
244
+ self._emit_signal('queue_changed', len(self.queue))
245
+ self.msg.info(self.name, "Queued add for %s" % show['title'])
246
+
247
+ def queue_update(self, show, key, value):
248
+ """
249
+ Queues a show update
250
+
251
+ Call this to change anything of an item in the list, as it will be
252
+ modified locally and queued for update in the next remote sync.
253
+
254
+ show: Show dictionary
255
+ key: The key that will be modified (it must exist beforehand)
256
+ value: The value that it should be changed to
257
+ """
258
+ if key not in show.keys():
259
+ raise utils.DataError('Invalid key for queue update.')
260
+
261
+ # Do update on memory
262
+ show[key] = value
263
+
264
+ # Check if the show update is already in queue
265
+ exists = False
266
+ for q in self.queue:
267
+ if q['id'] == show['id'] and q['action'] in ['add', 'update']:
268
+ # Add the changed value to the already existing queue item
269
+ q[key] = value
270
+ exists = True
271
+ break
272
+
273
+ if not exists:
274
+ # Create queue item and append it
275
+ item = {'id': show['id'],
276
+ 'my_id': show['my_id'],
277
+ 'action': 'update',
278
+ 'title': show['title'],
279
+ }
280
+ item[key] = value
281
+ self.queue.append(item)
282
+
283
+ show['queued'] = True
284
+
285
+ self._save_queue()
286
+ self._save_cache()
287
+ self._emit_signal('queue_changed', len(self.queue))
288
+ self.msg.info(self.name, "Queued update for %s" % show['title'])
289
+
290
+ # Immediately process the action if necessary
291
+ if (self.config['autosend'] == 'always' or
292
+ (self.config['autosend'] == 'hours' and time.time() - self.meta['lastsend'] >= self.config['autosend_hours']*3600) or
293
+ (self.config['autosend'] == 'size' and len(self.queue) >= self.config['autosend_size'])):
294
+ self.process_queue()
295
+
296
+ def queue_delete(self, show):
297
+ """
298
+ Queues a show delete
299
+
300
+ Calls this to delete a show from the list, and the remote delete
301
+ will be queued.
302
+
303
+ show: Show dictionary
304
+
305
+ """
306
+ showid = show['id']
307
+
308
+ # Delete from the list
309
+ if not self.showlist.get(showid):
310
+ raise utils.DataError("Show not in the list.")
311
+
312
+ item = self.showlist.pop(showid)
313
+
314
+ # Check if the show add is already in queue
315
+ exists = False
316
+ for q in self.queue:
317
+ if q['id'] == showid and q['action'] == 'delete':
318
+ # This shouldn't happen
319
+ raise utils.DataError("Show delete already in the queue.")
320
+
321
+ if not exists:
322
+ # Use the whole show as a queue item
323
+ item['action'] = 'delete'
324
+ self.queue.append(item)
325
+
326
+ show['queued'] = True
327
+
328
+ self._save_queue()
329
+ self._save_cache()
330
+ self._emit_signal('queue_changed', len(self.queue))
331
+ self.msg.info(self.name, "Queued delete for %s" % item['title'])
332
+
333
+ def queue_clear(self):
334
+ """Clears the queue completely."""
335
+ if self.queue:
336
+ self.queue = []
337
+ self._save_queue()
338
+ self._emit_signal('queue_changed', len(self.queue))
339
+ self.msg.info(self.name, "Cleared queue.")
340
+
341
+ def process_queue(self):
342
+ """
343
+ Send updates in queue to the API
344
+
345
+ It starts sending all the queued updates to the API for it to update
346
+ the remote list. Any successful updates get removed from the queue,
347
+ and failed updates stay there to be processed the next time.
348
+
349
+ """
350
+ if len(self.queue):
351
+ self.msg.info(self.name, 'Processing queue...')
352
+
353
+ # Load the cache if it wasn't loaded for some reason
354
+ if not self.showlist:
355
+ self._load_cache()
356
+
357
+ # Check log-in TODO
358
+ #try:
359
+ # self.api.check_credentials()
360
+ #except utils.APIError as e:
361
+ # raise utils.DataError("Can't process queue, will leave unsynced. Reason: %s" % e)
362
+
363
+ # Run through queue
364
+ items_processed = []
365
+ for i in range(len(self.queue)):
366
+ item = self.queue.pop(0)
367
+ showid = item['id']
368
+
369
+ try:
370
+ show = self.showlist[showid]
371
+ except KeyError:
372
+ show = None
373
+
374
+ try:
375
+ # Call the API to do the requested operation
376
+ operation = item.get('action')
377
+ if operation == 'add':
378
+ my_id = self.api.add_show(item)
379
+
380
+ if my_id:
381
+ show['my_id'] = my_id
382
+ elif operation == 'update':
383
+ self.api.update_show(item)
384
+ elif operation == 'delete':
385
+ self.api.delete_show(item)
386
+ else:
387
+ self.msg.warn(self.name, "Unknown operation in queue (%s), skipping..." % repr(operation))
388
+
389
+ if self.showlist.get(showid):
390
+ self.showlist[showid]['queued'] = False
391
+ self._emit_signal('show_synced', show, item)
392
+
393
+ items_processed.append((show, item))
394
+ self._emit_signal('queue_changed', len(self.queue))
395
+ except utils.APIError as e:
396
+ self.msg.warn(self.name, "Can't process %s, will leave unsynced." % item['title'])
397
+ self.msg.debug(self.name, "Info: %s" % e)
398
+ self.queue.append(item)
399
+ except NotImplementedError:
400
+ self.msg.warn(self.name, "Operation not implemented in API. Skipping...")
401
+ self.queue.append(item)
402
+ #except TypeError:
403
+ # self.msg.warn(self.name, "%s not in list, unexpected. Not changing queued status." % showid)
404
+
405
+ self.api.logout()
406
+ self._save_cache()
407
+ self._save_queue()
408
+ self._emit_signal('sync_complete', items_processed)
409
+ else:
410
+ self.msg.debug(self.name, 'No items in queue.')
411
+
412
+ self.meta['lastsend'] = time.time()
413
+
414
+ def info_get(self, show):
415
+ try:
416
+ showid = show['id']
417
+ return self.infocache[showid]
418
+ except KeyError:
419
+ return self.api.request_info([show])[0]
420
+
421
+ def info_update(self, shows):
422
+ for show in shows:
423
+ showid = show['id']
424
+ self.infocache[showid] = show
425
+
426
+ self._save_info()
427
+
428
+ def userconfig_update(self):
429
+ self._save_userconfig()
430
+
431
+ def altname_get(self, showid):
432
+ return self.meta['altnames'].get(showid, '')
433
+
434
+ def altname_set(self, showid, altname):
435
+ self.meta['altnames'][showid] = altname
436
+
437
+ def altname_clear(self, showid):
438
+ del self.meta['altnames'][showid]
439
+
440
+ def altnames_get(self):
441
+ return self.meta['altnames']
442
+
443
+ def library_get(self):
444
+ return self.meta['library']
445
+
446
+ def library_save(self, library):
447
+ self.meta['library'] = library
448
+
449
+ def library_cache_get(self):
450
+ return self.meta['library_cache']
451
+
452
+ def library_cache_save(self, library_cache):
453
+ self.meta['library_cache'] = library_cache
454
+
455
+ def get_show_attr(self, show, key):
456
+ return show.get(key)
457
+
458
+ def set_show_attr(self, show, key, value):
459
+ show[key] = value
460
+
461
+ def get_show_titles(self, show):
462
+ if self.altname_get(show['id']):
463
+ return [ self.altname_get(show['id']) ]
464
+ else:
465
+ return [show['title']] + show['aliases']
466
+
467
+ def autosend(self):
468
+ # Check if we should autosend now
469
+ if time.time() - self.meta['lastsend'] >= self.config['autosend_hours'] * 3600:
470
+ self.process_queue()
471
+
472
+ # Repeat check only if the settings are still on 'hours'
473
+ if self.config['autosend'] == 'hours':
474
+ self.autosend_timer = threading.Timer(3600, self.autosend)
475
+ self.autosend_timer.daemon = True
476
+ self.autosend_timer.start()
477
+
478
+ def _load_cache(self):
479
+ self.msg.debug(self.name, "Reading cache...")
480
+ self.showlist = utils.load_data(self.cache_file)
481
+
482
+ def _save_cache(self):
483
+ self.msg.debug(self.name, "Saving cache...")
484
+ utils.save_data(self.showlist, self.cache_file)
485
+
486
+ def _load_info(self):
487
+ self.msg.debug(self.name, "Reading info DB...")
488
+ self.infocache = utils.load_data(self.info_file)
489
+
490
+ def _save_info(self):
491
+ self.msg.debug(self.name, "Saving info DB...")
492
+ utils.save_data(self.infocache, self.info_file)
493
+
494
+ def _load_userconfig(self):
495
+ self.msg.debug(self.name, "Reading userconfig...")
496
+ self.userconfig = utils.parse_config(self.userconfig_file, utils.userconfig_defaults)
497
+
498
+ def _save_userconfig(self):
499
+ self.msg.debug(self.name, "Saving userconfig...")
500
+ utils.save_config(self.userconfig, self.userconfig_file)
501
+
502
+ def _load_queue(self):
503
+ self.msg.debug(self.name, "Reading queue...")
504
+ self.queue = utils.load_data(self.queue_file)
505
+
506
+ def _save_queue(self):
507
+ self.msg.debug(self.name, "Saving queue...")
508
+ utils.save_data(self.queue, self.queue_file)
509
+
510
+ def _load_meta(self):
511
+ self.msg.debug(self.name, "Reading metadata...")
512
+ loadedmeta = utils.load_data(self.meta_file)
513
+ self.meta.update(loadedmeta)
514
+
515
+ def _save_meta(self):
516
+ self.msg.debug(self.name, "Saving metadata...")
517
+ utils.save_data(self.meta, self.meta_file)
518
+
519
+ def download_data(self):
520
+ """Downloads the remote list and overwrites the cache"""
521
+ self.showlist = self.api.fetch_list()
522
+
523
+ if self.api.api_info['merge']:
524
+ # The API needs information to be merged from the
525
+ # info database
526
+ missing = []
527
+ for k, show in self.showlist.items():
528
+ # Here we search the information in the local
529
+ # info database. If it isn't available, add it
530
+ # to the missing list for them to be requested
531
+ # to the API later.
532
+ showid = show['id']
533
+
534
+ try:
535
+ info = self.infocache[showid]
536
+ except KeyError:
537
+ missing.append(show)
538
+ continue
539
+
540
+ self.api.merge(show, info)
541
+ #show['title'] = info['title']
542
+ #show['image'] = info['image']
543
+
544
+ # Here we request the missing items and merge them
545
+ # immedately with the list.
546
+ if len(missing) > 0:
547
+ infos = self.api.request_info(missing)
548
+ for info in infos:
549
+ showid = info['id']
550
+ self.api.merge(self.showlist[showid], info)
551
+
552
+ #self.showlist[showid]['title'] = info['title']
553
+ #self.showlist[showid]['image'] = info['image']
554
+
555
+ self._save_cache()
556
+ self.api.logout()
557
+
558
+ # Update last retrieved time
559
+ self.meta['lastget'] = time.time()
560
+ self.meta['version'] = self.version
561
+ self._save_meta()
562
+
563
+ def _cache_exists(self):
564
+ return os.path.isfile(self.cache_file)
565
+
566
+ def _info_exists(self):
567
+ return os.path.isfile(self.info_file)
568
+
569
+ def _queue_exists(self):
570
+ return os.path.isfile(self.queue_file)
571
+
572
+ def _meta_exists(self):
573
+ return os.path.isfile(self.meta_file)
574
+
575
+ def _lock(self):
576
+ """Creates the database lock, returns an exception if it
577
+ already exists"""
578
+ if self.config['debug_disable_lock']:
579
+ return
580
+
581
+ if os.path.isfile(self.lock_file):
582
+ raise utils.DataFatal("Database is locked by another process. "
583
+ "If you\'re sure there's no other process is using it, "
584
+ "remove the file ~/.trackma/lock")
585
+
586
+ f = open(self.lock_file, 'w')
587
+ f.close()
588
+
589
+ def _unlock(self):
590
+ """Removes the database lock"""
591
+ if self.config['debug_disable_lock']:
592
+ return
593
+
594
+ os.unlink(self.lock_file)
595
+
596
+ def get_api_info(self):
597
+ return (self.api.api_info, self.api.media_info())