pax_global_header 0000666 0000000 0000000 00000000064 13507732167 0014525 g ustar 00root root 0000000 0000000 52 comment=387a3e3cdc31032e63b3c0e660d6629e91b6ccdd
woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/ 0000775 0000000 0000000 00000000000 13507732167 0025300 5 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/ 0000775 0000000 0000000 00000000000 13507732167 0026555 5 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/ 0000775 0000000 0000000 00000000000 13507732167 0031243 5 ustar 00root root 0000000 0000000 qcineoob/ 0000775 0000000 0000000 00000000000 13507732167 0032763 5 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications __init__.py 0000664 0000000 0000000 00000000067 13507732167 0035077 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob from .qcineoob import QCineoob
__all__ = ['QCineoob']
main_window.py 0000664 0000000 0000000 00000060340 13507732167 0035653 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob # -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see .
import os
from PyQt5.QtCore import Qt, pyqtSlot as Slot
from PyQt5.QtGui import QKeySequence
from PyQt5.QtWidgets import QApplication, QFrame, QShortcut
from weboob.capabilities.base import NotAvailable
from weboob.capabilities.cinema import CapCinema
from weboob.capabilities.torrent import CapTorrent
from weboob.capabilities.subtitle import CapSubtitle
from weboob.tools.application.qt5 import QtMainWindow, QtDo
from weboob.tools.application.qt5.backendcfg import BackendCfg
from weboob.tools.application.qt5.models import BackendListModel
from weboob.tools.application.qt5.search_history import HistoryCompleter
from weboob.tools.compat import unicode
from weboob.applications.suboob.suboob import LANGUAGE_CONV
from weboob.applications.qcineoob.ui.main_window_ui import Ui_MainWindow
from weboob.applications.qcineoob.ui.result_ui import Ui_Result
from .minimovie import MiniMovie
from .miniperson import MiniPerson
from .minitorrent import MiniTorrent
from .minisubtitle import MiniSubtitle
from .movie import Movie
from .person import Person
from .torrent import Torrent
from .subtitle import Subtitle
MAX_TAB_TEXT_LENGTH=30
class Result(QFrame):
def __init__(self, weboob, app, parent=None):
super(Result, self).__init__(parent)
self.ui = Ui_Result()
self.ui.setupUi(self)
self.parent = parent
self.weboob = weboob
self.app = app
self.minis = []
self.current_info_widget = None
# action history is composed by the last action and the action list
# An action is a function, a list of arguments and a description string
self.action_history = {'last_action': None, 'action_list': []}
self.ui.backButton.clicked.connect(self.doBack)
self.ui.backButton.setShortcut(QKeySequence('Alt+Left'))
self.ui.backButton.hide()
def doAction(self, description, fun, args):
''' Call fun with args as arguments
and save it in the action history
'''
self.ui.currentActionLabel.setText(description)
if self.action_history['last_action'] is not None:
self.action_history['action_list'].append(self.action_history['last_action'])
self.ui.backButton.setToolTip('%s (Alt+Left)'%self.action_history['last_action']['description'])
self.ui.backButton.show()
self.action_history['last_action'] = {'function': fun, 'args': args, 'description': description}
# manage tab text
mytabindex = self.parent.ui.resultsTab.indexOf(self)
tabtxt = description
if len(tabtxt) > MAX_TAB_TEXT_LENGTH:
tabtxt = '%s...'%tabtxt[:MAX_TAB_TEXT_LENGTH]
self.parent.ui.resultsTab.setTabText(mytabindex, tabtxt)
self.parent.ui.resultsTab.setTabToolTip(mytabindex, description)
return fun(*args)
@Slot()
def doBack(self):
''' Go back in action history
Basically call previous function and update history
'''
if len(self.action_history['action_list']) > 0:
todo = self.action_history['action_list'].pop()
self.ui.currentActionLabel.setText(todo['description'])
self.action_history['last_action'] = todo
if len(self.action_history['action_list']) == 0:
self.ui.backButton.hide()
else:
self.ui.backButton.setToolTip(self.action_history['action_list'][-1]['description'])
# manage tab text
mytabindex = self.parent.ui.resultsTab.indexOf(self)
tabtxt = todo['description']
if len(tabtxt) > MAX_TAB_TEXT_LENGTH:
tabtxt = '%s...'%tabtxt[:MAX_TAB_TEXT_LENGTH]
self.parent.ui.resultsTab.setTabText(mytabindex, tabtxt)
self.parent.ui.resultsTab.setTabToolTip(mytabindex, todo['description'])
return todo['function'](*todo['args'])
def castingAction(self, backend_name, id, role):
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
for mini in self.minis:
self.ui.list_content.layout().removeWidget(mini)
mini.hide()
mini.deleteLater()
self.minis = []
self.parent.ui.searchEdit.setEnabled(False)
QApplication.setOverrideCursor(Qt.WaitCursor)
self.process = QtDo(self.weboob, self.addPerson, fb=self.processFinished)
self.process.do('iter_movie_persons', id, role, backends=backend_name, caps=CapCinema)
self.parent.ui.stopButton.show()
def moviesInCommonAction(self, backend_name, id1, id2):
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
for mini in self.minis:
self.ui.list_content.layout().removeWidget(mini)
mini.hide()
mini.deleteLater()
self.minis = []
self.parent.ui.searchEdit.setEnabled(False)
QApplication.setOverrideCursor(Qt.WaitCursor)
for a_backend in self.weboob.iter_backends():
if (backend_name and a_backend.name == backend_name):
backend = a_backend
person1 = backend.get_person(id1)
person2 = backend.get_person(id2)
lid1 = []
for p in backend.iter_person_movies_ids(id1):
lid1.append(p)
lid2 = []
for p in backend.iter_person_movies_ids(id2):
lid2.append(p)
inter = list(set(lid1) & set(lid2))
chrono_list = []
for common in inter:
movie = backend.get_movie(common)
movie.backend = backend_name
role1 = movie.get_roles_by_person_id(person1.id)
role2 = movie.get_roles_by_person_id(person2.id)
if (movie.release_date != NotAvailable):
year = movie.release_date.year
else:
year = '????'
movie.short_description = '(%s) %s as %s ; %s as %s'%(year , person1.name, ', '.join(role1), person2.name, ', '.join(role2))
i = 0
while (i chrono_list[i].release_date.year)):
i += 1
chrono_list.insert(i, movie)
for movie in chrono_list:
self.addMovie(movie)
self.processFinished()
def personsInCommonAction(self, backend_name, id1, id2):
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
for mini in self.minis:
self.ui.list_content.layout().removeWidget(mini)
mini.hide()
mini.deleteLater()
self.minis = []
self.parent.ui.searchEdit.setEnabled(False)
QApplication.setOverrideCursor(Qt.WaitCursor)
for a_backend in self.weboob.iter_backends():
if (backend_name and a_backend.name == backend_name):
backend = a_backend
movie1 = backend.get_movie(id1)
movie2 = backend.get_movie(id2)
lid1 = []
for p in backend.iter_movie_persons_ids(id1):
lid1.append(p)
lid2 = []
for p in backend.iter_movie_persons_ids(id2):
lid2.append(p)
inter = list(set(lid1) & set(lid2))
for common in inter:
person = backend.get_person(common)
person.backend = backend_name
role1 = movie1.get_roles_by_person_id(person.id)
role2 = movie2.get_roles_by_person_id(person.id)
person.short_description = '%s in %s ; %s in %s'%(', '.join(role1), movie1.original_title, ', '.join(role2), movie2.original_title)
self.addPerson(person)
self.processFinished()
def filmographyAction(self, backend_name, id, role):
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
for mini in self.minis:
self.ui.list_content.layout().removeWidget(mini)
mini.hide()
mini.deleteLater()
self.minis = []
self.parent.ui.searchEdit.setEnabled(False)
QApplication.setOverrideCursor(Qt.WaitCursor)
self.process = QtDo(self.weboob, self.addMovie, fb=self.processFinished)
self.process.do('iter_person_movies', id, role, backends=backend_name, caps=CapCinema)
self.parent.ui.stopButton.show()
def search(self, tosearch, pattern, lang):
if tosearch == 'person':
self.searchPerson(pattern)
elif tosearch == 'movie':
self.searchMovie(pattern)
elif tosearch == 'torrent':
self.searchTorrent(pattern)
elif tosearch == 'subtitle':
self.searchSubtitle(lang, pattern)
def searchMovie(self, pattern):
if not pattern:
return
self.doAction(u'Search movie "%s"' % pattern, self.searchMovieAction, [pattern])
def searchMovieAction(self, pattern):
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
for mini in self.minis:
self.ui.list_content.layout().removeWidget(mini)
mini.hide()
mini.deleteLater()
self.minis = []
self.parent.ui.searchEdit.setEnabled(False)
QApplication.setOverrideCursor(Qt.WaitCursor)
backend_name = self.parent.ui.backendEdit.itemData(self.parent.ui.backendEdit.currentIndex())
self.process = QtDo(self.weboob, self.addMovie, fb=self.processFinished)
#self.process.do('iter_movies', pattern, backends=backend_name, caps=CapCinema)
self.process.do(self.app._do_complete, self.parent.getCount(), ('original_title'), 'iter_movies', pattern, backends=backend_name, caps=CapCinema)
self.parent.ui.stopButton.show()
def addMovie(self, movie):
minimovie = MiniMovie(self.weboob, self.weboob[movie.backend], movie, self)
self.ui.list_content.layout().insertWidget(self.ui.list_content.layout().count()-1,minimovie)
self.minis.append(minimovie)
def displayMovie(self, movie, backend):
self.ui.stackedWidget.setCurrentWidget(self.ui.info_page)
if self.current_info_widget is not None:
self.ui.info_content.layout().removeWidget(self.current_info_widget)
self.current_info_widget.hide()
self.current_info_widget.deleteLater()
wmovie = Movie(movie, backend, self)
self.ui.info_content.layout().addWidget(wmovie)
self.current_info_widget = wmovie
QApplication.restoreOverrideCursor()
def searchPerson(self, pattern):
if not pattern:
return
self.doAction(u'Search person "%s"' % pattern, self.searchPersonAction, [pattern])
def searchPersonAction(self, pattern):
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
for mini in self.minis:
self.ui.list_content.layout().removeWidget(mini)
mini.hide()
mini.deleteLater()
self.minis = []
self.parent.ui.searchEdit.setEnabled(False)
QApplication.setOverrideCursor(Qt.WaitCursor)
backend_name = self.parent.ui.backendEdit.itemData(self.parent.ui.backendEdit.currentIndex())
self.process = QtDo(self.weboob, self.addPerson, fb=self.processFinished)
#self.process.do('iter_persons', pattern, backends=backend_name, caps=CapCinema)
self.process.do(self.app._do_complete, self.parent.getCount(), ('name'), 'iter_persons', pattern, backends=backend_name, caps=CapCinema)
self.parent.ui.stopButton.show()
def addPerson(self, person):
miniperson = MiniPerson(self.weboob, self.weboob[person.backend], person, self)
self.ui.list_content.layout().insertWidget(self.ui.list_content.layout().count()-1,miniperson)
self.minis.append(miniperson)
def displayPerson(self, person, backend):
self.ui.stackedWidget.setCurrentWidget(self.ui.info_page)
if self.current_info_widget is not None:
self.ui.info_content.layout().removeWidget(self.current_info_widget)
self.current_info_widget.hide()
self.current_info_widget.deleteLater()
wperson = Person(person, backend, self)
self.ui.info_content.layout().addWidget(wperson)
self.current_info_widget = wperson
QApplication.restoreOverrideCursor()
def searchTorrent(self, pattern):
if not pattern:
return
self.doAction(u'Search torrent "%s"' % pattern, self.searchTorrentAction, [pattern])
def searchTorrentAction(self, pattern):
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
for mini in self.minis:
self.ui.list_content.layout().removeWidget(mini)
mini.hide()
mini.deleteLater()
self.minis = []
self.parent.ui.searchEdit.setEnabled(False)
QApplication.setOverrideCursor(Qt.WaitCursor)
backend_name = self.parent.ui.backendEdit.itemData(self.parent.ui.backendEdit.currentIndex())
self.process = QtDo(self.weboob, self.addTorrent, fb=self.processFinished)
#self.process.do('iter_torrents', pattern, backends=backend_name, caps=CapTorrent)
self.process.do(self.app._do_complete, self.parent.getCount(), ('name'), 'iter_torrents', pattern, backends=backend_name, caps=CapTorrent)
self.parent.ui.stopButton.show()
def processFinished(self):
self.parent.ui.searchEdit.setEnabled(True)
QApplication.restoreOverrideCursor()
self.process = None
self.parent.ui.stopButton.hide()
@Slot()
def stopProcess(self):
if self.process is not None:
self.process.stop()
def addTorrent(self, torrent):
minitorrent = MiniTorrent(self.weboob, self.weboob[torrent.backend], torrent, self)
positionToInsert = self.ui.list_content.layout().count()-1
# if possible, we insert the torrent keeping a sort by seed
if torrent.seeders != NotAvailable:
seeders = torrent.seeders
positionToInsert = 0
while positionToInsert < len(self.minis) and\
(self.minis[positionToInsert].torrent.seeders != NotAvailable and\
seeders <= self.minis[positionToInsert].torrent.seeders):
positionToInsert += 1
self.ui.list_content.layout().insertWidget(positionToInsert, minitorrent)
self.minis.insert(positionToInsert, minitorrent)
def displayTorrent(self, torrent, backend):
self.ui.stackedWidget.setCurrentWidget(self.ui.info_page)
if self.current_info_widget is not None:
self.ui.info_content.layout().removeWidget(self.current_info_widget)
self.current_info_widget.hide()
self.current_info_widget.deleteLater()
wtorrent = Torrent(torrent, backend, self)
self.ui.info_content.layout().addWidget(wtorrent)
self.current_info_widget = wtorrent
def searchSubtitle(self, lang, pattern):
if not pattern:
return
self.doAction(u'Search subtitle "%s" (lang:%s)' % (pattern, lang), self.searchSubtitleAction, [lang, pattern])
def searchSubtitleAction(self, lang, pattern):
self.ui.stackedWidget.setCurrentWidget(self.ui.list_page)
for mini in self.minis:
self.ui.list_content.layout().removeWidget(mini)
mini.hide()
mini.deleteLater()
self.minis = []
self.parent.ui.searchEdit.setEnabled(False)
QApplication.setOverrideCursor(Qt.WaitCursor)
backend_name = self.parent.ui.backendEdit.itemData(self.parent.ui.backendEdit.currentIndex())
self.process = QtDo(self.weboob, self.addSubtitle, fb=self.processFinished)
#self.process.do('iter_subtitles', lang, pattern, backends=backend_name, caps=CapSubtitle)
self.process.do(self.app._do_complete, self.parent.getCount(), ('name'), 'iter_subtitles', lang, pattern, backends=backend_name, caps=CapSubtitle)
self.parent.ui.stopButton.show()
def addSubtitle(self, subtitle):
minisubtitle = MiniSubtitle(self.weboob, self.weboob[subtitle.backend], subtitle, self)
self.ui.list_content.layout().insertWidget(self.ui.list_content.layout().count()-1,minisubtitle)
self.minis.append(minisubtitle)
def displaySubtitle(self, subtitle, backend):
self.ui.stackedWidget.setCurrentWidget(self.ui.info_page)
if self.current_info_widget is not None:
self.ui.info_content.layout().removeWidget(self.current_info_widget)
self.current_info_widget.hide()
self.current_info_widget.deleteLater()
wsubtitle = Subtitle(subtitle, backend, self)
self.ui.info_content.layout().addWidget(wsubtitle)
self.current_info_widget = wsubtitle
def searchId(self, id, stype):
QApplication.setOverrideCursor(Qt.WaitCursor)
title_field = 'name'
if stype == 'movie':
cap = CapCinema
title_field = 'original_title'
elif stype == 'person':
cap = CapCinema
elif stype == 'torrent':
cap = CapTorrent
elif stype == 'subtitle':
cap = CapSubtitle
if '@' in id:
backend_name = id.split('@')[1]
id = id.split('@')[0]
else:
backend_name = None
for backend in self.weboob.iter_backends():
if backend.has_caps(cap) and ((backend_name and backend.name == backend_name) or not backend_name):
object = getattr(backend, 'get_%s' % stype)(id)
if object:
func_name = 'display' + stype[0].upper() + stype[1:]
func = getattr(self, func_name)
title = getattr(object, title_field)
self.doAction('Details of %s %r' % (stype, title), func, [object, backend])
QApplication.restoreOverrideCursor()
class MainWindow(QtMainWindow):
def __init__(self, config, weboob, app, parent=None):
super(MainWindow, self).__init__(parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.config = config
self.weboob = weboob
self.app = app
# search history is a list of patterns which have been searched
history_path = os.path.join(self.weboob.workdir, 'qcineoob_history')
qc = HistoryCompleter(history_path, self)
qc.load()
qc.setCaseSensitivity(Qt.CaseInsensitive)
self.ui.searchEdit.setCompleter(qc)
self.ui.searchEdit.returnPressed.connect(self.search)
self.ui.idEdit.returnPressed.connect(self.searchId)
self.ui.typeCombo.currentIndexChanged[unicode].connect(self.typeComboChanged)
count = self.config.get('settings', 'maxresultsnumber')
self.ui.countSpin.setValue(int(count))
showT = self.config.get('settings', 'showthumbnails')
self.ui.showTCheck.setChecked(showT == '1')
self.ui.stopButton.hide()
self.ui.actionBackends.triggered.connect(self.backendsConfig)
q = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q), self)
q.activated.connect(self.close)
n = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_PageDown), self)
n.activated.connect(self.nextTab)
p = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_PageUp), self)
p.activated.connect(self.prevTab)
w = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_W), self)
w.activated.connect(self.closeCurrentTab)
l = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_L), self)
l.activated.connect(self.ui.searchEdit.setFocus)
l.activated.connect(self.ui.searchEdit.selectAll)
self.ui.resultsTab.tabCloseRequested.connect(self.closeTab)
self.loadBackendsList()
if self.ui.backendEdit.count() == 0:
self.backendsConfig()
langs = sorted(LANGUAGE_CONV.keys())
for lang in langs:
self.ui.langCombo.addItem(lang)
self.ui.langCombo.hide()
self.ui.langLabel.hide()
@Slot(int)
def closeTab(self, index):
if self.ui.resultsTab.widget(index) != 0:
self.ui.resultsTab.removeTab(index)
@Slot()
def closeCurrentTab(self):
self.closeTab(self.ui.resultsTab.currentIndex())
@Slot()
def prevTab(self):
index = self.ui.resultsTab.currentIndex() - 1
size = self.ui.resultsTab.count()
if size != 0:
self.ui.resultsTab.setCurrentIndex(index % size)
@Slot()
def nextTab(self):
index = self.ui.resultsTab.currentIndex() + 1
size = self.ui.resultsTab.count()
if size != 0:
self.ui.resultsTab.setCurrentIndex(index % size)
def newTab(self, txt, backend, person=None, movie=None, torrent=None, subtitle=None):
id = ''
if person is not None:
id = person.id
stype = 'person'
elif movie is not None:
id = movie.id
stype = 'movie'
elif subtitle is not None:
id = subtitle.id
stype = 'subtitle'
elif torrent is not None:
id = torrent.id
stype = 'torrent'
new_res = Result(self.weboob, self.app, self)
self.ui.stopButton.clicked.connect(new_res.stopProcess)
tabtxt = txt
if len(tabtxt) > MAX_TAB_TEXT_LENGTH:
tabtxt = '%s...'%tabtxt[:MAX_TAB_TEXT_LENGTH]
index = self.ui.resultsTab.addTab(new_res, tabtxt)
self.ui.resultsTab.setTabToolTip(index, txt)
new_res.searchId(id, stype)
@Slot()
def search(self):
pattern = self.ui.searchEdit.text()
self.ui.searchEdit.completer().addString(pattern)
tosearch = self.ui.typeCombo.currentText()
lang = self.ui.langCombo.currentText()
new_res = Result(self.weboob, self.app, self)
txt = 'search %s "%s"'%(tosearch, pattern)
tabtxt = txt
if len(tabtxt) > MAX_TAB_TEXT_LENGTH:
tabtxt = '%s...'%tabtxt[:MAX_TAB_TEXT_LENGTH]
index = self.ui.resultsTab.addTab(new_res, tabtxt)
self.ui.resultsTab.setTabToolTip(index, txt)
self.ui.resultsTab.setCurrentWidget(new_res)
new_res.search(tosearch, pattern, lang)
@Slot()
def searchId(self):
id = self.ui.idEdit.text()
stype = self.ui.idTypeCombo.currentText()
new_res = Result(self.weboob, self.app, self)
self.ui.resultsTab.addTab(new_res, id)
self.ui.resultsTab.setCurrentWidget(new_res)
new_res.searchId(id, stype)
@Slot()
def backendsConfig(self):
bckndcfg = BackendCfg(self.weboob, (CapCinema, CapTorrent, CapSubtitle,), self)
if bckndcfg.run():
self.loadBackendsList()
def loadBackendsList(self):
model = BackendListModel(self.weboob)
model.addBackends()
self.ui.backendEdit.setModel(model)
current_backend = self.config.get('settings', 'backend')
idx = self.ui.backendEdit.findData(current_backend)
if idx >= 0:
self.ui.backendEdit.setCurrentIndex(idx)
if self.ui.backendEdit.count() == 0:
self.ui.searchEdit.setEnabled(False)
else:
self.ui.searchEdit.setEnabled(True)
@Slot(unicode)
def typeComboChanged(self, value):
if value == 'subtitle':
self.ui.langCombo.show()
self.ui.langLabel.show()
else:
self.ui.langCombo.hide()
self.ui.langLabel.hide()
def getCount(self):
num = self.ui.countSpin.value()
if num == 0:
return None
else:
return num
def closeEvent(self, ev):
self.config.set('settings', 'backend', self.ui.backendEdit.itemData(
self.ui.backendEdit.currentIndex()))
self.ui.searchEdit.completer().save()
self.config.set('settings', 'maxresultsnumber', self.ui.countSpin.value())
self.config.set('settings', 'showthumbnails', '1' if self.ui.showTCheck.isChecked() else '0')
self.config.save()
ev.accept()
minimovie.py 0000664 0000000 0000000 00000007064 13507732167 0035340 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob # -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see .
import requests
from PyQt5.QtGui import QIcon, QImage, QPixmap, QPixmapCache
from PyQt5.QtWidgets import QFrame, QApplication
from PyQt5.QtCore import Qt, pyqtSlot as Slot
from weboob.applications.qcineoob.ui.minimovie_ui import Ui_MiniMovie
from weboob.capabilities.base import empty, NotAvailable
class MiniMovie(QFrame):
def __init__(self, weboob, backend, movie, parent=None):
super(MiniMovie, self).__init__(parent)
self.parent = parent
self.ui = Ui_MiniMovie()
self.ui.setupUi(self)
self.weboob = weboob
self.backend = backend
self.movie = movie
self.ui.titleLabel.setText(movie.original_title)
self.ui.shortDescLabel.setText(movie.short_description)
self.ui.backendButton.setText(backend.name)
minfo = self.weboob.repositories.get_module_info(backend.NAME)
icon_path = self.weboob.repositories.get_module_icon_path(minfo)
if icon_path:
pixmap = QPixmapCache.find(icon_path)
if not pixmap:
pixmap = QPixmap(QImage(icon_path))
self.ui.backendButton.setIcon(QIcon(pixmap))
self.ui.newTabButton.clicked.connect(self.newTabPressed)
self.ui.viewButton.clicked.connect(self.viewPressed)
self.ui.viewThumbnailButton.clicked.connect(self.gotThumbnail)
if self.parent.parent.ui.showTCheck.isChecked():
self.gotThumbnail()
@Slot()
def gotThumbnail(self):
if empty(self.movie.thumbnail_url) and self.movie.thumbnail_url != NotAvailable:
self.backend.fill_movie(self.movie, ('thumbnail_url'))
if not empty(self.movie.thumbnail_url):
data = requests.get(self.movie.thumbnail_url).content
img = QImage.fromData(data)
self.ui.imageLabel.setPixmap(QPixmap.fromImage(img).scaledToHeight(100,Qt.SmoothTransformation))
@Slot()
def viewPressed(self):
QApplication.setOverrideCursor(Qt.WaitCursor)
movie = self.backend.get_movie(self.movie.id)
if movie:
self.parent.doAction('Movie "%s"' %
movie.original_title, self.parent.displayMovie, [movie, self.backend])
@Slot()
def newTabPressed(self):
movie = self.backend.get_movie(self.movie.id)
self.parent.parent.newTab(u'Movie "%s"' %
movie.original_title, self.backend, movie=movie)
def enterEvent(self, event):
self.setFrameShadow(self.Sunken)
QFrame.enterEvent(self, event)
def leaveEvent(self, event):
self.setFrameShadow(self.Raised)
QFrame.leaveEvent(self, event)
def mousePressEvent(self, event):
QFrame.mousePressEvent(self, event)
if event.button() == 2:
self.gotThumbnail()
elif event.button() == 4:
self.newTabPressed()
else:
self.viewPressed()
miniperson.py 0000664 0000000 0000000 00000007552 13507732167 0035531 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob # -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see .
import requests
from PyQt5.QtGui import QIcon, QImage, QPixmap, QPixmapCache
from PyQt5.QtWidgets import QFrame, QApplication
from PyQt5.QtCore import Qt, pyqtSlot as Slot
from weboob.applications.qcineoob.ui.miniperson_ui import Ui_MiniPerson
from weboob.capabilities.base import empty, NotAvailable
class MiniPerson(QFrame):
def __init__(self, weboob, backend, person, parent=None):
super(MiniPerson, self).__init__(parent)
self.parent = parent
self.ui = Ui_MiniPerson()
self.ui.setupUi(self)
self.weboob = weboob
self.backend = backend
self.person = person
self.ui.nameLabel.setText('%s' % person.name)
if not empty(person.short_description):
if self.parent.ui.currentActionLabel.text().startswith('Casting'):
self.ui.shortDescTitleLabel.setText(u'Role')
self.ui.shortDescLabel.setText('%s' % person.short_description)
else:
self.ui.shortDescTitleLabel.hide()
self.ui.shortDescLabel.hide()
self.ui.backendButton.setText(backend.name)
minfo = self.weboob.repositories.get_module_info(backend.NAME)
icon_path = self.weboob.repositories.get_module_icon_path(minfo)
if icon_path:
pixmap = QPixmapCache.find(icon_path)
if not pixmap:
pixmap = QPixmap(QImage(icon_path))
self.ui.backendButton.setIcon(QIcon(pixmap))
self.ui.newTabButton.clicked.connect(self.newTabPressed)
self.ui.viewButton.clicked.connect(self.viewPressed)
self.ui.viewThumbnailButton.clicked.connect(self.gotThumbnail)
if self.parent.parent.ui.showTCheck.isChecked():
self.gotThumbnail()
@Slot()
def gotThumbnail(self):
if empty(self.person.thumbnail_url) and self.person.thumbnail_url != NotAvailable:
self.backend.fill_person(self.person, ('thumbnail_url'))
if not empty(self.person.thumbnail_url):
data = requests.get(self.person.thumbnail_url).content
img = QImage.fromData(data)
self.ui.imageLabel.setPixmap(QPixmap.fromImage(img).scaledToHeight(100,Qt.SmoothTransformation))
@Slot()
def viewPressed(self):
QApplication.setOverrideCursor(Qt.WaitCursor)
person = self.backend.get_person(self.person.id)
if person:
self.parent.doAction(u'Person "%s"' %
person.name, self.parent.displayPerson, [person, self.backend])
@Slot()
def newTabPressed(self):
person = self.backend.get_person(self.person.id)
self.parent.parent.newTab(u'Person "%s"' %
person.name, self.backend, person=person)
def enterEvent(self, event):
self.setFrameShadow(self.Sunken)
QFrame.enterEvent(self, event)
def leaveEvent(self, event):
self.setFrameShadow(self.Raised)
QFrame.leaveEvent(self, event)
def mousePressEvent(self, event):
QFrame.mousePressEvent(self, event)
if event.button() == 2:
self.gotThumbnail()
elif event.button() == 4:
self.newTabPressed()
else:
self.viewPressed()
minisubtitle.py 0000664 0000000 0000000 00000005553 13507732167 0036055 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob # -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see .
from PyQt5.QtWidgets import QFrame
from PyQt5.QtCore import pyqtSlot as Slot
from PyQt5.QtGui import QIcon, QImage, QPixmap, QPixmapCache
from weboob.applications.qcineoob.ui.minisubtitle_ui import Ui_MiniSubtitle
from weboob.capabilities.base import empty
class MiniSubtitle(QFrame):
def __init__(self, weboob, backend, subtitle, parent=None):
super(MiniSubtitle, self).__init__(parent)
self.parent = parent
self.ui = Ui_MiniSubtitle()
self.ui.setupUi(self)
self.weboob = weboob
self.backend = backend
self.subtitle = subtitle
self.ui.nameLabel.setText(subtitle.name)
if not empty(subtitle.nb_cd):
self.ui.nbcdLabel.setText(u'%s' % subtitle.nb_cd)
self.ui.backendButton.setText(backend.name)
minfo = self.weboob.repositories.get_module_info(backend.NAME)
icon_path = self.weboob.repositories.get_module_icon_path(minfo)
if icon_path:
pixmap = QPixmapCache.find(icon_path)
if not pixmap:
pixmap = QPixmap(QImage(icon_path))
self.ui.backendButton.setIcon(QIcon(pixmap))
self.ui.newTabButton.clicked.connect(self.newTabPressed)
self.ui.viewButton.clicked.connect(self.viewPressed)
@Slot()
def viewPressed(self):
subtitle = self.backend.get_subtitle(self.subtitle.id)
if subtitle:
self.parent.doAction('Subtitle "%s"' %
subtitle.name, self.parent.displaySubtitle, [subtitle, self.backend])
@Slot()
def newTabPressed(self):
subtitle = self.backend.get_subtitle(self.subtitle.id)
self.parent.parent.newTab(u'Subtitle "%s"' %
subtitle.name, self.backend, subtitle=subtitle)
def enterEvent(self, event):
self.setFrameShadow(self.Sunken)
QFrame.enterEvent(self, event)
def leaveEvent(self, event):
self.setFrameShadow(self.Raised)
QFrame.leaveEvent(self, event)
def mousePressEvent(self, event):
QFrame.mousePressEvent(self, event)
if event.button() == 4:
self.newTabPressed()
else:
self.viewPressed()
minitorrent.py 0000664 0000000 0000000 00000006100 13507732167 0035704 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob # -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see .
from PyQt5.QtWidgets import QFrame
from PyQt5.QtCore import pyqtSlot as Slot
from PyQt5.QtGui import QIcon, QImage, QPixmap, QPixmapCache
from weboob.applications.qcineoob.ui.minitorrent_ui import Ui_MiniTorrent
from weboob.applications.weboorrents.weboorrents import sizeof_fmt
from weboob.capabilities.base import empty
class MiniTorrent(QFrame):
def __init__(self, weboob, backend, torrent, parent=None):
super(MiniTorrent, self).__init__(parent)
self.parent = parent
self.ui = Ui_MiniTorrent()
self.ui.setupUi(self)
self.weboob = weboob
self.backend = backend
self.torrent = torrent
self.ui.nameLabel.setText(torrent.name)
if not empty(torrent.seeders) and not empty(torrent.leechers):
self.ui.seedLeechLabel.setText('%s/%s' % (torrent.seeders, torrent.leechers))
if not empty(torrent.size):
self.ui.sizeLabel.setText(u'%s' % sizeof_fmt(torrent.size))
self.ui.backendButton.setText(backend.name)
minfo = self.weboob.repositories.get_module_info(backend.NAME)
icon_path = self.weboob.repositories.get_module_icon_path(minfo)
if icon_path:
pixmap = QPixmapCache.find(icon_path)
if not pixmap:
pixmap = QPixmap(QImage(icon_path))
self.ui.backendButton.setIcon(QIcon(pixmap))
self.ui.newTabButton.clicked.connect(self.newTabPressed)
self.ui.viewButton.clicked.connect(self.viewPressed)
@Slot()
def viewPressed(self):
torrent = self.backend.get_torrent(self.torrent.id)
if torrent:
self.parent.doAction('Torrent "%s"' %
torrent.name, self.parent.displayTorrent, [torrent, self.backend])
@Slot()
def newTabPressed(self):
torrent = self.backend.get_torrent(self.torrent.id)
self.parent.parent.newTab(u'Torrent "%s"' %
torrent.name, self.backend, torrent=torrent)
def enterEvent(self, event):
self.setFrameShadow(self.Sunken)
QFrame.enterEvent(self, event)
def leaveEvent(self, event):
self.setFrameShadow(self.Raised)
QFrame.leaveEvent(self, event)
def mousePressEvent(self, event):
QFrame.mousePressEvent(self, event)
if event.button() == 4:
self.newTabPressed()
else:
self.viewPressed()
movie.py 0000664 0000000 0000000 00000013655 13507732167 0034466 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob # -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see .
import requests
from PyQt5.QtCore import Qt, pyqtSlot as Slot
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtWidgets import QFrame, QMessageBox
from weboob.applications.qcineoob.ui.movie_ui import Ui_Movie
from weboob.capabilities.base import empty
from weboob.applications.suboob.suboob import LANGUAGE_CONV
from weboob.tools.compat import unicode
class Movie(QFrame):
def __init__(self, movie, backend, parent=None):
super(Movie, self).__init__(parent)
self.parent = parent
self.ui = Ui_Movie()
self.ui.setupUi(self)
langs = sorted(LANGUAGE_CONV.keys())
for lang in langs:
self.ui.langCombo.addItem(lang)
self.ui.castingButton.clicked.connect(self.casting)
self.ui.torrentButton.clicked.connect(self.searchTorrent)
self.ui.subtitleButton.clicked.connect(self.searchSubtitle)
self.ui.personsInCommonButton.clicked.connect(self.personsInCommon)
self.movie = movie
self.backend = backend
self.ui.titleLabel.setText(movie.original_title)
self.ui.durationLabel.setText(unicode(movie.duration))
self.gotThumbnail()
self.putReleases()
self.ui.idEdit.setText(u'%s@%s' % (movie.id, backend.name))
if not empty(movie.other_titles):
self.ui.otherTitlesPlain.setPlainText('\n'.join(movie.other_titles))
else:
self.ui.otherTitlesPlain.parent().hide()
if not empty(movie.genres):
genres = u''
for g in movie.genres:
genres += '%s, ' % g
genres = genres[:-2]
self.ui.genresLabel.setText(genres)
else:
self.ui.genresLabel.parent().hide()
if not empty(movie.release_date):
self.ui.releaseDateLabel.setText(movie.release_date.strftime('%Y-%m-%d'))
else:
self.ui.releaseDateLabel.parent().hide()
if not empty(movie.duration):
self.ui.durationLabel.setText('%s min' % movie.duration)
else:
self.ui.durationLabel.parent().hide()
if not empty(movie.pitch):
self.ui.pitchPlain.setPlainText('%s' % movie.pitch)
else:
self.ui.pitchPlain.parent().hide()
if not empty(movie.country):
self.ui.countryLabel.setText('%s' % movie.country)
else:
self.ui.countryLabel.parent().hide()
if not empty(movie.note):
self.ui.noteLabel.setText('%s' % movie.note)
else:
self.ui.noteLabel.parent().hide()
for role in movie.roles.keys():
self.ui.castingCombo.addItem('%s' % role)
self.ui.verticalLayout.setAlignment(Qt.AlignTop)
self.ui.verticalLayout_2.setAlignment(Qt.AlignTop)
def putReleases(self):
rel = self.backend.get_movie_releases(self.movie.id)
if not empty(rel):
self.ui.allReleasesPlain.setPlainText(rel)
else:
self.ui.allReleasesPlain.parent().hide()
def gotThumbnail(self):
if not empty(self.movie.thumbnail_url):
data = requests.get(self.movie.thumbnail_url).content
img = QImage.fromData(data)
self.ui.imageLabel.setPixmap(QPixmap.fromImage(img).scaledToWidth(220,Qt.SmoothTransformation))
@Slot()
def searchSubtitle(self):
tosearch = unicode(self.movie.original_title)
lang = self.ui.langCombo.currentText()
desc = 'Search subtitles for "%s" (lang:%s)' % (tosearch, lang)
self.parent.doAction(desc, self.parent.searchSubtitleAction, [lang, tosearch])
@Slot()
def searchTorrent(self):
tosearch = self.movie.original_title
if not empty(self.movie.release_date):
tosearch += ' %s' % self.movie.release_date.year
desc = 'Search torrents for "%s"' % tosearch
self.parent.doAction(desc, self.parent.searchTorrentAction, [tosearch])
@Slot()
def casting(self):
role = None
tosearch = self.ui.castingCombo.currentText()
role_desc = ''
if tosearch != 'all':
role = tosearch
role_desc = ' as %s' % role
self.parent.doAction('Casting%s of movie "%s"' % (role_desc, self.movie.original_title),
self.parent.castingAction, [self.backend.name, self.movie.id, role])
@Slot()
def personsInCommon(self):
my_id = self.movie.id
my_title = self.movie.original_title
other_id = self.ui.personsInCommonEdit.text().split('@')[0]
other_movie = self.backend.get_movie(other_id)
if other_id == self.movie.id:
QMessageBox.critical(None, self.tr('"Persons in common" error'),
self.tr('Nice try\nThe movies must be different'),
QMessageBox.Ok)
elif not other_movie:
QMessageBox.critical(None, self.tr('"Persons in common" error'),
self.tr('Movie not found: %s' % other_id),
QMessageBox.Ok)
else:
other_title = other_movie.original_title
desc = 'Persons in common %s, %s'%(my_title, other_title)
self.parent.doAction(desc, self.parent.personsInCommonAction, [self.backend.name, my_id, other_id])
person.py 0000664 0000000 0000000 00000011040 13507732167 0034637 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob # -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see .
import requests
from PyQt5.QtCore import pyqtSlot as Slot, Qt
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtWidgets import QFrame, QApplication, QMessageBox
from weboob.applications.qcineoob.ui.person_ui import Ui_Person
from weboob.capabilities.base import empty
class Person(QFrame):
def __init__(self, person, backend, parent=None):
super(Person, self).__init__(parent)
self.parent = parent
self.ui = Ui_Person()
self.ui.setupUi(self)
self.ui.filmographyButton.clicked.connect(self.filmography)
self.ui.biographyButton.clicked.connect(self.biography)
self.ui.moviesInCommonButton.clicked.connect(self.moviesInCommon)
self.person = person
self.backend = backend
self.gotThumbnail()
self.ui.nameLabel.setText(person.name)
self.ui.idEdit.setText(u'%s@%s' % (person.id, backend.name))
if not empty(person.real_name):
self.ui.realNameLabel.setText('%s' % person.real_name)
else:
self.ui.realNameLabel.parent().hide()
if not empty(person.birth_place):
self.ui.birthPlaceLabel.setText('%s' % person.birth_place)
else:
self.ui.birthPlaceLabel.parent().hide()
if not empty(person.birth_date):
self.ui.birthDateLabel.setText(person.birth_date.strftime('%Y-%m-%d'))
else:
self.ui.birthDateLabel.parent().hide()
if not empty(person.death_date):
self.ui.deathDateLabel.setText(person.death_date.strftime('%Y-%m-%d'))
else:
self.ui.deathDateLabel.parent().hide()
self.ui.shortBioPlain.setPlainText('%s' % person.short_biography)
for role in person.roles.keys():
self.ui.filmographyCombo.addItem(role)
self.ui.verticalLayout_2.setAlignment(Qt.AlignTop)
def gotThumbnail(self):
if not empty(self.person.thumbnail_url):
data = requests.get(self.person.thumbnail_url).content
img = QImage.fromData(data)
self.ui.imageLabel.setPixmap(QPixmap.fromImage(img).scaledToWidth(220,Qt.SmoothTransformation))
@Slot()
def filmography(self):
role = None
tosearch = self.ui.filmographyCombo.currentText()
role_desc = ''
if tosearch != 'all':
role = tosearch
role_desc = ' as %s' % role
self.parent.doAction('Filmography of "%s"%s' % (self.person.name, role_desc),
self.parent.filmographyAction, [self.backend.name, self.person.id, role])
@Slot()
def biography(self):
QApplication.setOverrideCursor(Qt.WaitCursor)
self.backend.fill_person(self.person, 'biography')
bio = self.person.biography
self.ui.shortBioPlain.setPlainText(u'%s' % bio)
self.ui.biographyLabel.setText('Full biography:')
self.ui.biographyButton.hide()
QApplication.restoreOverrideCursor()
@Slot()
def moviesInCommon(self):
my_id = self.person.id
my_name = self.person.name
other_id = self.ui.moviesInCommonEdit.text().split('@')[0]
other_person = self.backend.get_person(other_id)
if other_id == self.person.id:
QMessageBox.critical(None, self.tr('"Moviess in common" error'),
self.tr('Nice try\nThe persons must be different'),
QMessageBox.Ok)
elif not other_person:
QMessageBox.critical(None, self.tr('"Movies in common" error'),
self.tr('Person not found: %s' % other_id),
QMessageBox.Ok)
else:
other_name = other_person.name
desc = 'Movies in common %s, %s'%(my_name, other_name)
self.parent.doAction(desc, self.parent.moviesInCommonAction, [self.backend.name, my_id, other_id])
qcineoob.py 0000664 0000000 0000000 00000003336 13507732167 0035141 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob # -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see .
from weboob.capabilities.cinema import CapCinema
from weboob.capabilities.torrent import CapTorrent
from weboob.capabilities.subtitle import CapSubtitle
from weboob.tools.application.qt5 import QtApplication
from .main_window import MainWindow
class QCineoob(QtApplication):
APPNAME = 'qcineoob'
VERSION = '1.6'
COPYRIGHT = 'Copyright(C) 2013-YEAR Julien Veyssier'
DESCRIPTION = "Qt application allowing to search movies, people, torrent and subtitles."
SHORT_DESCRIPTION = "search movies, people, torrent and subtitles"
CAPS = CapCinema, CapTorrent, CapSubtitle
CONFIG = {'settings': {'backend': '',
'maxresultsnumber': '10',
'showthumbnails': '0'
}
}
def main(self, argv):
self.load_backends([CapCinema, CapTorrent, CapSubtitle])
self.load_config()
main_window = MainWindow(self.config, self.weboob, self)
main_window.show()
return self.weboob.loop()
subtitle.py 0000664 0000000 0000000 00000006557 13507732167 0035205 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob # -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see .
from __future__ import print_function
from PyQt5.QtCore import Qt, pyqtSlot as Slot
from PyQt5.QtWidgets import QFrame, QFileDialog
from weboob.applications.qcineoob.ui.subtitle_ui import Ui_Subtitle
from weboob.capabilities.base import empty
class Subtitle(QFrame):
def __init__(self, subtitle, backend, parent=None):
super(Subtitle, self).__init__(parent)
self.parent = parent
self.backend = backend
self.ui = Ui_Subtitle()
self.ui.setupUi(self)
self.ui.downloadButton.clicked.connect(self.download)
self.subtitle = subtitle
self.ui.idEdit.setText(u'%s@%s' % (subtitle.id, backend.name))
self.ui.nameLabel.setText(u'%s' % subtitle.name)
if not empty(subtitle.nb_cd):
self.ui.nbcdLabel.setText(u'%s' % subtitle.nb_cd)
else:
self.ui.nbcdLabel.parent().hide()
if not empty(subtitle.language):
self.ui.langLabel.setText(u'%s' % subtitle.language)
else:
self.ui.langLabel.parent().hide()
if not empty(subtitle.description):
self.ui.descriptionPlain.setPlainText(u'%s' % subtitle.description)
else:
self.ui.descriptionPlain.parent().hide()
if not empty(subtitle.url):
self.ui.urlEdit.setText(u'%s' % subtitle.url)
else:
self.ui.downloadButton.setDisabled(True)
self.ui.downloadButton.setText('Impossible to download this subtitle')
self.ui.verticalLayout.setAlignment(Qt.AlignTop)
@Slot()
def download(self):
if not empty(self.subtitle.url):
if self.subtitle.url.endswith('.rar'):
ext = '.rar'
elif self.subtitle.url.endswith('.srt'):
ext = '.srt'
else:
ext = '.zip'
fileDial = QFileDialog(self, 'Save "%s" subtitle file' %
self.subtitle.name, '%s%s' % (self.subtitle.name, ext), 'all files (*)')
fileDial.setAcceptMode(QFileDialog.AcceptSave)
fileDial.setLabelText(QFileDialog.Accept, 'Save subtitle file')
fileDial.setLabelText(QFileDialog.FileName, 'Subtitle file name')
ok = (fileDial.exec_() == 1)
if not ok:
return
result = fileDial.selectedFiles()
if len(result) > 0:
dest = result[0]
data = self.backend.get_subtitle_file(self.subtitle.id)
try:
with open(dest, 'w') as f:
f.write(data)
except IOError as e:
print('Unable to write subtitle file in "%s": %s' % (dest, e), file=self.stderr)
return 1
return
torrent.py 0000664 0000000 0000000 00000007346 13507732167 0035044 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob # -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see .
from __future__ import print_function
from PyQt5.QtCore import Qt, pyqtSlot as Slot
from PyQt5.QtWidgets import QFrame, QFileDialog
from weboob.applications.qcineoob.ui.torrent_ui import Ui_Torrent
from weboob.applications.weboorrents.weboorrents import sizeof_fmt
from weboob.capabilities.base import empty
from weboob.tools.compat import unicode
class Torrent(QFrame):
def __init__(self, torrent, backend, parent=None):
super(Torrent, self).__init__(parent)
self.parent = parent
self.backend = backend
self.ui = Ui_Torrent()
self.ui.setupUi(self)
self.ui.downloadButton.clicked.connect(self.download)
self.torrent = torrent
self.ui.idEdit.setText(u'%s@%s' % (torrent.id, backend.name))
self.ui.nameLabel.setText(u'%s' % torrent.name)
if not empty(torrent.url):
self.ui.urlEdit.setText(u'%s' % torrent.url)
else:
self.ui.urlFrame.hide()
self.ui.downloadButton.setDisabled(True)
if not empty(torrent.magnet):
self.ui.downloadButton.setText(u'Download not available\nbut magnet link provided')
self.ui.downloadButton.setToolTip(u'Use the magnet link')
if not empty(torrent.description):
self.ui.descriptionPlain.setText(u'%s' % torrent.description)
else:
self.ui.descriptionPlain.parent().hide()
if not empty(torrent.files):
files = u''
for f in torrent.files:
files += '%s\n' % f
self.ui.filesPlain.setText(u'%s' % files)
else:
self.ui.filesPlain.parent().hide()
if not empty(torrent.magnet):
self.ui.magnetEdit.setText(u'%s' % torrent.magnet)
else:
self.ui.magnetFrame.hide()
if not empty(torrent.seeders) and not empty(torrent.leechers):
self.ui.seedLeechLabel.setText(u'%s/%s' % (torrent.seeders, torrent.leechers))
if not empty(torrent.size):
self.ui.sizeLabel.setText(u'%s' % sizeof_fmt(torrent.size))
self.ui.verticalLayout.setAlignment(Qt.AlignTop)
@Slot()
def download(self):
fileDial = QFileDialog(self, 'Save "%s" torrent file' % self.torrent.name, '%s.torrent' %
self.torrent.name, 'Torrent file (*.torrent);;all files (*)')
fileDial.setAcceptMode(QFileDialog.AcceptSave)
fileDial.setLabelText(QFileDialog.Accept, 'Save torrent file')
fileDial.setLabelText(QFileDialog.FileName, 'Torrent file name')
ok = (fileDial.exec_() == 1)
if not ok:
return
result = fileDial.selectedFiles()
if len(result) > 0:
dest = result[0]
data = self.backend.get_torrent_file(self.torrent.id)
try:
with open(unicode(dest), 'w') as f:
f.write(data)
except IOError as e:
print('Unable to write .torrent in "%s": %s' % (dest, e), file=self.stderr)
return 1
return
ui/ 0000775 0000000 0000000 00000000000 13507732167 0033400 5 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob Makefile 0000664 0000000 0000000 00000000265 13507732167 0035043 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui UI_FILES = $(wildcard *.ui)
UI_PY_FILES = $(UI_FILES:%.ui=%_ui.py)
PYUIC = pyuic5
all: $(UI_PY_FILES)
%_ui.py: %.ui
$(PYUIC) -o $@ $^
clean:
rm -f *.pyc
rm -f $(UI_PY_FILES)
__init__.py 0000664 0000000 0000000 00000000000 13507732167 0035477 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui main_window.ui 0000664 0000000 0000000 00000013715 13507732167 0036261 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui
MainWindow
0
0
748
463
QCineoob
4
-
QFrame::StyledPanel
QFrame::Raised
0
0
-
Search:
-
-
45
16777215
75
true
background-color: qlineargradient(spread:pad, x1:1, y1:1, x2:1, y2:1, stop:0 rgba(255, 0, 0, 255), stop:0.479904 rgba(255, 0, 0, 255), stop:0.522685 rgba(255, 255, 255, 255), stop:1 rgba(255, 255, 255, 255));
stop
-
-
movie
-
person
-
torrent
-
subtitle
-
8
language
-
-
-
<html><head/><body><p>Maximum results by backend</p><p>0 = no limit</p></body></html>
max results
-
<html><head/><body><p>Maximum results by backend</p><p>0 = no limit</p></body></html>
-
-1
true
true
-
-
Show thumbnails
-
Search by id:
-
-
-
movie
-
person
-
torrent
-
subtitle
toolBar
TopToolBarArea
false
Backends
minimovie.ui 0000664 0000000 0000000 00000012736 13507732167 0035744 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui
MiniMovie
0
0
563
138
Form
QFrame::StyledPanel
QFrame::Raised
9
5
5
-
0
0
-
-
75
true
Title
-
75
true
Short description:
-
0
0
50
true
false
TextLabel
true
-
75
true
Where
-
TextLabel
false
-
-
120
20
View
-
120
20
View in new tab
-
120
20
View thumbnail
-
Qt::Horizontal
40
20
-
-
16777215
20
PushButton
true
-
Qt::Horizontal
40
20
miniperson.ui 0000664 0000000 0000000 00000013073 13507732167 0036126 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui
MiniPerson
0
0
594
136
Form
QFrame::StyledPanel
QFrame::Raised
9
5
5
-
0
0
-
-
75
true
Name
-
0
0
50
true
false
TextLabel
true
-
75
true
Short description
-
TextLabel
false
-
75
true
Where
-
0
-
120
20
View
-
120
20
View in new tab
-
120
20
View thumbnail
-
Qt::Horizontal
40
20
-
-
16777215
20
PushButton
true
-
Qt::Horizontal
40
20
minisubtitle.ui 0000664 0000000 0000000 00000010305 13507732167 0036446 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui
MiniSubtitle
0
0
464
136
Form
QFrame::StyledPanel
QFrame::Raised
9
5
5
-
0
0
-
QFormLayout::ExpandingFieldsGrow
-
75
true
Name
-
0
0
50
true
false
TextLabel
true
-
75
true
Nb CD
-
TextLabel
-
75
true
Where
-
16777215
20
View in new tab
-
16777215
20
View
-
16777215
20
PushButton
true
minitorrent.ui 0000664 0000000 0000000 00000011177 13507732167 0036320 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui
MiniTorrent
0
0
464
138
Form
QFrame::StyledPanel
QFrame::Raised
9
5
5
-
0
0
-
QFormLayout::ExpandingFieldsGrow
-
75
true
Name
-
0
0
50
true
false
TextLabel
-
75
true
Seed/leech:
-
TextLabel
-
75
true
Size:
-
TextLabel
-
75
true
Where
-
16777215
20
View
-
16777215
20
View in new tab
-
16777215
20
PushButton
true
movie.ui 0000664 0000000 0000000 00000043030 13507732167 0035056 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui
Movie
0
0
655
733
0
0
10000
10000
Frame
QFrame::StyledPanel
QFrame::Raised
-
16777215
3000
QFrame::NoFrame
QFrame::Raised
-
-
QFrame::NoFrame
QFrame::Raised
0
0
-
view casting
-
-
all
-
QFrame::NoFrame
QFrame::Raised
0
0
-
search torrents
-
QFrame::NoFrame
QFrame::Raised
0
0
-
search subtitles
-
-
QFrame::StyledPanel
QFrame::Raised
-
Search persons in common with
-
-
0
0
Movie ID :
-
0
0
-
16777215
9000
QFrame::NoFrame
QFrame::Raised
-
16777215
40
QFrame::StyledPanel
QFrame::Raised
3
3
-
75
true
Id:
-
Qt::AlignCenter
true
-
16777215
35
QFrame::StyledPanel
QFrame::Raised
-
75
true
Title:
-
-
16777215
35
QFrame::StyledPanel
QFrame::Raised
-
75
true
Duration:
-
-
16777215
35
QFrame::StyledPanel
QFrame::Raised
-
75
true
Release date:
-
-
16777215
150
QFrame::StyledPanel
QFrame::Raised
-
75
true
Pitch:
-
0
0
Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
-
16777215
35
QFrame::StyledPanel
QFrame::Raised
-
75
true
Country:
-
-
16777215
35
QFrame::StyledPanel
QFrame::Raised
-
75
true
Genres:
-
true
-
16777215
35
QFrame::StyledPanel
QFrame::Raised
-
75
true
Note:
-
-
16777215
200
QFrame::StyledPanel
QFrame::Raised
-
75
true
All release dates:
-
Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
-
0
0
16777215
200
QFrame::StyledPanel
QFrame::Raised
-
100
16777215
75
true
Other titles:
-
Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
person.ui 0000664 0000000 0000000 00000027303 13507732167 0035252 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui
Person
0
0
857
629
Frame
QFrame::StyledPanel
QFrame::Raised
-
QFrame::NoFrame
QFrame::Raised
-
-
QFrame::NoFrame
QFrame::Raised
-
view
filmography
-
as
-
-
all
-
QFrame::StyledPanel
QFrame::Raised
-
Search movies in common with
-
-
0
0
Person ID :
-
0
0
-
QFrame::NoFrame
QFrame::Raised
-
16777215
40
QFrame::StyledPanel
QFrame::Raised
3
3
-
75
true
Id:
-
Qt::AlignCenter
true
-
QFrame::StyledPanel
QFrame::Raised
-
75
true
name:
-
-
QFrame::StyledPanel
QFrame::Raised
-
75
true
Birth date:
-
-
QFrame::StyledPanel
QFrame::Raised
-
75
true
Real Name:
-
-
QFrame::StyledPanel
QFrame::Raised
-
75
true
Birth place:
-
-
QFrame::StyledPanel
QFrame::Raised
-
75
true
Death date:
-
-
QFrame::StyledPanel
QFrame::Raised
-
QFrame::NoFrame
QFrame::Raised
-
75
true
Short biography:
-
view full
biography
-
0
0
16777215
250
Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
result.ui 0000664 0000000 0000000 00000011173 13507732167 0035260 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui
Result
0
0
645
733
0
0
10000
10000
Frame
QFrame::StyledPanel
QFrame::Raised
-
QFrame::NoFrame
QFrame::Raised
0
0
-
Qt::Horizontal
40
20
-
60
20
<<back
-
75
true
Qt::AlignCenter
true
-
Qt::Horizontal
40
20
-
-
true
0
0
605
667
-
Qt::Vertical
20
40
-
true
0
0
605
667
subtitle.ui 0000664 0000000 0000000 00000020437 13507732167 0035600 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui
Subtitle
0
0
629
552
0
0
2000
600
Frame
QFrame::StyledPanel
QFrame::Raised
-
16777215
600
QFrame::NoFrame
QFrame::Raised
-
16777215
40
QFrame::StyledPanel
QFrame::Raised
3
3
-
75
true
Id:
-
Qt::AlignCenter
true
-
16777215
1000
QFrame::StyledPanel
QFrame::Raised
-
75
true
Name:
-
true
-
16777215
1000
QFrame::StyledPanel
QFrame::Raised
-
75
true
Nb CD:
-
-
16777215
1000
QFrame::StyledPanel
QFrame::Raised
-
75
true
Lang:
-
-
16777215
200
QFrame::StyledPanel
QFrame::Raised
-
75
true
Description:
-
16777215
120
-
16777215
40
QFrame::StyledPanel
QFrame::Raised
3
3
-
75
true
Url:
-
-
Download
torrent.ui 0000664 0000000 0000000 00000024563 13507732167 0035446 0 ustar 00root root 0000000 0000000 woob-387a3e3cdc31032e63b3c0e660d6629e91b6ccdd-weboob-applications-qcineoob/weboob/applications/qcineoob/ui
Torrent
0
0
629
571
0
0
10000
10000
Frame
QFrame::StyledPanel
QFrame::Raised
-
16777215
10000
QFrame::NoFrame
QFrame::Raised
-
16777215
40
QFrame::StyledPanel
QFrame::Raised
3
3
-
75
true
Id:
-
Qt::AlignCenter
true
-
16777215
35
QFrame::StyledPanel
QFrame::Raised
-
75
true
Name:
-
-
16777215
35
QFrame::StyledPanel
QFrame::Raised
-
75
true
Seed/leech:
-
-
16777215
35
QFrame::StyledPanel
QFrame::Raised
-
75
true
Size:
-
-
0
150
16777215
500
QFrame::StyledPanel
QFrame::Raised
-
75
true
Description:
-
-
0
120
16777215
200
QFrame::StyledPanel
QFrame::Raised
-
75
true
Files:
-
-
16777215
40
QFrame::StyledPanel
QFrame::Raised
3
3
-
75
true
Url:
-
-
16777215
40
QFrame::StyledPanel
QFrame::Raised
3
3
-
75
true
Magnet:
-
-
Download