trackma 0.6.2__py3.4.egg → 0.7.1__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 +10 -6
- EGG-INFO/requires.txt +0 -2
- 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 +68 -17
- 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 +507 -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__/inotifyBase.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 +69 -0
- trackma/tracker/inotifyBase.py +110 -0
- trackma/tracker/plex.py +106 -0
- trackma/tracker/polling.py +55 -0
- trackma/tracker/pyinotify.py +90 -0
- trackma/tracker/tracker.py +221 -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 +110 -13
- trackma/ui/curses.py +88 -30
- trackma/ui/gtkui.py +120 -58
- trackma/ui/qtui.py +161 -49
- trackma/utils.py +16 -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/ui/qtui.py
CHANGED
|
@@ -109,9 +109,11 @@ class Trackma(QMainWindow):
|
|
|
109
109
|
Main GUI class
|
|
110
110
|
|
|
111
111
|
"""
|
|
112
|
+
debug = False
|
|
112
113
|
config = None
|
|
113
114
|
tray = None
|
|
114
115
|
accountman = None
|
|
116
|
+
accountman_widget = None
|
|
115
117
|
worker = None
|
|
116
118
|
image_worker = None
|
|
117
119
|
started = False
|
|
@@ -120,8 +122,9 @@ class Trackma(QMainWindow):
|
|
|
120
122
|
finish = False
|
|
121
123
|
was_maximized = False
|
|
122
124
|
|
|
123
|
-
def __init__(self):
|
|
125
|
+
def __init__(self, debug=False):
|
|
124
126
|
QMainWindow.__init__(self, None)
|
|
127
|
+
self.debug = debug
|
|
125
128
|
|
|
126
129
|
# Load QT specific configuration
|
|
127
130
|
self.configfile = utils.get_root_filename('ui-qt.json')
|
|
@@ -134,8 +137,6 @@ class Trackma(QMainWindow):
|
|
|
134
137
|
self.setWindowTitle('Trackma-qt')
|
|
135
138
|
|
|
136
139
|
self.accountman = AccountManager()
|
|
137
|
-
self.accountman_widget = AccountDialog(None, self.accountman)
|
|
138
|
-
self.accountman_widget.selected.connect(self.accountman_selected)
|
|
139
140
|
|
|
140
141
|
# Go directly into the application if a default account is set
|
|
141
142
|
# Open the selection dialog otherwise
|
|
@@ -143,7 +144,12 @@ class Trackma(QMainWindow):
|
|
|
143
144
|
if default:
|
|
144
145
|
self.start(default)
|
|
145
146
|
else:
|
|
146
|
-
self.
|
|
147
|
+
self.accountman_create()
|
|
148
|
+
accountman_widget.show()
|
|
149
|
+
|
|
150
|
+
def accountman_create(self):
|
|
151
|
+
self.accountman_widget = AccountDialog(None, self.accountman)
|
|
152
|
+
self.accountman_widget.selected.connect(self.accountman_selected)
|
|
147
153
|
|
|
148
154
|
def accountman_selected(self, account_num, remember):
|
|
149
155
|
account = self.accountman.get_account(account_num)
|
|
@@ -374,8 +380,8 @@ class Trackma(QMainWindow):
|
|
|
374
380
|
|
|
375
381
|
#self.setMinimumSize(740, 480)
|
|
376
382
|
if self.config['remember_geometry']:
|
|
377
|
-
self.
|
|
378
|
-
|
|
383
|
+
self.resize(self.config['last_width'], self.config['last_height'])
|
|
384
|
+
self.move(self.config['last_x'], self.config['last_y'])
|
|
379
385
|
|
|
380
386
|
self.show_image = QLabel('Trackma-qt')
|
|
381
387
|
self.show_image.setFixedHeight(149)
|
|
@@ -460,9 +466,12 @@ class Trackma(QMainWindow):
|
|
|
460
466
|
|
|
461
467
|
# Statusbar
|
|
462
468
|
self.status_text = QLabel('Trackma-qt')
|
|
469
|
+
self.tracker_text = QLabel('Tracker: N/A')
|
|
470
|
+
self.tracker_text.setMinimumWidth(120)
|
|
463
471
|
self.queue_text = QLabel('Unsynced items: N/A')
|
|
464
472
|
self.statusBar().addWidget(self.status_text, 1)
|
|
465
|
-
self.statusBar().
|
|
473
|
+
self.statusBar().addPermanentWidget(self.tracker_text)
|
|
474
|
+
self.statusBar().addPermanentWidget(self.queue_text)
|
|
466
475
|
|
|
467
476
|
# Tray icon
|
|
468
477
|
tray_menu = QMenu(self)
|
|
@@ -477,14 +486,16 @@ class Trackma(QMainWindow):
|
|
|
477
486
|
self._tray()
|
|
478
487
|
|
|
479
488
|
# Connect worker signals
|
|
480
|
-
self.worker.changed_status.connect(self.
|
|
489
|
+
self.worker.changed_status.connect(self.ws_changed_status)
|
|
481
490
|
self.worker.raised_error.connect(self.error)
|
|
482
491
|
self.worker.raised_fatal.connect(self.fatal)
|
|
483
492
|
self.worker.changed_show.connect(self.ws_changed_show)
|
|
484
493
|
self.worker.changed_list.connect(self.ws_changed_list)
|
|
485
494
|
self.worker.changed_queue.connect(self.ws_changed_queue)
|
|
495
|
+
self.worker.tracker_state.connect(self.ws_tracker_state)
|
|
486
496
|
self.worker.playing_show.connect(self.ws_changed_show)
|
|
487
497
|
self.worker.prompt_for_update.connect(self.ws_prompt_update)
|
|
498
|
+
self.worker.prompt_for_add.connect(self.ws_prompt_add)
|
|
488
499
|
|
|
489
500
|
# Show main window
|
|
490
501
|
if not (self.config['show_tray'] and self.config['start_in_tray']):
|
|
@@ -588,6 +599,23 @@ class Trackma(QMainWindow):
|
|
|
588
599
|
def _update_queue_counter(self, queue):
|
|
589
600
|
self.queue_text.setText("Unsynced items: %d" % queue)
|
|
590
601
|
|
|
602
|
+
def _update_tracker_info(self, state, timer):
|
|
603
|
+
if state == utils.TRACKER_NOVIDEO:
|
|
604
|
+
st = 'Listen'
|
|
605
|
+
elif state == utils.TRACKER_PLAYING:
|
|
606
|
+
(m, s) = divmod(timer, 60)
|
|
607
|
+
st = "+{0}:{1:02d}".format(m, s)
|
|
608
|
+
elif state == utils.TRACKER_UNRECOGNIZED:
|
|
609
|
+
st = 'Unrecognized'
|
|
610
|
+
elif state == utils.TRACKER_NOT_FOUND:
|
|
611
|
+
st = 'Not found'
|
|
612
|
+
elif state == utils.TRACKER_IGNORED:
|
|
613
|
+
st = 'Ignored'
|
|
614
|
+
else:
|
|
615
|
+
st = '???'
|
|
616
|
+
|
|
617
|
+
self.tracker_text.setText("Tracker: {}".format(st))
|
|
618
|
+
|
|
591
619
|
def _update_config(self):
|
|
592
620
|
self._tray()
|
|
593
621
|
self._filter_bar()
|
|
@@ -646,6 +674,8 @@ class Trackma(QMainWindow):
|
|
|
646
674
|
for status in statuses_nums:
|
|
647
675
|
self._rebuild_list(status, filtered_list[status], altnames, library)
|
|
648
676
|
|
|
677
|
+
self.s_filter_changed()
|
|
678
|
+
|
|
649
679
|
def _rebuild_list(self, status, showlist=None, altnames=None, library=None):
|
|
650
680
|
if not showlist:
|
|
651
681
|
showlist = self.worker.engine.filter_list(status)
|
|
@@ -709,7 +739,7 @@ class Trackma(QMainWindow):
|
|
|
709
739
|
title_str = show['title']
|
|
710
740
|
if altname:
|
|
711
741
|
title_str += " [%s]" % altname
|
|
712
|
-
progress_str = "
|
|
742
|
+
progress_str = "{} / {}".format(show['my_progress'], show['total'] or '?')
|
|
713
743
|
percent_widget = EpisodeBar(self, self.config['colors'])
|
|
714
744
|
percent_widget.setRange(0, 100)
|
|
715
745
|
percent_widget.setBarStyle(self.config['episodebar_style'], self.config['episodebar_text'])
|
|
@@ -816,7 +846,7 @@ class Trackma(QMainWindow):
|
|
|
816
846
|
# Regenerate Play Episode Menu
|
|
817
847
|
self.generate_episode_menus(self.menu_play, show['total'], show['my_progress'])
|
|
818
848
|
else:
|
|
819
|
-
self.show_progress.setMaximum(utils.estimate_aired_episodes(show))
|
|
849
|
+
self.show_progress.setMaximum(utils.estimate_aired_episodes(show) or 10000)
|
|
820
850
|
self.generate_episode_menus(self.menu_play, utils.estimate_aired_episodes(show),show['my_progress'])
|
|
821
851
|
|
|
822
852
|
# Update information
|
|
@@ -1110,7 +1140,7 @@ class Trackma(QMainWindow):
|
|
|
1110
1140
|
|
|
1111
1141
|
def s_set_tags(self):
|
|
1112
1142
|
show = self.worker.engine.get_show_info(self.selected_show_id)
|
|
1113
|
-
if show['my_tags']:
|
|
1143
|
+
if 'my_tags' in show and show['my_tags']:
|
|
1114
1144
|
tags = show['my_tags']
|
|
1115
1145
|
else:
|
|
1116
1146
|
tags = ''
|
|
@@ -1144,11 +1174,14 @@ class Trackma(QMainWindow):
|
|
|
1144
1174
|
ep_default = 1
|
|
1145
1175
|
ep_min = 1
|
|
1146
1176
|
ep_max = utils.estimate_aired_episodes(show)
|
|
1147
|
-
if ep_max
|
|
1148
|
-
|
|
1177
|
+
if not ep_max:
|
|
1178
|
+
# If we don't know the total just allow anything
|
|
1179
|
+
ep_max = show['total'] or 10000
|
|
1180
|
+
|
|
1149
1181
|
episode, ok = QInputDialog.getInt(self, 'Play Episode',
|
|
1150
1182
|
'Enter an episode number of %s to play:' % show['title'],
|
|
1151
1183
|
ep_default, ep_min, ep_max)
|
|
1184
|
+
|
|
1152
1185
|
if ok:
|
|
1153
1186
|
self.s_play(False, episode)
|
|
1154
1187
|
|
|
@@ -1186,7 +1219,7 @@ class Trackma(QMainWindow):
|
|
|
1186
1219
|
if queue:
|
|
1187
1220
|
reply = QMessageBox.question(self, 'Confirmation',
|
|
1188
1221
|
'There are %d unsynced changes. Do you want to send them first? (Choosing No will discard them!)' % len(queue),
|
|
1189
|
-
QMessageBox.Yes
|
|
1222
|
+
QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
|
|
1190
1223
|
|
|
1191
1224
|
if reply == QMessageBox.Yes:
|
|
1192
1225
|
self.s_send(True)
|
|
@@ -1205,6 +1238,9 @@ class Trackma(QMainWindow):
|
|
|
1205
1238
|
self.worker_call('list_upload', self.r_generic_ready)
|
|
1206
1239
|
|
|
1207
1240
|
def s_switch_account(self):
|
|
1241
|
+
if not self.accountman_widget:
|
|
1242
|
+
self.accountman_create()
|
|
1243
|
+
|
|
1208
1244
|
self.accountman_widget.setModal(True)
|
|
1209
1245
|
self.accountman_widget.show()
|
|
1210
1246
|
|
|
@@ -1278,6 +1314,12 @@ class Trackma(QMainWindow):
|
|
|
1278
1314
|
showlist.setColumnWidth(index, MIN_WIDTH)
|
|
1279
1315
|
|
|
1280
1316
|
### Worker slots
|
|
1317
|
+
def ws_changed_status(self, classname, msgtype, msg):
|
|
1318
|
+
if msgtype != messenger.TYPE_DEBUG:
|
|
1319
|
+
self.status('{}: {}'.format(classname, msg))
|
|
1320
|
+
elif self.debug:
|
|
1321
|
+
print('[D] {}: {}'.format(classname, msg))
|
|
1322
|
+
|
|
1281
1323
|
def ws_changed_show(self, show, is_playing=False, episode=None, altname=None):
|
|
1282
1324
|
if show:
|
|
1283
1325
|
if not self.show_lists:
|
|
@@ -1317,6 +1359,9 @@ class Trackma(QMainWindow):
|
|
|
1317
1359
|
def ws_changed_queue(self, queue):
|
|
1318
1360
|
self._update_queue_counter(queue)
|
|
1319
1361
|
|
|
1362
|
+
def ws_tracker_state(self, state, timer):
|
|
1363
|
+
self._update_tracker_info(state, timer)
|
|
1364
|
+
|
|
1320
1365
|
def ws_prompt_update(self, show, episode):
|
|
1321
1366
|
reply = QMessageBox.question(self, 'Message',
|
|
1322
1367
|
'Do you want to update %s to %d?' % (show['title'], episode),
|
|
@@ -1325,6 +1370,12 @@ class Trackma(QMainWindow):
|
|
|
1325
1370
|
if reply == QMessageBox.Yes:
|
|
1326
1371
|
self.worker_call('set_episode', self.r_generic, show['id'], episode)
|
|
1327
1372
|
|
|
1373
|
+
def ws_prompt_add(self, show_title, episode):
|
|
1374
|
+
addwindow = AddDialog(None, self.worker, None, default=show_title)
|
|
1375
|
+
addwindow.setModal(True)
|
|
1376
|
+
if addwindow.exec_():
|
|
1377
|
+
self.worker_call('set_episode', self.r_generic, addwindow.selected_show['id'], episode)
|
|
1378
|
+
|
|
1328
1379
|
### Responses from the engine thread
|
|
1329
1380
|
def r_generic(self):
|
|
1330
1381
|
self._unbusy()
|
|
@@ -1410,11 +1461,15 @@ class Trackma(QMainWindow):
|
|
|
1410
1461
|
self.api_user.setText(self.worker.engine.get_userconfig('username'))
|
|
1411
1462
|
self.setWindowTitle("Trackma-qt %s [%s (%s)]" % (utils.VERSION, self.api_info['name'], self.api_info['mediatype']))
|
|
1412
1463
|
|
|
1464
|
+
# Show tracker info
|
|
1465
|
+
tracker_info = self.worker.engine.tracker_status()
|
|
1466
|
+
if tracker_info:
|
|
1467
|
+
self._update_tracker_info(tracker_info['state'], tracker_info['timer'])
|
|
1468
|
+
|
|
1413
1469
|
# Rebuild lists
|
|
1414
1470
|
self._rebuild_lists(showlist, altnames, library)
|
|
1415
1471
|
|
|
1416
1472
|
self.s_show_selected(None)
|
|
1417
|
-
self._update_queue_counter(len(self.worker.engine.get_queue()))
|
|
1418
1473
|
|
|
1419
1474
|
self.status('Ready.')
|
|
1420
1475
|
|
|
@@ -1580,12 +1635,15 @@ class AddDialog(QDialog):
|
|
|
1580
1635
|
worker = None
|
|
1581
1636
|
selected_show = None
|
|
1582
1637
|
|
|
1583
|
-
def __init__(self, parent, worker, current_status):
|
|
1638
|
+
def __init__(self, parent, worker, current_status, default=None):
|
|
1584
1639
|
QMainWindow.__init__(self, parent)
|
|
1585
1640
|
self.setMinimumSize(700, 500)
|
|
1586
1641
|
self.setWindowTitle('Search/Add from Remote')
|
|
1587
1642
|
self.worker = worker
|
|
1588
1643
|
self.current_status = current_status
|
|
1644
|
+
self.default = default
|
|
1645
|
+
if default:
|
|
1646
|
+
self.setWindowTitle('Search/Add from Remote for new show: %s' % default)
|
|
1589
1647
|
|
|
1590
1648
|
layout = QGridLayout()
|
|
1591
1649
|
|
|
@@ -1595,6 +1653,8 @@ class AddDialog(QDialog):
|
|
|
1595
1653
|
self.search_txt = QLineEdit(self)
|
|
1596
1654
|
self.search_txt.returnPressed.connect(self.s_search)
|
|
1597
1655
|
self.search_txt.setFocus()
|
|
1656
|
+
if default:
|
|
1657
|
+
self.search_txt.setText(default)
|
|
1598
1658
|
self.search_btn = QPushButton('Search')
|
|
1599
1659
|
self.search_btn.clicked.connect(self.s_search)
|
|
1600
1660
|
top_layout.addWidget(search_lbl)
|
|
@@ -1694,7 +1754,8 @@ class AddDialog(QDialog):
|
|
|
1694
1754
|
|
|
1695
1755
|
def r_added(self, result):
|
|
1696
1756
|
if result['success']:
|
|
1697
|
-
|
|
1757
|
+
if self.default:
|
|
1758
|
+
self.accept()
|
|
1698
1759
|
|
|
1699
1760
|
|
|
1700
1761
|
class SettingsDialog(QDialog):
|
|
@@ -1741,8 +1802,6 @@ class SettingsDialog(QDialog):
|
|
|
1741
1802
|
self.tracker_type_local.toggled.connect(self.tracker_type_change)
|
|
1742
1803
|
self.tracker_type_plex = QRadioButton('Plex media server')
|
|
1743
1804
|
self.tracker_type_plex.toggled.connect(self.tracker_type_change)
|
|
1744
|
-
self.plex_host = QLineEdit()
|
|
1745
|
-
self.plex_port = QLineEdit()
|
|
1746
1805
|
self.tracker_interval = QSpinBox()
|
|
1747
1806
|
self.tracker_interval.setRange(5, 1000)
|
|
1748
1807
|
self.tracker_interval.setMaximumWidth(60)
|
|
@@ -1752,20 +1811,36 @@ class SettingsDialog(QDialog):
|
|
|
1752
1811
|
self.tracker_update_wait.setMaximumWidth(60)
|
|
1753
1812
|
self.tracker_update_close = QCheckBox()
|
|
1754
1813
|
self.tracker_update_prompt = QCheckBox()
|
|
1814
|
+
self.tracker_not_found_prompt = QCheckBox()
|
|
1755
1815
|
|
|
1756
1816
|
g_media_layout.addRow('Enable tracker', self.tracker_enabled)
|
|
1757
1817
|
g_media_layout.addRow(self.tracker_type_local)
|
|
1758
1818
|
g_media_layout.addRow(self.tracker_type_plex)
|
|
1759
1819
|
g_media_layout.addRow('Tracker interval (seconds)', self.tracker_interval)
|
|
1760
1820
|
g_media_layout.addRow('Process name (regex)', self.tracker_process)
|
|
1761
|
-
g_media_layout.addRow('Plex host', self.plex_host)
|
|
1762
|
-
g_media_layout.addRow('Plex port', self.plex_port)
|
|
1763
1821
|
g_media_layout.addRow('Wait before updating (seconds)', self.tracker_update_wait)
|
|
1764
1822
|
g_media_layout.addRow('Wait until the player is closed', self.tracker_update_close)
|
|
1765
1823
|
g_media_layout.addRow('Ask before updating', self.tracker_update_prompt)
|
|
1824
|
+
g_media_layout.addRow('Ask to add new shows', self.tracker_not_found_prompt)
|
|
1766
1825
|
|
|
1767
1826
|
g_media.setLayout(g_media_layout)
|
|
1768
1827
|
|
|
1828
|
+
# Group: Plex settings
|
|
1829
|
+
g_plex = QGroupBox('Plex Media Server')
|
|
1830
|
+
g_plex.setFlat(True)
|
|
1831
|
+
self.plex_host = QLineEdit()
|
|
1832
|
+
self.plex_port = QLineEdit()
|
|
1833
|
+
self.plex_obey_wait = QCheckBox()
|
|
1834
|
+
|
|
1835
|
+
g_plex_layout = QGridLayout()
|
|
1836
|
+
g_plex_layout.addWidget(QLabel('Host and Port'), 0, 0, 1, 1)
|
|
1837
|
+
g_plex_layout.addWidget(self.plex_host, 0, 1, 1, 1)
|
|
1838
|
+
g_plex_layout.addWidget(self.plex_port, 0, 2, 1, 2)
|
|
1839
|
+
g_plex_layout.addWidget(QLabel('Use "wait before updating" time'), 1, 0, 1, 1)
|
|
1840
|
+
g_plex_layout.addWidget(self.plex_obey_wait, 1, 2, 1, 1)
|
|
1841
|
+
|
|
1842
|
+
g_plex.setLayout(g_plex_layout)
|
|
1843
|
+
|
|
1769
1844
|
# Group: Play Next
|
|
1770
1845
|
g_playnext = QGroupBox('Play Next')
|
|
1771
1846
|
g_playnext.setFlat(True)
|
|
@@ -1791,6 +1866,7 @@ class SettingsDialog(QDialog):
|
|
|
1791
1866
|
|
|
1792
1867
|
# Media form
|
|
1793
1868
|
page_media_layout.addWidget(g_media)
|
|
1869
|
+
page_media_layout.addWidget(g_plex)
|
|
1794
1870
|
page_media_layout.addWidget(g_playnext)
|
|
1795
1871
|
page_media.setLayout(page_media_layout)
|
|
1796
1872
|
|
|
@@ -1821,10 +1897,10 @@ class SettingsDialog(QDialog):
|
|
|
1821
1897
|
g_autosend.setFlat(True)
|
|
1822
1898
|
self.autosend_off = QRadioButton('Disabled')
|
|
1823
1899
|
self.autosend_always = QRadioButton('Immediately after every change')
|
|
1824
|
-
self.
|
|
1825
|
-
self.
|
|
1826
|
-
self.
|
|
1827
|
-
self.
|
|
1900
|
+
self.autosend_minutes = QRadioButton('After n minutes')
|
|
1901
|
+
self.autosend_minutes.toggled.connect(self.s_autosend_minutes)
|
|
1902
|
+
self.autosend_minutes_n = QSpinBox()
|
|
1903
|
+
self.autosend_minutes_n.setRange(1, 1000)
|
|
1828
1904
|
self.autosend_size = QRadioButton('After the queue reaches n items')
|
|
1829
1905
|
self.autosend_size.toggled.connect(self.s_autosend_size)
|
|
1830
1906
|
self.autosend_size_n = QSpinBox()
|
|
@@ -1834,8 +1910,8 @@ class SettingsDialog(QDialog):
|
|
|
1834
1910
|
g_autosend_layout.setColumnStretch(0, 1)
|
|
1835
1911
|
g_autosend_layout.addWidget(self.autosend_off, 0, 0, 1, 1)
|
|
1836
1912
|
g_autosend_layout.addWidget(self.autosend_always, 1, 0, 1, 1)
|
|
1837
|
-
g_autosend_layout.addWidget(self.
|
|
1838
|
-
g_autosend_layout.addWidget(self.
|
|
1913
|
+
g_autosend_layout.addWidget(self.autosend_minutes, 2, 0, 1, 1)
|
|
1914
|
+
g_autosend_layout.addWidget(self.autosend_minutes_n, 2, 1, 1, 1)
|
|
1839
1915
|
g_autosend_layout.addWidget(self.autosend_size, 3, 0, 1, 1)
|
|
1840
1916
|
g_autosend_layout.addWidget(self.autosend_size_n, 3, 1, 1, 1)
|
|
1841
1917
|
g_autosend_layout.addWidget(self.autosend_at_exit, 4, 0, 1, 1)
|
|
@@ -2024,17 +2100,20 @@ class SettingsDialog(QDialog):
|
|
|
2024
2100
|
self.tracker_update_wait.setValue(engine.get_config('tracker_update_wait_s'))
|
|
2025
2101
|
self.tracker_update_close.setChecked(engine.get_config('tracker_update_close'))
|
|
2026
2102
|
self.tracker_update_prompt.setChecked(engine.get_config('tracker_update_prompt'))
|
|
2103
|
+
self.tracker_not_found_prompt.setChecked(engine.get_config('tracker_not_found_prompt'))
|
|
2027
2104
|
|
|
2028
2105
|
self.player.setText(engine.get_config('player'))
|
|
2029
2106
|
self.searchdir.setText(engine.get_config('searchdir'))
|
|
2030
2107
|
self.library_autoscan.setChecked(engine.get_config('library_autoscan'))
|
|
2031
2108
|
self.plex_host.setText(engine.get_config('plex_host'))
|
|
2032
2109
|
self.plex_port.setText(engine.get_config('plex_port'))
|
|
2110
|
+
self.plex_obey_wait.setChecked(engine.get_config('plex_obey_update_wait_s'))
|
|
2033
2111
|
|
|
2034
2112
|
if tracker_type == 'local':
|
|
2035
2113
|
self.tracker_type_local.setChecked(True)
|
|
2036
2114
|
self.plex_host.setEnabled(False)
|
|
2037
2115
|
self.plex_port.setEnabled(False)
|
|
2116
|
+
self.plex_obey_wait.setEnabled(False)
|
|
2038
2117
|
elif tracker_type == 'plex':
|
|
2039
2118
|
self.tracker_type_plex.setChecked(True)
|
|
2040
2119
|
self.tracker_process.setEnabled(False)
|
|
@@ -2050,14 +2129,14 @@ class SettingsDialog(QDialog):
|
|
|
2050
2129
|
|
|
2051
2130
|
if autosend == 'always':
|
|
2052
2131
|
self.autosend_always.setChecked(True)
|
|
2053
|
-
elif autosend
|
|
2054
|
-
self.
|
|
2132
|
+
elif autosend in ('minutes', 'hours'):
|
|
2133
|
+
self.autosend_minutes.setChecked(True)
|
|
2055
2134
|
elif autosend == 'size':
|
|
2056
2135
|
self.autosend_size.setChecked(True)
|
|
2057
2136
|
else:
|
|
2058
2137
|
self.autosend_off.setChecked(True)
|
|
2059
2138
|
|
|
2060
|
-
self.
|
|
2139
|
+
self.autosend_minutes_n.setValue(engine.get_config('autosend_minutes'))
|
|
2061
2140
|
self.autosend_size_n.setValue(engine.get_config('autosend_size'))
|
|
2062
2141
|
|
|
2063
2142
|
self.autosend_at_exit.setChecked(engine.get_config('autosend_at_exit'))
|
|
@@ -2080,7 +2159,7 @@ class SettingsDialog(QDialog):
|
|
|
2080
2159
|
self.ep_bar_text.setChecked(self.config['episodebar_text'])
|
|
2081
2160
|
|
|
2082
2161
|
self.autoretrieve_days_n.setEnabled(self.autoretrieve_days.isChecked())
|
|
2083
|
-
self.
|
|
2162
|
+
self.autosend_minutes_n.setEnabled(self.autosend_minutes.isChecked())
|
|
2084
2163
|
self.autosend_size_n.setEnabled(self.autosend_size.isChecked())
|
|
2085
2164
|
self.close_to_tray.setEnabled(self.tray_icon.isChecked())
|
|
2086
2165
|
self.start_in_tray.setEnabled(self.tray_icon.isChecked())
|
|
@@ -2097,12 +2176,14 @@ class SettingsDialog(QDialog):
|
|
|
2097
2176
|
engine.set_config('tracker_update_wait_s', self.tracker_update_wait.value())
|
|
2098
2177
|
engine.set_config('tracker_update_close', self.tracker_update_close.isChecked())
|
|
2099
2178
|
engine.set_config('tracker_update_prompt', self.tracker_update_prompt.isChecked())
|
|
2179
|
+
engine.set_config('tracker_not_found_prompt', self.tracker_not_found_prompt.isChecked())
|
|
2100
2180
|
|
|
2101
2181
|
engine.set_config('player', self.player.text())
|
|
2102
2182
|
engine.set_config('searchdir', self.searchdir.text())
|
|
2103
2183
|
engine.set_config('library_autoscan', self.library_autoscan.isChecked())
|
|
2104
2184
|
engine.set_config('plex_host', self.plex_host.text())
|
|
2105
2185
|
engine.set_config('plex_port', self.plex_port.text())
|
|
2186
|
+
engine.set_config('plex_obey_update_wait_s', self.plex_obey_wait.isChecked())
|
|
2106
2187
|
|
|
2107
2188
|
if self.tracker_type_local.isChecked():
|
|
2108
2189
|
engine.set_config('tracker_type', 'local')
|
|
@@ -2120,14 +2201,14 @@ class SettingsDialog(QDialog):
|
|
|
2120
2201
|
|
|
2121
2202
|
if self.autosend_always.isChecked():
|
|
2122
2203
|
engine.set_config('autosend', 'always')
|
|
2123
|
-
elif self.
|
|
2124
|
-
engine.set_config('autosend', '
|
|
2204
|
+
elif self.autosend_minutes.isChecked():
|
|
2205
|
+
engine.set_config('autosend', 'minutes')
|
|
2125
2206
|
elif self.autosend_size.isChecked():
|
|
2126
2207
|
engine.set_config('autosend', 'size')
|
|
2127
2208
|
else:
|
|
2128
2209
|
engine.set_config('autosend', 'off')
|
|
2129
2210
|
|
|
2130
|
-
engine.set_config('
|
|
2211
|
+
engine.set_config('autosend_minutes', self.autosend_minutes_n.value())
|
|
2131
2212
|
engine.set_config('autosend_size', self.autosend_size_n.value())
|
|
2132
2213
|
|
|
2133
2214
|
engine.set_config('autosend_at_exit', self.autosend_at_exit.isChecked())
|
|
@@ -2171,15 +2252,18 @@ class SettingsDialog(QDialog):
|
|
|
2171
2252
|
self.tracker_process.setEnabled(True)
|
|
2172
2253
|
self.plex_host.setEnabled(False)
|
|
2173
2254
|
self.plex_port.setEnabled(False)
|
|
2255
|
+
self.plex_obey_wait.setEnabled(False)
|
|
2174
2256
|
elif self.tracker_type_plex.isChecked():
|
|
2175
2257
|
self.plex_host.setEnabled(True)
|
|
2176
2258
|
self.plex_port.setEnabled(True)
|
|
2259
|
+
self.plex_obey_wait.setEnabled(True)
|
|
2177
2260
|
self.tracker_process.setEnabled(False)
|
|
2178
2261
|
else:
|
|
2179
2262
|
self.tracker_type_local.setEnabled(False)
|
|
2180
2263
|
self.tracker_type_plex.setEnabled(False)
|
|
2181
2264
|
self.plex_host.setEnabled(False)
|
|
2182
2265
|
self.plex_port.setEnabled(False)
|
|
2266
|
+
self.plex_obey_wait.setEnabled(False)
|
|
2183
2267
|
self.tracker_process.setEnabled(False)
|
|
2184
2268
|
self.tracker_interval.setEnabled(False)
|
|
2185
2269
|
self.tracker_update_wait.setEnabled(False)
|
|
@@ -2187,8 +2271,8 @@ class SettingsDialog(QDialog):
|
|
|
2187
2271
|
def s_autoretrieve_days(self, checked):
|
|
2188
2272
|
self.autoretrieve_days_n.setEnabled(checked)
|
|
2189
2273
|
|
|
2190
|
-
def
|
|
2191
|
-
self.
|
|
2274
|
+
def s_autosend_minutes(self, checked):
|
|
2275
|
+
self.autosend_minutes_n.setEnabled(checked)
|
|
2192
2276
|
|
|
2193
2277
|
def s_autosend_size(self, checked):
|
|
2194
2278
|
self.autosend_size_n.setEnabled(checked)
|
|
@@ -2427,7 +2511,7 @@ class AccountDialog(QDialog):
|
|
|
2427
2511
|
for k, account in accounts:
|
|
2428
2512
|
self.table.setRowHeight(i, QtGui.QFontMetrics(self.table.font()).height() + 2)
|
|
2429
2513
|
self.table.setItem(i, 0, AccountItem(k, account['username']))
|
|
2430
|
-
self.table.setItem(i, 1, AccountItem(k, account['api'], self.icons
|
|
2514
|
+
self.table.setItem(i, 1, AccountItem(k, account['api'], self.icons.get(account['api'])))
|
|
2431
2515
|
|
|
2432
2516
|
i += 1
|
|
2433
2517
|
|
|
@@ -2783,14 +2867,18 @@ class Image_Worker(QtCore.QThread):
|
|
|
2783
2867
|
|
|
2784
2868
|
req = urllib.request.Request(self.remote)
|
|
2785
2869
|
req.add_header("User-agent", "TrackmaImage/{}".format(utils.VERSION))
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2870
|
+
try:
|
|
2871
|
+
img_file = BytesIO(urllib.request.urlopen(req).read())
|
|
2872
|
+
if self.size:
|
|
2873
|
+
im = Image.open(img_file)
|
|
2874
|
+
im.thumbnail((self.size[0], self.size[1]), Image.ANTIALIAS)
|
|
2875
|
+
im.save(self.local)
|
|
2876
|
+
else:
|
|
2877
|
+
with open(self.local, 'wb') as f:
|
|
2878
|
+
f.write(img_file.read())
|
|
2879
|
+
except urllib.error.URLError as e:
|
|
2880
|
+
print("Warning: Error getting image ({})".format(e))
|
|
2881
|
+
return
|
|
2794
2882
|
|
|
2795
2883
|
if self.cancelled:
|
|
2796
2884
|
return
|
|
@@ -2813,7 +2901,7 @@ class Engine_Worker(QtCore.QThread):
|
|
|
2813
2901
|
finished = QtCore.pyqtSignal(dict)
|
|
2814
2902
|
|
|
2815
2903
|
# Message handler signals
|
|
2816
|
-
changed_status = QtCore.pyqtSignal(str)
|
|
2904
|
+
changed_status = QtCore.pyqtSignal(str, int, str)
|
|
2817
2905
|
raised_error = QtCore.pyqtSignal(str)
|
|
2818
2906
|
raised_fatal = QtCore.pyqtSignal(str)
|
|
2819
2907
|
|
|
@@ -2821,8 +2909,10 @@ class Engine_Worker(QtCore.QThread):
|
|
|
2821
2909
|
changed_show = QtCore.pyqtSignal(dict)
|
|
2822
2910
|
changed_list = QtCore.pyqtSignal(dict, object)
|
|
2823
2911
|
changed_queue = QtCore.pyqtSignal(int)
|
|
2912
|
+
tracker_state = QtCore.pyqtSignal(int, int)
|
|
2824
2913
|
playing_show = QtCore.pyqtSignal(dict, bool, int)
|
|
2825
2914
|
prompt_for_update = QtCore.pyqtSignal(dict, int)
|
|
2915
|
+
prompt_for_add = QtCore.pyqtSignal(str, int)
|
|
2826
2916
|
|
|
2827
2917
|
def __init__(self, account):
|
|
2828
2918
|
super(Engine_Worker, self).__init__()
|
|
@@ -2837,6 +2927,8 @@ class Engine_Worker(QtCore.QThread):
|
|
|
2837
2927
|
self.engine.connect_signal('show_synced', self._changed_show)
|
|
2838
2928
|
self.engine.connect_signal('queue_changed', self._changed_queue)
|
|
2839
2929
|
self.engine.connect_signal('prompt_for_update', self._prompt_for_update)
|
|
2930
|
+
self.engine.connect_signal('prompt_for_add', self._prompt_for_add)
|
|
2931
|
+
self.engine.connect_signal('tracker_state', self._tracker_state)
|
|
2840
2932
|
|
|
2841
2933
|
self.function_list = {
|
|
2842
2934
|
'start': self._start,
|
|
@@ -2859,7 +2951,7 @@ class Engine_Worker(QtCore.QThread):
|
|
|
2859
2951
|
}
|
|
2860
2952
|
|
|
2861
2953
|
def _messagehandler(self, classname, msgtype, msg):
|
|
2862
|
-
self.changed_status.emit(
|
|
2954
|
+
self.changed_status.emit(classname, msgtype, msg)
|
|
2863
2955
|
|
|
2864
2956
|
def _error(self, msg):
|
|
2865
2957
|
self.raised_error.emit(str(msg))
|
|
@@ -2874,7 +2966,10 @@ class Engine_Worker(QtCore.QThread):
|
|
|
2874
2966
|
self.changed_list.emit(show, old_status)
|
|
2875
2967
|
|
|
2876
2968
|
def _changed_queue(self, queue):
|
|
2877
|
-
self.changed_queue.emit(queue)
|
|
2969
|
+
self.changed_queue.emit(len(queue))
|
|
2970
|
+
|
|
2971
|
+
def _tracker_state(self, state, timer):
|
|
2972
|
+
self.tracker_state.emit(state, timer)
|
|
2878
2973
|
|
|
2879
2974
|
def _playing_show(self, show, is_playing, episode):
|
|
2880
2975
|
self.playing_show.emit(show, is_playing, episode)
|
|
@@ -2882,6 +2977,9 @@ class Engine_Worker(QtCore.QThread):
|
|
|
2882
2977
|
def _prompt_for_update(self, show, episode):
|
|
2883
2978
|
self.prompt_for_update.emit(show, episode)
|
|
2884
2979
|
|
|
2980
|
+
def _prompt_for_add(self, show_title, episode):
|
|
2981
|
+
self.prompt_for_add.emit(show_title, episode)
|
|
2982
|
+
|
|
2885
2983
|
# Callable functions
|
|
2886
2984
|
def _start(self):
|
|
2887
2985
|
try:
|
|
@@ -3081,9 +3179,23 @@ def getColor(colorString):
|
|
|
3081
3179
|
|
|
3082
3180
|
|
|
3083
3181
|
def main():
|
|
3182
|
+
debug = False
|
|
3183
|
+
|
|
3184
|
+
print("Trackma-qt v{}".format(utils.VERSION))
|
|
3185
|
+
|
|
3186
|
+
if '-h' in sys.argv:
|
|
3187
|
+
print("Usage: trackma-qt [options]")
|
|
3188
|
+
print()
|
|
3189
|
+
print('Options:')
|
|
3190
|
+
print(' -d Shows debugging information')
|
|
3191
|
+
print(' -h Shows this help')
|
|
3192
|
+
return
|
|
3193
|
+
if '-d' in sys.argv:
|
|
3194
|
+
debug = True
|
|
3195
|
+
|
|
3084
3196
|
app = QApplication(sys.argv)
|
|
3085
3197
|
try:
|
|
3086
|
-
mainwindow = Trackma()
|
|
3198
|
+
mainwindow = Trackma(debug)
|
|
3087
3199
|
sys.exit(app.exec_())
|
|
3088
3200
|
except utils.TrackmaFatal as e:
|
|
3089
3201
|
QMessageBox.critical(None, 'Fatal Error', "{0}".format(e), QMessageBox.Ok)
|
trackma/utils.py
CHANGED
|
@@ -21,7 +21,7 @@ import json
|
|
|
21
21
|
import difflib
|
|
22
22
|
import pickle
|
|
23
23
|
|
|
24
|
-
VERSION = '0.
|
|
24
|
+
VERSION = '0.7.1'
|
|
25
25
|
|
|
26
26
|
datadir = os.path.dirname(__file__)
|
|
27
27
|
LOGIN_PASSWD = 1
|
|
@@ -32,15 +32,20 @@ STATUS_FINISHED = 2
|
|
|
32
32
|
STATUS_NOTYET = 3
|
|
33
33
|
STATUS_CANCELLED = 4
|
|
34
34
|
|
|
35
|
+
TRACKER_NOVIDEO = 0
|
|
36
|
+
TRACKER_PLAYING = 1
|
|
37
|
+
TRACKER_UNRECOGNIZED = 2
|
|
38
|
+
TRACKER_NOT_FOUND = 3
|
|
39
|
+
TRACKER_IGNORED = 4
|
|
40
|
+
|
|
35
41
|
# Put the available APIs here
|
|
36
42
|
available_libs = {
|
|
37
43
|
'anilist': ('Anilist', datadir + '/data/anilist.jpg', LOGIN_OAUTH,
|
|
38
44
|
"http://omaera.org/trackma/anilist.html",
|
|
39
45
|
"https://anilist.co/api/auth/authorize?grant_type=authorization_pin&client_id=z411-gdjc3&response_type=pin"
|
|
40
46
|
),
|
|
41
|
-
'
|
|
47
|
+
'kitsu': ('Kitsu', datadir + '/data/kitsu.png', LOGIN_PASSWD),
|
|
42
48
|
'mal': ('MyAnimeList', datadir + '/data/mal.jpg', LOGIN_PASSWD),
|
|
43
|
-
'melative': ('Melative', datadir + '/data/melative.jpg', LOGIN_PASSWD),
|
|
44
49
|
'shikimori':('Shikimori', datadir + '/data/shikimori.jpg', LOGIN_PASSWD),
|
|
45
50
|
'vndb': ('VNDB', datadir + '/data/vndb.jpg', LOGIN_PASSWD),
|
|
46
51
|
}
|
|
@@ -265,12 +270,13 @@ config_defaults = {
|
|
|
265
270
|
'tracker_update_wait_s': 120,
|
|
266
271
|
'tracker_update_close': False,
|
|
267
272
|
'tracker_update_prompt': False,
|
|
273
|
+
'tracker_not_found_prompt': False,
|
|
268
274
|
'tracker_interval': 10,
|
|
269
275
|
'tracker_process': 'mplayer|mplayer2|mpv',
|
|
270
276
|
'autoretrieve': 'days',
|
|
271
277
|
'autoretrieve_days': 3,
|
|
272
|
-
'autosend': '
|
|
273
|
-
'
|
|
278
|
+
'autosend': 'minutes',
|
|
279
|
+
'autosend_minutes': 60,
|
|
274
280
|
'autosend_size': 5,
|
|
275
281
|
'autosend_at_exit': True,
|
|
276
282
|
'library_autoscan': True,
|
|
@@ -281,6 +287,7 @@ config_defaults = {
|
|
|
281
287
|
'tracker_type': "local",
|
|
282
288
|
'plex_host': "localhost",
|
|
283
289
|
'plex_port': "32400",
|
|
290
|
+
'plex_obey_update_wait_s': False,
|
|
284
291
|
}
|
|
285
292
|
userconfig_defaults = {
|
|
286
293
|
'mediatype': '',
|
|
@@ -295,17 +302,17 @@ curses_defaults = {
|
|
|
295
302
|
'next_filter': 'right',
|
|
296
303
|
'sort': 'f3',
|
|
297
304
|
'sort_order': 'r',
|
|
298
|
-
'update': '
|
|
299
|
-
'play': '
|
|
305
|
+
'update': 'u',
|
|
306
|
+
'play': 'p',
|
|
300
307
|
'status': 'f6',
|
|
301
|
-
'score': '
|
|
308
|
+
'score': 'k',
|
|
302
309
|
'send': 's',
|
|
303
310
|
'retrieve': 'R',
|
|
304
311
|
'addsearch': 'a',
|
|
305
312
|
'reload': 'c',
|
|
306
313
|
'switch_account': 'f9',
|
|
307
314
|
'delete': 'd',
|
|
308
|
-
'quit': '
|
|
315
|
+
'quit': 'q',
|
|
309
316
|
'altname': 'A',
|
|
310
317
|
'search': '/',
|
|
311
318
|
'neweps': 'N',
|
|
Binary file
|
trackma/data/hb.jpg
DELETED
|
Binary file
|
trackma/data/melative.jpg
DELETED
|
Binary file
|
|
Binary file
|