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.
- EGG-INFO/PKG-INFO +1 -1
- EGG-INFO/SOURCES.txt +9 -6
- trackma/__pycache__/__init__.cpython-34.pyc +0 -0
- trackma/__pycache__/accounts.cpython-34.pyc +0 -0
- trackma/__pycache__/data.cpython-34.pyc +0 -0
- trackma/__pycache__/engine.cpython-34.pyc +0 -0
- trackma/__pycache__/messenger.cpython-34.pyc +0 -0
- trackma/__pycache__/utils.cpython-34.pyc +0 -0
- trackma/data/kitsu.png +0 -0
- trackma/data.py +26 -16
- trackma/engine.py +60 -16
- trackma/extras/AnimeInfoExtractor.py +1 -1
- trackma/extras/__pycache__/AnimeInfoExtractor.cpython-34.pyc +0 -0
- trackma/extras/__pycache__/__init__.cpython-34.pyc +0 -0
- trackma/lib/__pycache__/__init__.cpython-34.pyc +0 -0
- trackma/lib/__pycache__/lib.cpython-34.pyc +0 -0
- trackma/lib/__pycache__/libanilist.cpython-34.pyc +0 -0
- trackma/lib/__pycache__/libkitsu.cpython-34.pyc +0 -0
- trackma/lib/__pycache__/libmal.cpython-34.pyc +0 -0
- trackma/lib/__pycache__/libshikimori.cpython-34.pyc +0 -0
- trackma/lib/__pycache__/libvndb.cpython-34.pyc +0 -0
- trackma/lib/libanilist.py +3 -3
- trackma/lib/libkitsu.py +478 -0
- trackma/lib/libmal.py +6 -6
- trackma/lib/libshikimori.py +3 -3
- trackma/lib/libvndb.py +12 -9
- trackma/messenger.py +1 -1
- trackma/tracker/__init__.py +0 -0
- trackma/tracker/__pycache__/__init__.cpython-34.pyc +0 -0
- trackma/tracker/__pycache__/inotify.cpython-34.pyc +0 -0
- trackma/tracker/__pycache__/plex.cpython-34.pyc +0 -0
- trackma/tracker/__pycache__/polling.cpython-34.pyc +0 -0
- trackma/tracker/__pycache__/pyinotify.cpython-34.pyc +0 -0
- trackma/tracker/__pycache__/tracker.cpython-34.pyc +0 -0
- trackma/tracker/__pycache__/win32.cpython-34.pyc +0 -0
- trackma/tracker/inotify.py +123 -0
- trackma/tracker/plex.py +99 -0
- trackma/tracker/polling.py +55 -0
- trackma/tracker/pyinotify.py +143 -0
- trackma/tracker/tracker.py +213 -0
- trackma/tracker/win32.py +74 -0
- trackma/ui/__pycache__/__init__.cpython-34.pyc +0 -0
- trackma/ui/__pycache__/cli.cpython-34.pyc +0 -0
- trackma/ui/__pycache__/curses.cpython-34.pyc +0 -0
- trackma/ui/__pycache__/gtkui.cpython-34.pyc +0 -0
- trackma/ui/__pycache__/qt4ui.cpython-34.pyc +0 -0
- trackma/ui/__pycache__/qtui.cpython-34.pyc +0 -0
- trackma/ui/cli.py +109 -12
- trackma/ui/curses.py +87 -29
- trackma/ui/gtkui.py +81 -45
- trackma/ui/qtui.py +95 -34
- trackma/utils.py +15 -9
- trackma/__pycache__/tracker.cpython-34.pyc +0 -0
- trackma/data/hb.jpg +0 -0
- trackma/data/melative.jpg +0 -0
- trackma/extras/__pycache__/plex.cpython-34.pyc +0 -0
- trackma/extras/plex.py +0 -101
- trackma/lib/__pycache__/libhb.cpython-34.pyc +0 -0
- trackma/lib/__pycache__/libmelative.cpython-34.pyc +0 -0
- trackma/lib/libhb.py +0 -239
- trackma/lib/libmelative.py +0 -204
- trackma/tracker.py +0 -430
trackma/tracker/win32.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
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 ctypes
|
|
18
|
+
import time
|
|
19
|
+
import re
|
|
20
|
+
|
|
21
|
+
from trackma.tracker import tracker
|
|
22
|
+
|
|
23
|
+
class Win32Tracker(tracker.TrackerBase):
|
|
24
|
+
name = 'Tracker (win32)'
|
|
25
|
+
|
|
26
|
+
def __init__(self, messenger, tracker_list, process_name, watch_dir, interval, update_wait, update_close, not_found_prompt):
|
|
27
|
+
super().__init__(messenger, tracker_list, process_name, watch_dir, interval, update_wait, update_close, not_found_prompt)
|
|
28
|
+
|
|
29
|
+
self.winregex = re.compile("(\.mkv|\.mp4|\.avi)")
|
|
30
|
+
|
|
31
|
+
def _foreach_window(self, hwnd, lParam):
|
|
32
|
+
# Get class name and window title of the current hwnd
|
|
33
|
+
# and add it to the list of the found windows
|
|
34
|
+
length = ctypes.windll.user32.GetWindowTextLengthW(hwnd)
|
|
35
|
+
|
|
36
|
+
buff_class = ctypes.create_unicode_buffer(32)
|
|
37
|
+
buff_title = ctypes.create_unicode_buffer(length + 1)
|
|
38
|
+
|
|
39
|
+
ctypes.windll.user32.GetClassNameW(hwnd, buff_class, 32)
|
|
40
|
+
ctypes.windll.user32.GetWindowTextW(hwnd, buff_title, length + 1)
|
|
41
|
+
|
|
42
|
+
self.win32_hwnd_list.append( (buff_class.value, buff_title.value) )
|
|
43
|
+
return True
|
|
44
|
+
|
|
45
|
+
def _get_playing_file_win32(self):
|
|
46
|
+
# Enumerate all windows using the win32 API
|
|
47
|
+
# This will call _foreach_window for each window handle
|
|
48
|
+
# Then return the window title if the class name matches
|
|
49
|
+
# Currently supporting MPC(-HC) and mpv
|
|
50
|
+
|
|
51
|
+
self.win32_hwnd_list = []
|
|
52
|
+
self.EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))
|
|
53
|
+
ctypes.windll.user32.EnumWindows(self.EnumWindowsProc(self._foreach_window), 0)
|
|
54
|
+
|
|
55
|
+
for classname, title in self.win32_hwnd_list:
|
|
56
|
+
if classname == 'MediaPlayerClassicW' and self.winregex.search(title) is not None:
|
|
57
|
+
return title
|
|
58
|
+
elif classname == 'mpv' and self.winregex.search(title) is not None:
|
|
59
|
+
return title.replace('mpv - ', '')
|
|
60
|
+
|
|
61
|
+
return False
|
|
62
|
+
|
|
63
|
+
def observe(self, interval, watch_dir):
|
|
64
|
+
self.msg.info(self.name, "Using Win32.")
|
|
65
|
+
|
|
66
|
+
while self.active:
|
|
67
|
+
# This runs the tracker and update the playing show if necessary
|
|
68
|
+
filename = self._get_playing_file_win32()
|
|
69
|
+
(state, show_tuple) = self._get_playing_show(filename)
|
|
70
|
+
self.update_show_if_needed(state, show_tuple)
|
|
71
|
+
|
|
72
|
+
# Wait for the interval before running check again
|
|
73
|
+
time.sleep(1)
|
|
74
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
trackma/ui/cli.py
CHANGED
|
@@ -15,10 +15,14 @@
|
|
|
15
15
|
#
|
|
16
16
|
|
|
17
17
|
import sys
|
|
18
|
+
|
|
18
19
|
try:
|
|
19
20
|
import readline
|
|
21
|
+
has_readline = True
|
|
20
22
|
except ImportError:
|
|
23
|
+
has_readline = False
|
|
21
24
|
pass # readline is optional
|
|
25
|
+
|
|
22
26
|
import cmd
|
|
23
27
|
import shlex
|
|
24
28
|
import textwrap
|
|
@@ -61,6 +65,7 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
61
65
|
completekey = 'Tab'
|
|
62
66
|
cmdqueue = []
|
|
63
67
|
stdout = sys.stdout
|
|
68
|
+
in_prompt = False
|
|
64
69
|
sortedlist = []
|
|
65
70
|
needed_args = {
|
|
66
71
|
'altname': (1, 2),
|
|
@@ -78,10 +83,10 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
def __init__(self, account_num=None, debug=False):
|
|
81
|
-
print('Trackma v'+utils.VERSION+' Copyright (C) 2012 z411')
|
|
82
|
-
print('This program comes with ABSOLUTELY NO WARRANTY; for details type `
|
|
86
|
+
print('Trackma v'+utils.VERSION+' Copyright (C) 2012-2017 z411')
|
|
87
|
+
print('This program comes with ABSOLUTELY NO WARRANTY; for details type `about\'')
|
|
83
88
|
print('This is free software, and you are welcome to redistribute it')
|
|
84
|
-
print('under certain conditions; see the file
|
|
89
|
+
print('under certain conditions; see the COPYING file for details.')
|
|
85
90
|
print()
|
|
86
91
|
|
|
87
92
|
self.debug = debug
|
|
@@ -127,10 +132,15 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
127
132
|
return self.engine.get_show_info_title(title)
|
|
128
133
|
|
|
129
134
|
def _ask_update(self, show, episode):
|
|
130
|
-
|
|
131
|
-
if
|
|
135
|
+
do = input("Should I update {} to episode {}? [y/N] ".format(show['title'], episode))
|
|
136
|
+
if do.lower() == 'y':
|
|
132
137
|
self.engine.set_episode(show['id'], episode)
|
|
133
138
|
|
|
139
|
+
def _ask_add(self, show_title, episode):
|
|
140
|
+
do = input("Should I search for the show {}? [y/N] ".format(show_title))
|
|
141
|
+
if do.lower() == 'y':
|
|
142
|
+
self.do_add([show_title])
|
|
143
|
+
|
|
134
144
|
def start(self):
|
|
135
145
|
"""
|
|
136
146
|
Initializes the engine
|
|
@@ -144,6 +154,7 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
144
154
|
self.engine.connect_signal('status_changed', self._load_list)
|
|
145
155
|
self.engine.connect_signal('episode_changed', self._load_list)
|
|
146
156
|
self.engine.connect_signal('prompt_for_update', self._ask_update)
|
|
157
|
+
self.engine.connect_signal('prompt_for_add', self._ask_add)
|
|
147
158
|
self.engine.start()
|
|
148
159
|
|
|
149
160
|
# Start with default filter selected
|
|
@@ -157,6 +168,21 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
157
168
|
self.do_filter(None) # Show available filters
|
|
158
169
|
print()
|
|
159
170
|
|
|
171
|
+
def do_about(self, args):
|
|
172
|
+
print("Trackma {} by z411 (z411@omaera.org)".format(utils.VERSION))
|
|
173
|
+
print("Trackma is an open source client for media tracking websites.")
|
|
174
|
+
print("https://github.com/z411/trackma")
|
|
175
|
+
print()
|
|
176
|
+
print("This program is licensed under the GPLv3 and it comes with ASOLUTELY NO WARRANTY.")
|
|
177
|
+
print("Many contributors have helped to run this project; for more information see the AUTHORS file.")
|
|
178
|
+
print("For more information about the license, see the COPYING file.")
|
|
179
|
+
print()
|
|
180
|
+
print("If you encounter any problems please report them in https://github.com/z411/trackma/issues")
|
|
181
|
+
print()
|
|
182
|
+
print("This is the CLI version of Trackma. To see available commands type `help'.")
|
|
183
|
+
print("For other available interfaces please see the README file.")
|
|
184
|
+
print()
|
|
185
|
+
|
|
160
186
|
def do_help(self, arg):
|
|
161
187
|
if arg:
|
|
162
188
|
try:
|
|
@@ -318,7 +344,11 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
318
344
|
self.display_error(e)
|
|
319
345
|
return
|
|
320
346
|
|
|
321
|
-
print(
|
|
347
|
+
print(details['title'])
|
|
348
|
+
print("-" * len(details['title']))
|
|
349
|
+
print(show['url'])
|
|
350
|
+
print()
|
|
351
|
+
|
|
322
352
|
for line in details['extra']:
|
|
323
353
|
print("%s: %s" % line)
|
|
324
354
|
|
|
@@ -395,6 +425,43 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
395
425
|
except utils.TrackmaError as e:
|
|
396
426
|
self.display_error(e)
|
|
397
427
|
|
|
428
|
+
def do_tracker(self, args):
|
|
429
|
+
"""
|
|
430
|
+
Shows information about the tracker, if it's running.
|
|
431
|
+
|
|
432
|
+
:usage trackmer
|
|
433
|
+
"""
|
|
434
|
+
try:
|
|
435
|
+
info = self.engine.tracker_status()
|
|
436
|
+
print("- Tracker status -")
|
|
437
|
+
|
|
438
|
+
if info:
|
|
439
|
+
if info['state'] == utils.TRACKER_NOVIDEO:
|
|
440
|
+
state = 'No video'
|
|
441
|
+
elif info['state'] == utils.TRACKER_PLAYING:
|
|
442
|
+
state = 'Playing'
|
|
443
|
+
elif info['state'] == utils.TRACKER_UNRECOGNIZED:
|
|
444
|
+
state = 'Unrecognized'
|
|
445
|
+
elif info['state'] == utils.TRACKER_NOT_FOUND:
|
|
446
|
+
state = 'Not found'
|
|
447
|
+
elif info['state'] == utils.TRACKER_IGNORED:
|
|
448
|
+
state = 'Ignored'
|
|
449
|
+
else:
|
|
450
|
+
state = 'N/A'
|
|
451
|
+
|
|
452
|
+
print("State: {}".format(state))
|
|
453
|
+
print("Filename: {}".format(info['filename'] or 'N/A'))
|
|
454
|
+
print("Timer: {}".format(info['timer'] or 'N/A'))
|
|
455
|
+
if info['show']:
|
|
456
|
+
(show, ep) = info['show']
|
|
457
|
+
print("Show: {}\nEpisode: {}".format(show['title'], ep))
|
|
458
|
+
else:
|
|
459
|
+
print("Show: N/A")
|
|
460
|
+
else:
|
|
461
|
+
print("Not started")
|
|
462
|
+
except utils.TrackmaError as e:
|
|
463
|
+
self.display_error(e)
|
|
464
|
+
|
|
398
465
|
def do_play(self, args):
|
|
399
466
|
"""
|
|
400
467
|
Starts the media player with the specified episode number (next if not specified).
|
|
@@ -601,6 +668,20 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
601
668
|
def emptyline(self):
|
|
602
669
|
return
|
|
603
670
|
|
|
671
|
+
def preloop(self):
|
|
672
|
+
""" Override. """
|
|
673
|
+
self.in_prompt = True
|
|
674
|
+
|
|
675
|
+
def precmd(self, line):
|
|
676
|
+
""" Override. """
|
|
677
|
+
self.in_prompt = False
|
|
678
|
+
return line
|
|
679
|
+
|
|
680
|
+
def postcmd(self, stop, line):
|
|
681
|
+
""" Override. """
|
|
682
|
+
self.in_prompt = True
|
|
683
|
+
return stop
|
|
684
|
+
|
|
604
685
|
def onecmd(self, line):
|
|
605
686
|
""" Override. """
|
|
606
687
|
cmd, arg, line = self.parseline(line)
|
|
@@ -654,19 +735,35 @@ class Trackma_cmd(cmd.Cmd):
|
|
|
654
735
|
color_escape = _COLOR_ENGINE
|
|
655
736
|
elif classname == 'Data':
|
|
656
737
|
color_escape = _COLOR_DATA
|
|
657
|
-
elif classname == 'Tracker':
|
|
658
|
-
color_escape = _COLOR_TRACKER
|
|
659
738
|
elif classname.startswith('lib'):
|
|
660
739
|
color_escape = _COLOR_API
|
|
740
|
+
elif classname.startswith('Tracker'):
|
|
741
|
+
color_escape = _COLOR_TRACKER
|
|
661
742
|
else:
|
|
662
743
|
color_reset = ''
|
|
663
744
|
|
|
664
745
|
if msgtype == messenger.TYPE_INFO:
|
|
665
|
-
|
|
746
|
+
out = "%s%s: %s%s" % (color_escape, classname, msg, color_reset)
|
|
666
747
|
elif msgtype == messenger.TYPE_WARN:
|
|
667
|
-
|
|
748
|
+
out = "%s%s warning: %s%s" % (color_escape, classname, msg, color_reset)
|
|
668
749
|
elif self.debug and msgtype == messenger.TYPE_DEBUG:
|
|
669
|
-
|
|
750
|
+
out = "[D] %s%s: %s%s" % (color_escape, classname, msg, color_reset)
|
|
751
|
+
else:
|
|
752
|
+
return # Unrecognized message, don't show anything
|
|
753
|
+
|
|
754
|
+
if has_readline and self.in_prompt:
|
|
755
|
+
# If we're in a prompt and receive a message
|
|
756
|
+
# (often from the tracker) we need to clear the line
|
|
757
|
+
# first, show the message, then re-show the prompt.
|
|
758
|
+
buf = readline.get_line_buffer()
|
|
759
|
+
self.stdout.write('\r' + ' '*(len(self.prompt)+len(buf)) + '\r')
|
|
760
|
+
|
|
761
|
+
print(out)
|
|
762
|
+
|
|
763
|
+
self.stdout.write(self.prompt + buf)
|
|
764
|
+
self.stdout.flush()
|
|
765
|
+
else:
|
|
766
|
+
print(out)
|
|
670
767
|
|
|
671
768
|
def _guess_status(self, string):
|
|
672
769
|
for k, v in self.engine.mediainfo['statuses_dict'].items():
|
|
@@ -864,7 +961,7 @@ def usage():
|
|
|
864
961
|
print("Usage: trackma [options]")
|
|
865
962
|
print()
|
|
866
963
|
print("Options:")
|
|
867
|
-
print(" -a --
|
|
964
|
+
print(" -a --account\tPre-selects account number")
|
|
868
965
|
print(" -d --debug\tShows debugging information")
|
|
869
966
|
print(" -h --help\tShows this help")
|
|
870
967
|
print()
|
trackma/ui/curses.py
CHANGED
|
@@ -67,6 +67,7 @@ class Trackma_urwid():
|
|
|
67
67
|
for k, color in self.config['palette'].items():
|
|
68
68
|
palette.append( (k, color[0], color[1]) )
|
|
69
69
|
|
|
70
|
+
# Prepare header
|
|
70
71
|
sys.stdout.write("\x1b]0;Trackma-curses "+utils.VERSION+"\x07");
|
|
71
72
|
self.header_title = urwid.Text('Trackma-curses ' + utils.VERSION)
|
|
72
73
|
self.header_api = urwid.Text('API:')
|
|
@@ -75,7 +76,7 @@ class Trackma_urwid():
|
|
|
75
76
|
self.header_order = urwid.Text('Order:d')
|
|
76
77
|
self.header = urwid.AttrMap(urwid.Columns([
|
|
77
78
|
self.header_title,
|
|
78
|
-
('fixed',
|
|
79
|
+
('fixed', 30, self.header_filter),
|
|
79
80
|
('fixed', 17, self.header_sort),
|
|
80
81
|
('fixed', 16, self.header_api)]), 'status')
|
|
81
82
|
|
|
@@ -90,7 +91,16 @@ class Trackma_urwid():
|
|
|
90
91
|
top_pile.append(urwid.AttrMap(urwid.Text(top_text), 'status'))
|
|
91
92
|
|
|
92
93
|
self.top_pile = urwid.Pile(top_pile)
|
|
93
|
-
|
|
94
|
+
|
|
95
|
+
# Prepare status bar
|
|
96
|
+
self.status_text = urwid.Text('Trackma-curses '+utils.VERSION)
|
|
97
|
+
self.status_queue = urwid.Text('Q:N/A')
|
|
98
|
+
self.status_tracker = urwid.Text('T:N/A')
|
|
99
|
+
self.statusbar = urwid.AttrMap(urwid.Columns([
|
|
100
|
+
self.status_text,
|
|
101
|
+
('fixed', 10, self.status_tracker),
|
|
102
|
+
('fixed', 6, self.status_queue),
|
|
103
|
+
]), 'status')
|
|
94
104
|
|
|
95
105
|
self.listheader = urwid.AttrMap(
|
|
96
106
|
urwid.Columns([
|
|
@@ -163,13 +173,22 @@ class Trackma_urwid():
|
|
|
163
173
|
self.lists = dict()
|
|
164
174
|
self.filters = self.engine.mediainfo['statuses_dict']
|
|
165
175
|
self.filters_nums = self.engine.mediainfo['statuses']
|
|
176
|
+
self.filters_sizes = []
|
|
177
|
+
|
|
178
|
+
track_info = self.engine.tracker_status()
|
|
179
|
+
if track_info:
|
|
180
|
+
self.tracker_state(track_info['state'], None)
|
|
166
181
|
|
|
167
182
|
for status in self.filters_nums:
|
|
168
183
|
self.lists[status] = urwid.ListBox(ShowWalker([]))
|
|
169
184
|
|
|
170
185
|
self._rebuild_lists()
|
|
186
|
+
|
|
187
|
+
# Put the number of shows in every status in a list
|
|
188
|
+
for status in self.filters_nums:
|
|
189
|
+
self.filters_sizes.append(len(self.lists[status].body))
|
|
190
|
+
|
|
171
191
|
self.set_filter(0)
|
|
172
|
-
|
|
173
192
|
self.status('Ready.')
|
|
174
193
|
self.started = True
|
|
175
194
|
|
|
@@ -207,7 +226,9 @@ class Trackma_urwid():
|
|
|
207
226
|
self.engine.connect_signal('show_added', self.changed_list)
|
|
208
227
|
self.engine.connect_signal('show_deleted', self.changed_list)
|
|
209
228
|
self.engine.connect_signal('show_synced', self.changed_show)
|
|
229
|
+
self.engine.connect_signal('queue_changed', self.changed_queue)
|
|
210
230
|
self.engine.connect_signal('prompt_for_update', self.prompt_update)
|
|
231
|
+
self.engine.connect_signal('tracker_state', self.tracker_state)
|
|
211
232
|
|
|
212
233
|
# Engine start and list rebuildi
|
|
213
234
|
self.status("Building lists...")
|
|
@@ -217,7 +238,7 @@ class Trackma_urwid():
|
|
|
217
238
|
def set_filter(self, filter_num):
|
|
218
239
|
self.cur_filter = filter_num
|
|
219
240
|
_filter = self.filters_nums[self.cur_filter]
|
|
220
|
-
self.header_filter.set_text("Filter:%s" % self.filters[_filter])
|
|
241
|
+
self.header_filter.set_text("Filter:%s (%d)" % (self.filters[_filter], self.filters_sizes[self.cur_filter]))
|
|
221
242
|
|
|
222
243
|
self.listframe.body = self.lists[_filter]
|
|
223
244
|
|
|
@@ -229,10 +250,10 @@ class Trackma_urwid():
|
|
|
229
250
|
return self._get_cur_list().get_focus()[0]
|
|
230
251
|
|
|
231
252
|
def status(self, msg):
|
|
232
|
-
self.
|
|
253
|
+
self.status_text.set_text(msg)
|
|
233
254
|
|
|
234
255
|
def error(self, msg):
|
|
235
|
-
self.
|
|
256
|
+
self.status_text.set_text([('error', "Error: %s" % msg)])
|
|
236
257
|
|
|
237
258
|
def message_handler(self, classname, msgtype, msg):
|
|
238
259
|
if msgtype != messenger.TYPE_DEBUG:
|
|
@@ -266,7 +287,8 @@ class Trackma_urwid():
|
|
|
266
287
|
self.ask('Search on remote: ', self.addsearch_request)
|
|
267
288
|
|
|
268
289
|
def do_delete(self):
|
|
269
|
-
self.
|
|
290
|
+
if self._get_selected_item():
|
|
291
|
+
self.question('Delete selected show? [y/n] ', self.delete_request)
|
|
270
292
|
|
|
271
293
|
def do_prev_filter(self):
|
|
272
294
|
if self.cur_filter > 0:
|
|
@@ -292,14 +314,16 @@ class Trackma_urwid():
|
|
|
292
314
|
self.status("Ready.")
|
|
293
315
|
|
|
294
316
|
def do_update(self):
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
317
|
+
item = self._get_selected_item()
|
|
318
|
+
if item:
|
|
319
|
+
show = self.engine.get_show_info(item.showid)
|
|
320
|
+
self.ask('[Update] Episode # to update to: ', self.update_request, show['my_progress'])
|
|
298
321
|
|
|
299
322
|
def do_play(self):
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
323
|
+
item = self._get_selected_item()
|
|
324
|
+
if item:
|
|
325
|
+
show = self.engine.get_show_info(item.showid)
|
|
326
|
+
self.ask('[Play] Episode # to play: ', self.play_request, show['my_progress']+1)
|
|
303
327
|
|
|
304
328
|
def do_send(self):
|
|
305
329
|
self.engine.list_upload()
|
|
@@ -314,7 +338,7 @@ class Trackma_urwid():
|
|
|
314
338
|
self.error(e)
|
|
315
339
|
|
|
316
340
|
def do_help(self):
|
|
317
|
-
helptext = "Trackma-curses "+utils.VERSION+" by z411 (
|
|
341
|
+
helptext = "Trackma-curses "+utils.VERSION+" by z411 (z411@omaera.org)\n\n"
|
|
318
342
|
helptext += "Trackma is an open source client for media tracking websites.\n"
|
|
319
343
|
helptext += "http://github.com/z411/trackma\n\n"
|
|
320
344
|
helptext += "This program is licensed under the GPLv3,\nfor more information read COPYING file.\n\n"
|
|
@@ -331,19 +355,24 @@ class Trackma_urwid():
|
|
|
331
355
|
self.dialog.close()
|
|
332
356
|
|
|
333
357
|
def do_altname(self):
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
358
|
+
item = self._get_selected_item()
|
|
359
|
+
if item:
|
|
360
|
+
show = self.engine.get_show_info(item.showid)
|
|
361
|
+
self.status(show['title'])
|
|
362
|
+
self.ask('[Altname] New alternative name: ', self.altname_request, self.engine.altname(showid))
|
|
338
363
|
|
|
339
364
|
def do_score(self):
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
365
|
+
item = self._get_selected_item()
|
|
366
|
+
if item:
|
|
367
|
+
show = self.engine.get_show_info(item.showid)
|
|
368
|
+
self.ask('[Score] Score to change to: ', self.score_request, show['my_score'])
|
|
343
369
|
|
|
344
370
|
def do_status(self):
|
|
345
|
-
|
|
346
|
-
|
|
371
|
+
item = self._get_selected_item()
|
|
372
|
+
if not item:
|
|
373
|
+
return
|
|
374
|
+
|
|
375
|
+
show = self.engine.get_show_info(item.showid)
|
|
347
376
|
|
|
348
377
|
buttons = list()
|
|
349
378
|
num = 1
|
|
@@ -387,17 +416,21 @@ class Trackma_urwid():
|
|
|
387
416
|
self._rebuild()
|
|
388
417
|
|
|
389
418
|
def do_open_web(self):
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
419
|
+
item = self._get_selected_item()
|
|
420
|
+
if item:
|
|
421
|
+
show = self.engine.get_show_info(item.showid)
|
|
422
|
+
if show['url']:
|
|
423
|
+
webbrowser.open(show['url'], 2, True)
|
|
394
424
|
|
|
395
425
|
def do_info(self):
|
|
396
426
|
if self.viewing_info:
|
|
397
427
|
return
|
|
398
428
|
|
|
399
|
-
|
|
400
|
-
|
|
429
|
+
item = self._get_selected_item()
|
|
430
|
+
if not item:
|
|
431
|
+
return
|
|
432
|
+
|
|
433
|
+
show = self.engine.get_show_info(item.showid)
|
|
401
434
|
|
|
402
435
|
self.status("Getting show details...")
|
|
403
436
|
|
|
@@ -581,6 +614,31 @@ class Trackma_urwid():
|
|
|
581
614
|
self.set_filter(go_filter)
|
|
582
615
|
self._get_cur_list().select_show(show)
|
|
583
616
|
|
|
617
|
+
def changed_queue(self, queue):
|
|
618
|
+
self.status_queue.set_text("Q:{}".format(len(queue)))
|
|
619
|
+
|
|
620
|
+
def tracker_state(self, state, timer):
|
|
621
|
+
if state == utils.TRACKER_NOVIDEO:
|
|
622
|
+
st = 'LISTEN'
|
|
623
|
+
elif state == utils.TRACKER_PLAYING:
|
|
624
|
+
st = '+{}'.format(timer)
|
|
625
|
+
elif state == utils.TRACKER_UNRECOGNIZED:
|
|
626
|
+
st = 'UNRECOG'
|
|
627
|
+
elif state == utils.TRACKER_NOT_FOUND:
|
|
628
|
+
st = 'NOTFOUN'
|
|
629
|
+
elif state == utils.TRACKER_IGNORED:
|
|
630
|
+
st = 'IGNORE'
|
|
631
|
+
else:
|
|
632
|
+
st = '???'
|
|
633
|
+
|
|
634
|
+
self.status_tracker.set_text("T:{}".format(st))
|
|
635
|
+
self.mainloop.draw_screen()
|
|
636
|
+
|
|
637
|
+
def tracker_timer(self, timer):
|
|
638
|
+
if timer is not None:
|
|
639
|
+
self.status_tracker.set_text("T:+{}".format(timer))
|
|
640
|
+
self.mainloop.draw_screen()
|
|
641
|
+
|
|
584
642
|
def playing_show(self, show, is_playing, episode=None):
|
|
585
643
|
status = show['my_status']
|
|
586
644
|
self.lists[status].body.playing_show(show, is_playing)
|