trackma 0.4__py2.7.egg → 0.5__py2.7.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.
- EGG-INFO/PKG-INFO +1 -1
- EGG-INFO/SOURCES.txt +2 -0
- trackma/__init__.pyc +0 -0
- trackma/accounts.py +36 -1
- trackma/accounts.pyc +0 -0
- trackma/data/shikimori.jpg +0 -0
- trackma/data.py +33 -20
- trackma/data.pyc +0 -0
- trackma/engine.py +82 -11
- trackma/engine.pyc +0 -0
- trackma/extras/AnimeInfoExtractor.pyc +0 -0
- trackma/extras/__init__.pyc +0 -0
- trackma/extras/plex.pyc +0 -0
- trackma/lib/__init__.pyc +0 -0
- trackma/lib/lib.pyc +0 -0
- trackma/lib/libanilist.py +65 -17
- trackma/lib/libanilist.pyc +0 -0
- trackma/lib/libhb.py +4 -5
- trackma/lib/libhb.pyc +0 -0
- trackma/lib/libmal.py +10 -7
- trackma/lib/libmal.pyc +0 -0
- trackma/lib/libmelative.py +1 -1
- trackma/lib/libmelative.pyc +0 -0
- trackma/lib/libshikimori.py +338 -0
- trackma/lib/libshikimori.pyc +0 -0
- trackma/lib/libvndb.py +1 -0
- trackma/lib/libvndb.pyc +0 -0
- trackma/messenger.pyc +0 -0
- trackma/tracker.py +64 -17
- trackma/tracker.pyc +0 -0
- trackma/ui/__init__.pyc +0 -0
- trackma/ui/cli.py +191 -70
- trackma/ui/cli.pyc +0 -0
- trackma/ui/curses.py +14 -3
- trackma/ui/curses.pyc +0 -0
- trackma/ui/gtkui.py +341 -110
- trackma/ui/gtkui.pyc +0 -0
- trackma/ui/qtui.py +1243 -327
- trackma/ui/qtui.pyc +0 -0
- trackma/utils.py +118 -38
- trackma/utils.pyc +0 -0
trackma/ui/qtui.pyc
CHANGED
|
Binary file
|
trackma/utils.py
CHANGED
|
@@ -21,7 +21,7 @@ import json
|
|
|
21
21
|
import difflib
|
|
22
22
|
import cPickle as pickle
|
|
23
23
|
|
|
24
|
-
VERSION = '0.
|
|
24
|
+
VERSION = '0.5'
|
|
25
25
|
|
|
26
26
|
datadir = os.path.dirname(__file__)
|
|
27
27
|
LOGIN_PASSWD = 1
|
|
@@ -41,6 +41,7 @@ available_libs = {
|
|
|
41
41
|
'hb': ('Hummingbird', datadir + '/data/hb.jpg', LOGIN_PASSWD),
|
|
42
42
|
'mal': ('MyAnimeList', datadir + '/data/mal.jpg', LOGIN_PASSWD),
|
|
43
43
|
'melative': ('Melative', datadir + '/data/melative.jpg', LOGIN_PASSWD),
|
|
44
|
+
'shikimori':('Shikimori', datadir + '/data/shikimori.jpg', LOGIN_PASSWD),
|
|
44
45
|
'vndb': ('VNDB', datadir + '/data/vndb.jpg', LOGIN_PASSWD),
|
|
45
46
|
}
|
|
46
47
|
|
|
@@ -50,11 +51,21 @@ def parse_config(filename, default):
|
|
|
50
51
|
|
|
51
52
|
try:
|
|
52
53
|
with open(filename) as configfile:
|
|
53
|
-
|
|
54
|
+
loaded_config = json.load(configfile)
|
|
55
|
+
if 'colors' in config and 'colors' in loaded_config:
|
|
56
|
+
# Need to prevent nested dict from being overwritten with an incomplete dict
|
|
57
|
+
config['colors'].update(loaded_config['colors'])
|
|
58
|
+
loaded_config['colors'] = config['colors']
|
|
59
|
+
config.update(loaded_config)
|
|
54
60
|
except IOError:
|
|
55
61
|
# Will just use the default config
|
|
56
62
|
# and create the file for manual editing
|
|
57
63
|
save_config(config, filename)
|
|
64
|
+
except ValueError:
|
|
65
|
+
# There's a syntax error in the config file
|
|
66
|
+
errorString = "Erroneous config %s requires manual fixing or deletion to proceed." % filename
|
|
67
|
+
log_error(errorString)
|
|
68
|
+
raise TrackmaFatal(errorString)
|
|
58
69
|
|
|
59
70
|
return config
|
|
60
71
|
|
|
@@ -95,6 +106,15 @@ def regex_find_videos(extensions, subdirectory=''):
|
|
|
95
106
|
if match:
|
|
96
107
|
yield ( os.path.join(root, filename), filename )
|
|
97
108
|
|
|
109
|
+
def regex_rename_files(pattern, source_dir, dest_dir):
|
|
110
|
+
in_path = os.path.expanduser(os.path.join('~', '.trackma', source_dir))
|
|
111
|
+
out_path = os.path.expanduser(os.path.join('~', '.trackma', dest_dir))
|
|
112
|
+
for filename in os.listdir(in_path):
|
|
113
|
+
if re.match(pattern, filename):
|
|
114
|
+
in_file = os.path.join(in_path,filename)
|
|
115
|
+
out_file = os.path.join(out_path,filename)
|
|
116
|
+
os.rename(in_file, out_file)
|
|
117
|
+
|
|
98
118
|
def list_library(path):
|
|
99
119
|
for root, dirs, names in os.walk(path, followlinks=True):
|
|
100
120
|
for filename in names:
|
|
@@ -120,23 +140,32 @@ def get_filename(subdir, filename):
|
|
|
120
140
|
def get_root_filename(filename):
|
|
121
141
|
return os.path.expanduser(os.path.join('~', '.trackma', filename))
|
|
122
142
|
|
|
143
|
+
def get_root():
|
|
144
|
+
return os.path.expanduser(os.path.join('~', '.trackma'))
|
|
145
|
+
|
|
146
|
+
def change_permissions(filename, mode):
|
|
147
|
+
os.chmod(filename, mode)
|
|
148
|
+
|
|
123
149
|
def estimate_aired_episodes(show):
|
|
124
150
|
# Estimate how many episodes have passed since airing
|
|
125
|
-
|
|
126
|
-
if
|
|
127
|
-
return
|
|
128
|
-
|
|
129
|
-
if show['status'] == 1:
|
|
130
|
-
days = (datetime.datetime.now() - show['start_date']).days
|
|
131
|
-
if days <= 0:
|
|
132
|
-
return 0
|
|
133
|
-
|
|
134
|
-
eps = days / 7 + 1
|
|
135
|
-
if eps > show['total']:
|
|
136
|
-
return show['total']
|
|
137
|
-
return eps
|
|
138
|
-
elif show['status'] == 2:
|
|
151
|
+
|
|
152
|
+
if show['status'] == STATUS_FINISHED:
|
|
139
153
|
return show['total']
|
|
154
|
+
elif show['status'] == STATUS_NOTYET:
|
|
155
|
+
return 0
|
|
156
|
+
elif show['status'] == STATUS_AIRING: # It's airing, so we make an estimate based on available information
|
|
157
|
+
if 'next_ep_number' in show: # Do we have the upcoming episode number?
|
|
158
|
+
return show['next_ep_number']-1
|
|
159
|
+
elif show['start_date']: # Do we know when it started? Let's just assume 1 episode = 1 week
|
|
160
|
+
days = (datetime.datetime.now() - show['start_date']).days
|
|
161
|
+
if days <= 0:
|
|
162
|
+
return 0
|
|
163
|
+
|
|
164
|
+
eps = days / 7 + 1
|
|
165
|
+
if eps > show['total'] and show['total'] > 0:
|
|
166
|
+
return show['total']
|
|
167
|
+
return eps
|
|
168
|
+
return 0
|
|
140
169
|
|
|
141
170
|
def guess_show(show_title, tracker_list):
|
|
142
171
|
# Use difflib to see if the show title is similar to
|
|
@@ -184,6 +213,7 @@ def show():
|
|
|
184
213
|
'title': '',
|
|
185
214
|
'url': '',
|
|
186
215
|
'aliases': [],
|
|
216
|
+
'my_id': None,
|
|
187
217
|
'my_progress': 0,
|
|
188
218
|
'my_status': 1,
|
|
189
219
|
'my_score': 0,
|
|
@@ -256,34 +286,58 @@ userconfig_defaults = {
|
|
|
256
286
|
'userid': 0,
|
|
257
287
|
'username': '',
|
|
258
288
|
}
|
|
259
|
-
|
|
260
|
-
'
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
289
|
+
curses_defaults = {
|
|
290
|
+
'keymap': {
|
|
291
|
+
'help': 'f1',
|
|
292
|
+
'prev_filter': 'left',
|
|
293
|
+
'next_filter': 'right',
|
|
294
|
+
'sort': 'f3',
|
|
295
|
+
'sort_order': 'r',
|
|
296
|
+
'update': 'f4',
|
|
297
|
+
'play': 'f5',
|
|
298
|
+
'status': 'f6',
|
|
299
|
+
'score': 'f7',
|
|
300
|
+
'send': 's',
|
|
301
|
+
'retrieve': 'R',
|
|
302
|
+
'addsearch': 'a',
|
|
303
|
+
'reload': 'c',
|
|
304
|
+
'switch_account': 'f9',
|
|
305
|
+
'delete': 'd',
|
|
306
|
+
'quit': 'f12',
|
|
307
|
+
'altname': 'A',
|
|
308
|
+
'search': '/',
|
|
309
|
+
'neweps': 'N',
|
|
310
|
+
'details': 'enter',
|
|
311
|
+
'details_exit': 'esc',
|
|
312
|
+
'open_web': 'O',
|
|
313
|
+
},
|
|
314
|
+
'palette': {
|
|
315
|
+
|
|
316
|
+
}
|
|
281
317
|
}
|
|
282
318
|
|
|
283
319
|
gtk_defaults = {
|
|
284
320
|
'show_tray': True,
|
|
285
321
|
'close_to_tray': True,
|
|
286
322
|
'start_in_tray': False,
|
|
323
|
+
'tray_api_icon': False,
|
|
324
|
+
'remember_geometry': False,
|
|
325
|
+
'last_width': 740,
|
|
326
|
+
'last_height': 480,
|
|
327
|
+
'visible_columns': ['Title', 'Progress', 'Score', 'Percent'],
|
|
328
|
+
'episodebar_style': 1,
|
|
329
|
+
'colors': {
|
|
330
|
+
'is_airing': '#0099CC',
|
|
331
|
+
'is_playing': '#6C2DC7',
|
|
332
|
+
'is_queued': '#54C571',
|
|
333
|
+
'new_episode': '#FBB917',
|
|
334
|
+
'not_aired': '#999900',
|
|
335
|
+
'progress_bg': '#E5E5E5',
|
|
336
|
+
'progress_fg': '#99B3CC',
|
|
337
|
+
'progress_sub_bg': '#B3B3B3',
|
|
338
|
+
'progress_sub_fg': '#668099',
|
|
339
|
+
'progress_complete': '#99CCB3',
|
|
340
|
+
},
|
|
287
341
|
}
|
|
288
342
|
|
|
289
343
|
qt_defaults = {
|
|
@@ -291,9 +345,35 @@ qt_defaults = {
|
|
|
291
345
|
'close_to_tray': True,
|
|
292
346
|
'notifications': True,
|
|
293
347
|
'start_in_tray': False,
|
|
348
|
+
'tray_api_icon': False,
|
|
294
349
|
'remember_geometry': False,
|
|
350
|
+
'remember_columns': False,
|
|
295
351
|
'last_x': 0,
|
|
296
352
|
'last_y': 0,
|
|
297
353
|
'last_width': 740,
|
|
298
354
|
'last_height': 480,
|
|
355
|
+
'visible_columns': ['Title', 'Progress', 'Score', 'Percent'],
|
|
356
|
+
'columns_state': {},
|
|
357
|
+
'columns_per_api': False,
|
|
358
|
+
'episodebar_style': 1,
|
|
359
|
+
'episodebar_text': False,
|
|
360
|
+
'filter_bar_position': 2,
|
|
361
|
+
'filter_global': False,
|
|
362
|
+
'colors': {
|
|
363
|
+
'is_airing': '#D2FAFA',
|
|
364
|
+
'is_playing': '#9696FA',
|
|
365
|
+
'is_queued': '#D2FAD2',
|
|
366
|
+
'new_episode': '#FAFA82',
|
|
367
|
+
'not_aired': '#FAFAD2',
|
|
368
|
+
'progress_bg': '#F5F5F5',
|
|
369
|
+
'progress_fg': '#74C0FA',
|
|
370
|
+
'progress_sub_bg': '#D2D2D2',
|
|
371
|
+
'progress_sub_fg': '#5187B1',
|
|
372
|
+
'progress_complete': '#00D200',
|
|
373
|
+
},
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
qt_per_api_defaults = {
|
|
377
|
+
'visible_columns': ['Title', 'Progress', 'Score', 'Percent'],
|
|
378
|
+
'columns_state': {},
|
|
299
379
|
}
|
trackma/utils.pyc
CHANGED
|
Binary file
|