cc fix
parent
545e5d48e0
commit
0d5263aaff
|
@ -18,7 +18,6 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
# import time
|
||||
import thread
|
||||
import os
|
||||
import urllib2
|
||||
|
@ -26,7 +25,6 @@ import hashlib
|
|||
import re
|
||||
from StringIO import StringIO
|
||||
import gzip
|
||||
import imp
|
||||
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
[B]Version 2.3.1[/B]
|
||||
[B]Version 2.3.2[/B]
|
||||
[+] Control Center: Исправлена работа без серчеров
|
||||
|
||||
[B]Version 2.3.1[/B]
|
||||
[+] Загрузка: Исправлена ошибка удаления базы данных
|
||||
[+] Списки Медиа: Исправлен IMDB TOP 250
|
||||
[+] Проигрыватель: Добавлена поддержка Android ARM
|
||||
[+] Проигрыватель: [B]Добавлена полная поддержка Android (arm)[/B]
|
||||
[+] Поиск: Все серчеры вынесены из плагина
|
||||
|
||||
[B]Version 2.3.0[/B]
|
||||
[+] Поиск: Поиск существенно ускорился, стал многопоточным (пока 3 потока одновременно)
|
||||
|
|
312
controlcenter.py
312
controlcenter.py
|
@ -23,9 +23,8 @@ import sys
|
|||
import xbmcaddon
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
from functions import getParameters, HistoryDB
|
||||
from functions import getParameters, HistoryDB, Searchers
|
||||
from resources.pyxbmct.addonwindow import *
|
||||
from functions import Searchers
|
||||
|
||||
__settings__ = xbmcaddon.Addon(id='plugin.video.torrenter')
|
||||
__language__ = __settings__.getLocalizedString
|
||||
|
@ -40,151 +39,6 @@ if len(sys.argv) > 1:
|
|||
else:
|
||||
params = {}
|
||||
|
||||
|
||||
class MyAddon(AddonDialogWindow):
|
||||
def __init__(self, title=''):
|
||||
super(MyAddon, self).__init__(title)
|
||||
self.setGeometry(700, 450, 9, 4)
|
||||
self.set_info_controls()
|
||||
self.set_active_controls()
|
||||
self.set_navigation()
|
||||
# Connect a key action (Backspace) to close the window.
|
||||
self.connect(ACTION_NAV_BACK, self.close)
|
||||
|
||||
def set_info_controls(self):
|
||||
# Demo for PyXBMCt UI controls.
|
||||
no_int_label = Label('Information output', alignment=ALIGN_CENTER)
|
||||
self.placeControl(no_int_label, 0, 0, 1, 2)
|
||||
#
|
||||
label_label = Label('Label')
|
||||
self.placeControl(label_label, 1, 0)
|
||||
# Label
|
||||
self.label = Label('Simple label')
|
||||
self.placeControl(self.label, 1, 1)
|
||||
#
|
||||
fadelabel_label = Label('FadeLabel')
|
||||
self.placeControl(fadelabel_label, 2, 0)
|
||||
# FadeLabel
|
||||
self.fade_label = FadeLabel()
|
||||
self.placeControl(self.fade_label, 2, 1)
|
||||
self.fade_label.addLabel('Very long string can be here.')
|
||||
#
|
||||
textbox_label = Label('TextBox')
|
||||
self.placeControl(textbox_label, 3, 0)
|
||||
# TextBox
|
||||
self.textbox = TextBox()
|
||||
self.placeControl(self.textbox, 3, 1, 2, 1)
|
||||
self.textbox.setText('Text box.\nIt can contain several lines.')
|
||||
#
|
||||
image_label = Label('Image')
|
||||
self.placeControl(image_label, 5, 0)
|
||||
|
||||
def set_active_controls(self):
|
||||
int_label = Label('Interactive Controls', alignment=ALIGN_CENTER)
|
||||
self.placeControl(int_label, 0, 2, 1, 2)
|
||||
#
|
||||
radiobutton_label = Label('RadioButton')
|
||||
self.placeControl(radiobutton_label, 1, 2)
|
||||
# RadioButton
|
||||
self.radiobutton = RadioButton('Off')
|
||||
self.placeControl(self.radiobutton, 1, 3)
|
||||
self.connect(self.radiobutton, self.radio_update)
|
||||
#
|
||||
edit_label = Label('Edit')
|
||||
self.placeControl(edit_label, 2, 2)
|
||||
# Edit
|
||||
self.edit = Edit('Edit')
|
||||
self.placeControl(self.edit, 2, 3)
|
||||
# Additional properties must be changed after (!) displaying a control.
|
||||
self.edit.setText('Enter text here')
|
||||
#
|
||||
list_label = Label('List')
|
||||
self.placeControl(list_label, 3, 2)
|
||||
#
|
||||
self.list_item_label = Label('', textColor='0xFF808080')
|
||||
self.placeControl(self.list_item_label, 4, 2)
|
||||
# List
|
||||
self.list = List()
|
||||
self.placeControl(self.list, 3, 3, 3, 1)
|
||||
# Add items to the list
|
||||
items = ['Item %s' % i for i in range(1, 8)]
|
||||
self.list.addItems(items)
|
||||
# Connect the list to a function to display which list item is selected.
|
||||
self.connect(self.list, lambda: xbmc.executebuiltin('Notification(Note!,%s selected.)' %
|
||||
self.list.getListItem(
|
||||
self.list.getSelectedPosition()).getLabel()))
|
||||
# Connect key and mouse events for list navigation feedback.
|
||||
self.connectEventList(
|
||||
[ACTION_MOVE_DOWN, ACTION_MOVE_UP, ACTION_MOUSE_WHEEL_DOWN, ACTION_MOUSE_WHEEL_UP, ACTION_MOUSE_MOVE],
|
||||
self.list_update)
|
||||
# Slider value label
|
||||
SLIDER_INIT_VALUE = 25.0
|
||||
self.slider_value = Label(str(SLIDER_INIT_VALUE), alignment=ALIGN_CENTER)
|
||||
self.placeControl(self.slider_value, 6, 3)
|
||||
#
|
||||
slider_caption = Label('Slider')
|
||||
self.placeControl(slider_caption, 7, 2)
|
||||
# Slider
|
||||
self.slider = Slider()
|
||||
self.placeControl(self.slider, 7, 3, pad_y=10)
|
||||
self.slider.setPercent(SLIDER_INIT_VALUE)
|
||||
# Connect key and mouse events for slider update feedback.
|
||||
self.connectEventList([ACTION_MOVE_LEFT, ACTION_MOVE_RIGHT, ACTION_MOUSE_DRAG], self.slider_update)
|
||||
#
|
||||
button_label = Label('Button')
|
||||
self.placeControl(button_label, 8, 2)
|
||||
# Button
|
||||
self.button = Button('Close')
|
||||
self.placeControl(self.button, 8, 3)
|
||||
# Connect control to close the window.
|
||||
self.connect(self.button, self.close)
|
||||
|
||||
def set_navigation(self):
|
||||
# Set navigation between controls
|
||||
self.button.controlUp(self.slider)
|
||||
self.button.controlDown(self.radiobutton)
|
||||
self.radiobutton.controlUp(self.button)
|
||||
self.radiobutton.controlDown(self.edit)
|
||||
self.edit.controlUp(self.radiobutton)
|
||||
self.edit.controlDown(self.list)
|
||||
self.list.controlUp(self.edit)
|
||||
self.list.controlDown(self.slider)
|
||||
self.slider.controlUp(self.list)
|
||||
self.slider.controlDown(self.button)
|
||||
# Set initial focus
|
||||
self.setFocus(self.radiobutton)
|
||||
|
||||
def slider_update(self):
|
||||
# Update slider value label when the slider nib moves
|
||||
try:
|
||||
if self.getFocus() == self.slider:
|
||||
self.slider_value.setLabel('%.1f' % self.slider.getPercent())
|
||||
except (RuntimeError, SystemError):
|
||||
pass
|
||||
|
||||
def radio_update(self):
|
||||
# Update radiobutton caption on toggle
|
||||
if self.radiobutton.isSelected():
|
||||
self.radiobutton.setLabel('On')
|
||||
else:
|
||||
self.radiobutton.setLabel('Off')
|
||||
|
||||
def list_update(self):
|
||||
# Update list_item label when navigating through the list.
|
||||
try:
|
||||
if self.getFocus() == self.list:
|
||||
self.list_item_label.setLabel(self.list.getListItem(self.list.getSelectedPosition()).getLabel())
|
||||
else:
|
||||
self.list_item_label.setLabel('')
|
||||
except (RuntimeError, SystemError):
|
||||
pass
|
||||
|
||||
def setAnimation(self, control):
|
||||
# Set fade animation for all add-on window controls
|
||||
control.setAnimations([('WindowOpen', 'effect=fade start=0 end=100 time=500',),
|
||||
('WindowClose', 'effect=fade start=100 end=0 time=500',)])
|
||||
|
||||
|
||||
class ControlCenter(AddonDialogWindow):
|
||||
def __init__(self, title, addtime=None):
|
||||
super(ControlCenter, self).__init__(title)
|
||||
|
@ -192,25 +46,29 @@ class ControlCenter(AddonDialogWindow):
|
|||
self.dic = Searchers().dic()
|
||||
self.db = None
|
||||
self.addtime = None
|
||||
self.keys = self.dic.keys()
|
||||
if addtime:
|
||||
self.addtime = addtime
|
||||
self.db = HistoryDB()
|
||||
providers = self.db.get_providers(addtime)
|
||||
if not providers:
|
||||
self.db.set_providers(addtime, self.dic)
|
||||
else:
|
||||
for searcher in self.keys:
|
||||
self.dic[searcher] = False
|
||||
for searcher in providers:
|
||||
try:
|
||||
if searcher in self.keys:
|
||||
self.dic[searcher] = True
|
||||
except:
|
||||
pass
|
||||
self.has_searchers=len(self.dic)>0
|
||||
if self.has_searchers:
|
||||
if addtime:
|
||||
self.addtime = addtime
|
||||
self.db = HistoryDB()
|
||||
providers = self.db.get_providers(addtime)
|
||||
if not providers:
|
||||
self.db.set_providers(addtime, self.dic)
|
||||
else:
|
||||
for searcher in self.keys:
|
||||
self.dic[searcher] = False
|
||||
for searcher in providers:
|
||||
try:
|
||||
if searcher in self.keys:
|
||||
self.dic[searcher] = True
|
||||
except:
|
||||
pass
|
||||
|
||||
self.keys = self.dic.keys()
|
||||
self.placed, self.button_columns, self.last_column_row = self.place()
|
||||
else:
|
||||
self.button_columns=0
|
||||
|
||||
self.keys = self.dic.keys()
|
||||
self.placed, self.button_columns, self.last_column_row = self.place()
|
||||
|
||||
self.setGeometry(850, 200 + 50 * self.button_columns, 4 + self.button_columns, 3)
|
||||
self.set_info_controls()
|
||||
|
@ -249,17 +107,18 @@ class ControlCenter(AddonDialogWindow):
|
|||
|
||||
def set_active_controls(self):
|
||||
# RadioButton
|
||||
self.radiobutton = {}
|
||||
self.radiobutton_top, self.radiobutton_bottom = [None, None, None], [None, None, None]
|
||||
for searcher in self.keys:
|
||||
place = self.placed[searcher]
|
||||
self.radiobutton[searcher] = RadioButton(searcher)
|
||||
self.placeControl(self.radiobutton[searcher], place[0], place[1])
|
||||
self.radiobutton[searcher].setSelected(self.dic[searcher])
|
||||
self.connect(self.radiobutton[searcher], self.radio_update)
|
||||
if place[0] == 0:
|
||||
self.radiobutton_top[place[1]] = self.radiobutton[searcher]
|
||||
self.radiobutton_bottom[place[1]] = self.radiobutton[searcher]
|
||||
if self.has_searchers:
|
||||
self.radiobutton = {}
|
||||
self.radiobutton_top, self.radiobutton_bottom = [None, None, None], [None, None, None]
|
||||
for searcher in self.keys:
|
||||
place = self.placed[searcher]
|
||||
self.radiobutton[searcher] = RadioButton(searcher)
|
||||
self.placeControl(self.radiobutton[searcher], place[0], place[1])
|
||||
self.radiobutton[searcher].setSelected(self.dic[searcher])
|
||||
self.connect(self.radiobutton[searcher], self.radio_update)
|
||||
if place[0] == 0:
|
||||
self.radiobutton_top[place[1]] = self.radiobutton[searcher]
|
||||
self.radiobutton_bottom[place[1]] = self.radiobutton[searcher]
|
||||
|
||||
# Button
|
||||
self.button_install = Button(__language__(30415))
|
||||
|
@ -292,77 +151,92 @@ class ControlCenter(AddonDialogWindow):
|
|||
self.connect(self.button_close, self.close)
|
||||
|
||||
def set_navigation(self):
|
||||
# Set navigation between controls
|
||||
placed_values = self.placed.values()
|
||||
placed_keys = self.placed.keys()
|
||||
for searcher in placed_keys:
|
||||
if self.has_searchers:
|
||||
# Set navigation between controls
|
||||
placed_values = self.placed.values()
|
||||
placed_keys = self.placed.keys()
|
||||
for searcher in placed_keys:
|
||||
|
||||
buttons = [self.button_install, self.button_openserchset, self.button_clearstor]
|
||||
place = self.placed[searcher]
|
||||
buttons = [self.button_install, self.button_openserchset, self.button_clearstor]
|
||||
place = self.placed[searcher]
|
||||
|
||||
if place[0] == 0:
|
||||
self.radiobutton[searcher].controlUp(buttons[place[1]])
|
||||
else:
|
||||
ser = placed_keys[placed_values.index((place[0] - 1, place[1]))]
|
||||
self.radiobutton[searcher].controlUp(self.radiobutton[ser])
|
||||
|
||||
# self.button_columns, self.last_column_row
|
||||
if place[1] == 0 and place[0] == self.button_columns:
|
||||
if self.last_column_row > 0:
|
||||
ser = placed_keys[placed_values.index((place[0], self.last_column_row))]
|
||||
if place[0] == 0:
|
||||
self.radiobutton[searcher].controlUp(buttons[place[1]])
|
||||
else:
|
||||
ser = placed_keys[placed_values.index((place[0] - 1, 2))]
|
||||
elif place[1] == 0:
|
||||
ser = placed_keys[placed_values.index((place[0], 2))]
|
||||
else:
|
||||
ser = placed_keys[placed_values.index((place[0], place[1] - 1))]
|
||||
self.radiobutton[searcher].controlLeft(self.radiobutton[ser])
|
||||
ser = placed_keys[placed_values.index((place[0] - 1, place[1]))]
|
||||
self.radiobutton[searcher].controlUp(self.radiobutton[ser])
|
||||
|
||||
# print str((self.button_columns, self.last_column_row))
|
||||
# print searcher
|
||||
# self.button_columns, self.last_column_row
|
||||
if place[1] == 0 and place[0] == self.button_columns:
|
||||
if self.last_column_row > 0:
|
||||
ser = placed_keys[placed_values.index((place[0], self.last_column_row))]
|
||||
else:
|
||||
ser = placed_keys[placed_values.index((place[0] - 1, 2))]
|
||||
elif place[1] == 0:
|
||||
ser = placed_keys[placed_values.index((place[0], 2))]
|
||||
else:
|
||||
ser = placed_keys[placed_values.index((place[0], place[1] - 1))]
|
||||
self.radiobutton[searcher].controlLeft(self.radiobutton[ser])
|
||||
|
||||
if place == (self.button_columns, self.last_column_row) and self.last_column_row < 2:
|
||||
ser = placed_keys[placed_values.index((place[0] - 1, place[1] + 1))]
|
||||
elif place[1] == 2:
|
||||
ser = placed_keys[placed_values.index((place[0], 0))]
|
||||
else:
|
||||
ser = placed_keys[placed_values.index((place[0], place[1] + 1))]
|
||||
self.radiobutton[searcher].controlRight(self.radiobutton[ser])
|
||||
# print str((self.button_columns, self.last_column_row))
|
||||
# print searcher
|
||||
|
||||
if place == (self.button_columns, self.last_column_row) and self.last_column_row < 2:
|
||||
ser = placed_keys[placed_values.index((place[0] - 1, place[1] + 1))]
|
||||
elif place[1] == 2:
|
||||
ser = placed_keys[placed_values.index((place[0], 0))]
|
||||
else:
|
||||
ser = placed_keys[placed_values.index((place[0], place[1] + 1))]
|
||||
self.radiobutton[searcher].controlRight(self.radiobutton[ser])
|
||||
|
||||
if place[0] == self.button_columns - 1 and place[1] > self.last_column_row or \
|
||||
place[0] == self.button_columns:
|
||||
self.radiobutton[searcher].controlDown(buttons[place[1]])
|
||||
else:
|
||||
ser = placed_keys[placed_values.index((place[0] + 1, place[1]))]
|
||||
self.radiobutton[searcher].controlDown(self.radiobutton[ser])
|
||||
|
||||
self.button_install.controlUp(self.radiobutton_bottom[0])
|
||||
self.button_openserchset.controlUp(self.radiobutton_bottom[1])
|
||||
self.button_clearstor.controlUp(self.radiobutton_bottom[2])
|
||||
self.button_openset.controlDown(self.radiobutton_top[0])
|
||||
self.button_utorrent.controlDown(self.radiobutton_top[1])
|
||||
self.button_close.controlDown(self.radiobutton_top[2])
|
||||
else:
|
||||
self.button_install.controlUp(self.button_openset)
|
||||
self.button_openserchset.controlUp(self.button_utorrent)
|
||||
self.button_clearstor.controlUp(self.button_close)
|
||||
self.button_openset.controlDown(self.button_install)
|
||||
self.button_utorrent.controlDown(self.button_openserchset)
|
||||
self.button_close.controlDown(self.button_clearstor)
|
||||
|
||||
if place[0] == self.button_columns - 1 and place[1] > self.last_column_row or \
|
||||
place[0] == self.button_columns:
|
||||
self.radiobutton[searcher].controlDown(buttons[place[1]])
|
||||
else:
|
||||
ser = placed_keys[placed_values.index((place[0] + 1, place[1]))]
|
||||
self.radiobutton[searcher].controlDown(self.radiobutton[ser])
|
||||
|
||||
self.button_install.controlUp(self.radiobutton_bottom[0])
|
||||
self.button_install.controlDown(self.button_openset)
|
||||
self.button_install.controlLeft(self.button_clearstor)
|
||||
self.button_install.controlRight(self.button_openserchset)
|
||||
|
||||
self.button_openserchset.controlUp(self.radiobutton_bottom[1])
|
||||
|
||||
self.button_openserchset.controlDown(self.button_utorrent)
|
||||
self.button_openserchset.controlLeft(self.button_install)
|
||||
self.button_openserchset.controlRight(self.button_clearstor)
|
||||
|
||||
self.button_clearstor.controlUp(self.radiobutton_bottom[2])
|
||||
|
||||
self.button_clearstor.controlDown(self.button_close)
|
||||
self.button_clearstor.controlLeft(self.button_openserchset)
|
||||
self.button_clearstor.controlRight(self.button_install)
|
||||
|
||||
self.button_openset.controlUp(self.button_install)
|
||||
self.button_openset.controlDown(self.radiobutton_top[0])
|
||||
|
||||
self.button_openset.controlLeft(self.button_close)
|
||||
self.button_openset.controlRight(self.button_utorrent)
|
||||
|
||||
self.button_utorrent.controlUp(self.button_openserchset)
|
||||
self.button_utorrent.controlDown(self.radiobutton_top[1])
|
||||
|
||||
self.button_utorrent.controlLeft(self.button_openset)
|
||||
self.button_utorrent.controlRight(self.button_close)
|
||||
|
||||
self.button_close.controlUp(self.button_clearstor)
|
||||
self.button_close.controlDown(self.radiobutton_top[2])
|
||||
|
||||
self.button_close.controlLeft(self.button_utorrent)
|
||||
self.button_close.controlRight(self.button_openset)
|
||||
|
||||
|
|
Loading…
Reference in New Issue