new frontend. qvideoob
This commit is contained in:
parent
baa2fd937a
commit
eb3b8a7165
15 changed files with 949 additions and 0 deletions
45
weboob/frontends/qvideoob/minivideo.py
Normal file
45
weboob/frontends/qvideoob/minivideo.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Copyright(C) 2010 Romain Bignon
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, version 3 of the License.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
|
||||
import urllib2
|
||||
from PyQt4.QtGui import QFrame, QImage, QPixmap
|
||||
|
||||
from weboob.frontends.qvideoob.ui.minivideo_ui import Ui_MiniVideo
|
||||
|
||||
class MiniVideo(QFrame):
|
||||
def __init__(self, video, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
self.ui = Ui_MiniVideo()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
self.video = video
|
||||
self.ui.titleLabel.setText(video.title)
|
||||
self.ui.durationLabel.setText('%d:%02d:%02d' % (video.duration/3600, (video.duration%3600)/60, video.duration%60))
|
||||
self.ui.authorLabel.setText(unicode(video.author))
|
||||
self.ui.dateLabel.setText(video.date and unicode(video.date) or '')
|
||||
if video.rating_max:
|
||||
self.ui.ratingLabel.setText('%s / %s' % (video.rating, video.rating_max))
|
||||
else:
|
||||
self.ui.ratingLabel.setText('%s' % video.rating)
|
||||
|
||||
if video.preview_url:
|
||||
data = urllib2.urlopen(video.preview_url).read()
|
||||
img = QImage.fromData(data)
|
||||
self.ui.imageLabel.setPixmap(QPixmap.fromImage(img))
|
||||
Loading…
Add table
Add a link
Reference in a new issue