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/cli.py
CHANGED
|
@@ -21,6 +21,7 @@ except ImportError:
|
|
|
21
21
|
pass # readline is optional
|
|
22
22
|
import cmd
|
|
23
23
|
import shlex
|
|
24
|
+
import textwrap
|
|
24
25
|
import re
|
|
25
26
|
from operator import itemgetter # Used for sorting list
|
|
26
27
|
|
|
@@ -31,16 +32,25 @@ import trackma.messenger as messenger
|
|
|
31
32
|
import trackma.utils as utils
|
|
32
33
|
|
|
33
34
|
_DEBUG = False
|
|
35
|
+
_COLOR_RESET = '\033[0m'
|
|
34
36
|
_COLOR_ENGINE = '\033[0;32m'
|
|
35
37
|
_COLOR_DATA = '\033[0;33m'
|
|
36
38
|
_COLOR_API = '\033[0;34m'
|
|
37
39
|
_COLOR_TRACKER = '\033[0;35m'
|
|
38
40
|
_COLOR_ERROR = '\033[0;31m'
|
|
39
41
|
_COLOR_FATAL = '\033[1;31m'
|
|
40
|
-
_COLOR_RESET = '\033[0m'
|
|
41
42
|
|
|
42
43
|
_COLOR_AIRING = '\033[0;34m'
|
|
43
44
|
|
|
45
|
+
# We must use mark these with special characters for
|
|
46
|
+
# readline to calculate line width correctly
|
|
47
|
+
_PCOLOR_RESET = '\001\033[0m\002'
|
|
48
|
+
_PCOLOR_USER = '\001\033[0;32m\002'
|
|
49
|
+
_PCOLOR_API = '\001\033[0;34m\002'
|
|
50
|
+
_PCOLOR_MEDIATYPE = '\001\033[0;33m\002'
|
|
51
|
+
_PCOLOR_FILTER = '\001\033[0;35m\002'
|
|
52
|
+
|
|
53
|
+
|
|
44
54
|
class Trackma_cmd(cmd.Cmd):
|
|
45
55
|
"""
|
|
46
56
|
Main program, inherits from the useful Cmd class
|
|
@@ -78,11 +88,16 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
78
88
|
self.account = self.accountman.select_account(False)
|
|
79
89
|
|
|
80
90
|
def _update_prompt(self):
|
|
81
|
-
self.prompt = "{
|
|
82
|
-
self.engine.get_userconfig('username'),
|
|
83
|
-
self.engine.api_info['
|
|
84
|
-
self.engine.api_info['mediatype'],
|
|
85
|
-
self.engine.mediainfo['statuses_dict'][self.filter_num]
|
|
91
|
+
self.prompt = "{c_u}{u}{c_r} [{c_a}{a}{c_r}] ({c_mt}{mt}{c_r}) {c_s}{s}{c_r} >> ".format(
|
|
92
|
+
u = self.engine.get_userconfig('username'),
|
|
93
|
+
a = self.engine.api_info['shortname'],
|
|
94
|
+
mt = self.engine.api_info['mediatype'],
|
|
95
|
+
s = self.engine.mediainfo['statuses_dict'][self.filter_num].lower().replace(' ', ''),
|
|
96
|
+
c_r = _PCOLOR_RESET,
|
|
97
|
+
c_u = _PCOLOR_USER,
|
|
98
|
+
c_a = _PCOLOR_API,
|
|
99
|
+
c_mt = _PCOLOR_MEDIATYPE,
|
|
100
|
+
c_s = _COLOR_RESET
|
|
86
101
|
)
|
|
87
102
|
|
|
88
103
|
def _load_list(self, *args):
|
|
@@ -97,7 +112,7 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
97
112
|
return self.sortedlist[index]
|
|
98
113
|
except (ValueError, AttributeError, IndexError):
|
|
99
114
|
return self.engine.get_show_info_title(title)
|
|
100
|
-
|
|
115
|
+
|
|
101
116
|
def _ask_update(self, show, episode):
|
|
102
117
|
do_update = raw_input("Should I update %s to episode %d? [y/N] " % (show['title'].encode('utf-8'), episode))
|
|
103
118
|
if do_update.lower() == 'y':
|
|
@@ -123,11 +138,83 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
123
138
|
self._load_list()
|
|
124
139
|
self._update_prompt()
|
|
125
140
|
|
|
141
|
+
print
|
|
142
|
+
print "Ready. Type 'help' for a list of commands."
|
|
143
|
+
print "Press tab for autocompletion and up/down for command history."
|
|
144
|
+
self.do_filter(None) # Show available filters
|
|
145
|
+
print
|
|
146
|
+
|
|
147
|
+
def do_help(self, arg):
|
|
148
|
+
if arg:
|
|
149
|
+
try:
|
|
150
|
+
doc = getattr(self, 'do_' + arg).__doc__
|
|
151
|
+
if doc:
|
|
152
|
+
(name, args, expl, usage) = self._parse_doc(arg, doc)
|
|
153
|
+
|
|
154
|
+
print
|
|
155
|
+
print name
|
|
156
|
+
for line in expl:
|
|
157
|
+
print " {}".format(line)
|
|
158
|
+
if args:
|
|
159
|
+
print "\n Arguments:"
|
|
160
|
+
for arg in args:
|
|
161
|
+
if arg[2]:
|
|
162
|
+
print " {}: {}".format(arg[0], arg[1])
|
|
163
|
+
else:
|
|
164
|
+
print " {} (optional): {}".format(arg[0], arg[1])
|
|
165
|
+
if usage:
|
|
166
|
+
print "\n Usage: " + usage
|
|
167
|
+
print
|
|
168
|
+
return
|
|
169
|
+
except AttributeError:
|
|
170
|
+
pass
|
|
171
|
+
|
|
172
|
+
print "No help available."
|
|
173
|
+
return
|
|
174
|
+
else:
|
|
175
|
+
CMD_LENGTH = 11
|
|
176
|
+
ARG_LENGTH = 13
|
|
177
|
+
|
|
178
|
+
(height, width) = utils.get_terminal_size()
|
|
179
|
+
prev_width = CMD_LENGTH + ARG_LENGTH + 3
|
|
180
|
+
|
|
181
|
+
tw = textwrap.TextWrapper()
|
|
182
|
+
tw.width = width - 2
|
|
183
|
+
tw.subsequent_indent = ' ' * prev_width
|
|
184
|
+
|
|
185
|
+
print
|
|
186
|
+
print " {0:>{1}} {2:{3}} {4}".format(
|
|
187
|
+
'command', CMD_LENGTH,
|
|
188
|
+
'args', ARG_LENGTH,
|
|
189
|
+
'description')
|
|
190
|
+
print " " + "-"*(min(prev_width+81, width-3))
|
|
191
|
+
|
|
192
|
+
names = self.get_names()
|
|
193
|
+
names.sort()
|
|
194
|
+
cmds = []
|
|
195
|
+
for name in names:
|
|
196
|
+
if name[:3] == 'do_':
|
|
197
|
+
doc = getattr(self, name).__doc__
|
|
198
|
+
if not doc:
|
|
199
|
+
continue
|
|
200
|
+
|
|
201
|
+
cmd = name[3:]
|
|
202
|
+
(name, args, expl, usage) = self._parse_doc(cmd, doc)
|
|
203
|
+
|
|
204
|
+
line = " {0:>{1}} {2:{3}} {4}".format(
|
|
205
|
+
name, CMD_LENGTH,
|
|
206
|
+
'<' + ','.join( a[0] for a in args) + '>', ARG_LENGTH,
|
|
207
|
+
expl[0])
|
|
208
|
+
print tw.fill(line)
|
|
209
|
+
|
|
210
|
+
print
|
|
211
|
+
print "Use `help <command>` for detailed information."
|
|
212
|
+
print
|
|
213
|
+
|
|
214
|
+
|
|
126
215
|
def do_account(self, args):
|
|
127
216
|
"""
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
Usage: account
|
|
217
|
+
Switch to a different account.
|
|
131
218
|
"""
|
|
132
219
|
|
|
133
220
|
self.account = self.accountman.select_account(True)
|
|
@@ -140,9 +227,10 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
140
227
|
|
|
141
228
|
def do_filter(self, args):
|
|
142
229
|
"""
|
|
143
|
-
|
|
230
|
+
Changes the filtering of list by status.s
|
|
144
231
|
|
|
145
|
-
|
|
232
|
+
:optparam status Name of status to filter
|
|
233
|
+
:usage filter [filter type]
|
|
146
234
|
"""
|
|
147
235
|
# Query the engine for the available statuses
|
|
148
236
|
# that the user can choose
|
|
@@ -154,14 +242,14 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
154
242
|
except KeyError:
|
|
155
243
|
print "Invalid filter."
|
|
156
244
|
else:
|
|
157
|
-
print "Available
|
|
245
|
+
print "Available statuses: %s" % ', '.join( v.lower().replace(' ', '') for v in self.engine.mediainfo['statuses_dict'].values() )
|
|
158
246
|
|
|
159
247
|
def do_sort(self, args):
|
|
160
248
|
"""
|
|
161
|
-
|
|
249
|
+
Change of the lists
|
|
162
250
|
|
|
163
|
-
|
|
164
|
-
|
|
251
|
+
:param type Sort type; available types: id, title, my_progress, total, my_score
|
|
252
|
+
:usage sort <sort type>
|
|
165
253
|
"""
|
|
166
254
|
sorts = ('id', 'title', 'my_progress', 'total', 'my_score')
|
|
167
255
|
if args[0] in sorts:
|
|
@@ -172,9 +260,11 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
172
260
|
|
|
173
261
|
def do_mediatype(self, args):
|
|
174
262
|
"""
|
|
175
|
-
|
|
263
|
+
Reloads engine with different mediatype.
|
|
264
|
+
Call with no arguments to see supported mediatypes.
|
|
176
265
|
|
|
177
|
-
|
|
266
|
+
:optparam mediatype Mediatype name
|
|
267
|
+
:usage mediatype [mediatype]
|
|
178
268
|
"""
|
|
179
269
|
if args:
|
|
180
270
|
if args[0] in self.engine.api_info['supported_mediatypes']:
|
|
@@ -189,19 +279,24 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
189
279
|
else:
|
|
190
280
|
print "Supported mediatypes: %s" % ', '.join(self.engine.api_info['supported_mediatypes'])
|
|
191
281
|
|
|
282
|
+
def do_ls(self,args):
|
|
283
|
+
self.do_list(args)
|
|
284
|
+
|
|
192
285
|
def do_list(self, args):
|
|
193
286
|
"""
|
|
194
|
-
|
|
287
|
+
Lists all shows available in the local list.
|
|
288
|
+
|
|
289
|
+
:name list|ls
|
|
195
290
|
"""
|
|
196
291
|
# Show the list in memory
|
|
197
292
|
self._make_list(self.sortedlist)
|
|
198
293
|
|
|
199
294
|
def do_info(self, args):
|
|
200
295
|
"""
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
Usage: info <show index or title>
|
|
296
|
+
Gets detailed information about a local show.
|
|
204
297
|
|
|
298
|
+
:param show Show index or title.
|
|
299
|
+
:usage info <show index or title>
|
|
205
300
|
"""
|
|
206
301
|
try:
|
|
207
302
|
show = self._get_show(args[0])
|
|
@@ -216,10 +311,10 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
216
311
|
|
|
217
312
|
def do_search(self, args):
|
|
218
313
|
"""
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
Usage: search <pattern>
|
|
314
|
+
Does a regex search on shows in the local lists.
|
|
222
315
|
|
|
316
|
+
:param pattern Regex pattern to search for.
|
|
317
|
+
:usage search <pattern>
|
|
223
318
|
"""
|
|
224
319
|
showlist = self.engine.regex_list(args[0])
|
|
225
320
|
sortedlist = sorted(showlist, key=itemgetter(self.sort))
|
|
@@ -227,10 +322,10 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
227
322
|
|
|
228
323
|
def do_add(self, args):
|
|
229
324
|
"""
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
Usage: add <pattern>
|
|
325
|
+
Search for a show in the remote service and add it.
|
|
233
326
|
|
|
327
|
+
:param pattern Show criteria to search.
|
|
328
|
+
:usage add <pattern>
|
|
234
329
|
"""
|
|
235
330
|
try:
|
|
236
331
|
entries = self.engine.search(args[0])
|
|
@@ -259,10 +354,10 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
259
354
|
|
|
260
355
|
def do_delete(self, args):
|
|
261
356
|
"""
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
Usage: delete <show index or title>
|
|
357
|
+
Deletes a show from the local list.
|
|
265
358
|
|
|
359
|
+
:param show Show index or title.
|
|
360
|
+
:usage delete <show index or title>
|
|
266
361
|
"""
|
|
267
362
|
try:
|
|
268
363
|
show = self._get_show(args[0])
|
|
@@ -273,26 +368,28 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
273
368
|
except utils.TrackmaError, e:
|
|
274
369
|
self.display_error(e)
|
|
275
370
|
|
|
276
|
-
def
|
|
371
|
+
def do_scaneps(self, args):
|
|
277
372
|
"""
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
Usage: neweps
|
|
373
|
+
Re-scans the local library.
|
|
281
374
|
"""
|
|
282
|
-
showlist = self.engine.filter_list(self.filter_num)
|
|
283
|
-
results = self.engine.get_new_episodes(showlist)
|
|
284
|
-
for show in results:
|
|
285
|
-
print show['title']
|
|
286
|
-
|
|
287
|
-
def do_scaneps(self, args):
|
|
288
375
|
self.engine.scan_library()
|
|
289
376
|
|
|
377
|
+
def do_random(self, args):
|
|
378
|
+
"""
|
|
379
|
+
Starts the media player with a random new episode.
|
|
380
|
+
"""
|
|
381
|
+
try:
|
|
382
|
+
self.engine.play_random()
|
|
383
|
+
except utils.TrackmaError, e:
|
|
384
|
+
self.display_error(e)
|
|
385
|
+
|
|
290
386
|
def do_play(self, args):
|
|
291
387
|
"""
|
|
292
|
-
|
|
293
|
-
If no episode is specified, the next will be played.
|
|
388
|
+
Starts the media player with the specified episode number (next if not specified).
|
|
294
389
|
|
|
295
|
-
|
|
390
|
+
:param show Episode index or title.
|
|
391
|
+
:optparam ep Episode number. Assume next if not specified.
|
|
392
|
+
:usage play <show index or title> [episode number]
|
|
296
393
|
"""
|
|
297
394
|
try:
|
|
298
395
|
episode = 0
|
|
@@ -315,9 +412,11 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
315
412
|
|
|
316
413
|
def do_update(self, args):
|
|
317
414
|
"""
|
|
318
|
-
|
|
415
|
+
Updates the progress of a show to the specified episode.
|
|
319
416
|
|
|
320
|
-
|
|
417
|
+
:param show Show index or name.
|
|
418
|
+
:param ep Episode number (numeric).
|
|
419
|
+
:usage update <show index or name> <episode number>
|
|
321
420
|
"""
|
|
322
421
|
try:
|
|
323
422
|
show = self._get_show(args[0])
|
|
@@ -329,9 +428,11 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
329
428
|
|
|
330
429
|
def do_score(self, args):
|
|
331
430
|
"""
|
|
332
|
-
|
|
431
|
+
Changes the score of a show.
|
|
333
432
|
|
|
334
|
-
|
|
433
|
+
:param show Show index or name.
|
|
434
|
+
:param score Score to set (numeric/decimal).
|
|
435
|
+
:usage score <show index or name> <score>
|
|
335
436
|
"""
|
|
336
437
|
try:
|
|
337
438
|
show = self._get_show(args[0])
|
|
@@ -343,10 +444,12 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
343
444
|
|
|
344
445
|
def do_status(self, args):
|
|
345
446
|
"""
|
|
346
|
-
|
|
347
|
-
|
|
447
|
+
Changes the status of a show.
|
|
448
|
+
Use the command `filter` without arguments to see the available statuses.
|
|
348
449
|
|
|
349
|
-
|
|
450
|
+
:param show Show index or name.
|
|
451
|
+
:param status Status name. Use `filter` without args to list them.
|
|
452
|
+
:usage status <show index or name> <status name>
|
|
350
453
|
"""
|
|
351
454
|
try:
|
|
352
455
|
_showtitle = args[0]
|
|
@@ -369,10 +472,7 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
369
472
|
|
|
370
473
|
def do_send(self, args):
|
|
371
474
|
"""
|
|
372
|
-
|
|
373
|
-
service.
|
|
374
|
-
|
|
375
|
-
Usage: send
|
|
475
|
+
Sends queued changes to the remote service.
|
|
376
476
|
"""
|
|
377
477
|
try:
|
|
378
478
|
self.engine.list_upload()
|
|
@@ -381,10 +481,7 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
381
481
|
|
|
382
482
|
def do_retrieve(self, args):
|
|
383
483
|
"""
|
|
384
|
-
|
|
385
|
-
and overwrites the local list.
|
|
386
|
-
|
|
387
|
-
Usage: retrieve
|
|
484
|
+
Retrieves the remote list overwrites the local one.
|
|
388
485
|
"""
|
|
389
486
|
try:
|
|
390
487
|
if self.engine.get_queue():
|
|
@@ -399,9 +496,7 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
399
496
|
|
|
400
497
|
def do_undoall(self, args):
|
|
401
498
|
"""
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
Usage: undoall
|
|
499
|
+
Undo all changes in queue.
|
|
405
500
|
"""
|
|
406
501
|
try:
|
|
407
502
|
self.engine.undoall()
|
|
@@ -410,9 +505,7 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
410
505
|
|
|
411
506
|
def do_viewqueue(self, args):
|
|
412
507
|
"""
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
Usage: viewqueue
|
|
508
|
+
List the queued changes.
|
|
416
509
|
"""
|
|
417
510
|
queue = self.engine.get_queue()
|
|
418
511
|
if len(queue):
|
|
@@ -422,8 +515,15 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
422
515
|
else:
|
|
423
516
|
print "Queue is empty."
|
|
424
517
|
|
|
518
|
+
def do_exit(self, args):
|
|
519
|
+
self.do_quit(args)
|
|
520
|
+
|
|
425
521
|
def do_quit(self, args):
|
|
426
|
-
"""
|
|
522
|
+
"""
|
|
523
|
+
Quits the program.
|
|
524
|
+
|
|
525
|
+
:name quit|exit
|
|
526
|
+
"""
|
|
427
527
|
try:
|
|
428
528
|
self.engine.unload()
|
|
429
529
|
except utils.TrackmaError, e:
|
|
@@ -465,6 +565,9 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
465
565
|
else:
|
|
466
566
|
return []
|
|
467
567
|
|
|
568
|
+
def emptyline(self):
|
|
569
|
+
return
|
|
570
|
+
|
|
468
571
|
def onecmd(self, line):
|
|
469
572
|
""" Override. """
|
|
470
573
|
cmd, arg, line = self.parseline(line)
|
|
@@ -538,6 +641,28 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
538
641
|
return k
|
|
539
642
|
raise KeyError
|
|
540
643
|
|
|
644
|
+
def _parse_doc(self, cmd, doc):
|
|
645
|
+
lines = doc.split('\n')
|
|
646
|
+
name = cmd
|
|
647
|
+
args = []
|
|
648
|
+
expl = []
|
|
649
|
+
usage = None
|
|
650
|
+
|
|
651
|
+
for line in lines:
|
|
652
|
+
line = line.strip()
|
|
653
|
+
if line[:6] == ":param":
|
|
654
|
+
args.append( line[7:].split(' ', 1) + [True] )
|
|
655
|
+
elif line[:9] == ":optparam":
|
|
656
|
+
args.append( line[10:].split(' ', 1) + [False] )
|
|
657
|
+
elif line[:6] == ':usage':
|
|
658
|
+
usage = line[7:]
|
|
659
|
+
elif line[:5] == ':name':
|
|
660
|
+
name = line[6:]
|
|
661
|
+
elif line:
|
|
662
|
+
expl.append(line)
|
|
663
|
+
|
|
664
|
+
return (name, args, expl, usage)
|
|
665
|
+
|
|
541
666
|
def _make_list(self, showlist):
|
|
542
667
|
"""
|
|
543
668
|
Helper function for printing a formatted show list
|
|
@@ -703,10 +828,6 @@ def main():
|
|
|
703
828
|
main_cmd = Trackma_cmd()
|
|
704
829
|
try:
|
|
705
830
|
main_cmd.start()
|
|
706
|
-
print
|
|
707
|
-
print "Ready. Type 'help' for a list of commands."
|
|
708
|
-
print "Press tab for autocompletion and up/down for command history."
|
|
709
|
-
print
|
|
710
831
|
main_cmd.cmdloop()
|
|
711
832
|
except utils.TrackmaFatal, e:
|
|
712
833
|
print "%s%s: %s%s" % (_COLOR_FATAL, type(e), e.message, _COLOR_RESET)
|
trackma/ui/cli.pyc
CHANGED
|
Binary file
|
trackma/ui/curses.py
CHANGED
|
@@ -46,6 +46,8 @@ class Trackma_urwid(object):
|
|
|
46
46
|
mainloop = None
|
|
47
47
|
cur_sort = 'title'
|
|
48
48
|
sorts_iter = cycle(('my_progress', 'total', 'my_score', 'id', 'title'))
|
|
49
|
+
cur_order = False
|
|
50
|
+
orders_iter = cycle((True, False))
|
|
49
51
|
keymapping = dict()
|
|
50
52
|
positions = list()
|
|
51
53
|
last_search = None
|
|
@@ -86,6 +88,7 @@ class Trackma_urwid(object):
|
|
|
86
88
|
self.header_api = urwid.Text('API:')
|
|
87
89
|
self.header_filter = urwid.Text('Filter:')
|
|
88
90
|
self.header_sort = urwid.Text('Sort:title')
|
|
91
|
+
self.header_order = urwid.Text('Order:d')
|
|
89
92
|
self.header = urwid.AttrMap(urwid.Columns([
|
|
90
93
|
self.header_title,
|
|
91
94
|
('fixed', 23, self.header_filter),
|
|
@@ -128,6 +131,7 @@ class Trackma_urwid(object):
|
|
|
128
131
|
'prev_filter': self.do_prev_filter,
|
|
129
132
|
'next_filter': self.do_next_filter,
|
|
130
133
|
'sort': self.do_sort,
|
|
134
|
+
'sort_order': self.change_sort_order,
|
|
131
135
|
'update': self.do_update,
|
|
132
136
|
'play': self.do_play,
|
|
133
137
|
'status': self.do_status,
|
|
@@ -180,7 +184,7 @@ class Trackma_urwid(object):
|
|
|
180
184
|
showlist = self.engine.get_list()
|
|
181
185
|
|
|
182
186
|
library = self.engine.library()
|
|
183
|
-
sortedlist = sorted(showlist, key=itemgetter(self.cur_sort))
|
|
187
|
+
sortedlist = sorted(showlist, key=itemgetter(self.cur_sort), reverse=self.cur_order)
|
|
184
188
|
|
|
185
189
|
for show in sortedlist:
|
|
186
190
|
if show['my_status'] == self.engine.mediainfo['status_start']:
|
|
@@ -281,6 +285,13 @@ class Trackma_urwid(object):
|
|
|
281
285
|
self._rebuild_lists()
|
|
282
286
|
self.status("Ready.")
|
|
283
287
|
|
|
288
|
+
def change_sort_order(self):
|
|
289
|
+
self.status("Sorting...")
|
|
290
|
+
_order = self.orders_iter.next()
|
|
291
|
+
self.cur_order = _order
|
|
292
|
+
self._rebuild_lists()
|
|
293
|
+
self.status("Ready.")
|
|
294
|
+
|
|
284
295
|
def do_update(self):
|
|
285
296
|
showid = self._get_selected_item().showid
|
|
286
297
|
show = self.engine.get_show_info(showid)
|
|
@@ -309,7 +320,7 @@ class Trackma_urwid(object):
|
|
|
309
320
|
helptext += "http://github.com/z411/trackma\n\n"
|
|
310
321
|
helptext += "This program is licensed under the GPLv3,\nfor more information read COPYING file.\n\n"
|
|
311
322
|
helptext += "More controls:\n Left/Right:Change Filter\n /:Search\n a:Add\n c:Change API/Mediatype\n"
|
|
312
|
-
helptext += " d:Delete\n s:Send changes\n R:Retrieve list\n Enter: View details\n O: Open website\n A:Set alternative title\n N:Search for new episodes\n F9: Change account"
|
|
323
|
+
helptext += " d:Delete\n s:Send changes\n r:Change sort order\n R:Retrieve list\n Enter: View details\n O: Open website\n A:Set alternative title\n N:Search for new episodes\n F9: Change account"
|
|
313
324
|
ok_button = urwid.Button('OK', self.help_close)
|
|
314
325
|
ok_button_wrap = urwid.Padding(urwid.AttrMap(ok_button, 'button', 'button hilight'), 'center', 6)
|
|
315
326
|
pile = urwid.Pile([urwid.Text(helptext), ok_button_wrap])
|
|
@@ -550,7 +561,7 @@ class Trackma_urwid(object):
|
|
|
550
561
|
self.last_update_prompt = (show, episode)
|
|
551
562
|
self.question("Update %s to episode %d? [y/N] " % (show['title'], episode), self.prompt_update_request)
|
|
552
563
|
|
|
553
|
-
def changed_show(self, show):
|
|
564
|
+
def changed_show(self, show, changes=None):
|
|
554
565
|
if self.started and show:
|
|
555
566
|
status = show['my_status']
|
|
556
567
|
self.lists[status].body.update_show(show)
|
trackma/ui/curses.pyc
CHANGED
|
Binary file
|