fix mediaplayer
This commit is contained in:
parent
8b2e4b276d
commit
8671361ede
1 changed files with 16 additions and 14 deletions
|
|
@ -1,21 +1,19 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright(C) 2010-2011 Christophe Benz, Romain Bignon, John Obbele
|
# Copyright(C) 2010 Christophe Benz, Romain Bignon, John Obbele
|
||||||
#
|
#
|
||||||
# This file is part of weboob.
|
# 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.
|
||||||
#
|
#
|
||||||
# weboob is free software: you can redistribute it and/or modify
|
# This program is distributed in the hope that it will be useful,
|
||||||
# it under the terms of the GNU Affero 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
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU Affero General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
@ -28,9 +26,9 @@ __all__ = ['InvalidMediaPlayer', 'MediaPlayer', 'MediaPlayerNotFound']
|
||||||
|
|
||||||
|
|
||||||
PLAYERS = (
|
PLAYERS = (
|
||||||
|
('mplayer', '-'),
|
||||||
('parole', 'fd://0'),
|
('parole', 'fd://0'),
|
||||||
('totem', 'fd://0'),
|
('totem', 'fd://0'),
|
||||||
('mplayer', '-really-quiet -'),
|
|
||||||
('vlc', '-'),
|
('vlc', '-'),
|
||||||
('xine', 'stdin:/'),
|
('xine', 'stdin:/'),
|
||||||
)
|
)
|
||||||
|
|
@ -109,7 +107,10 @@ class MediaPlayer(object):
|
||||||
media_url = media.url
|
media_url = media.url
|
||||||
try:
|
try:
|
||||||
player_url = media.swf_player
|
player_url = media.swf_player
|
||||||
|
if media.swf_player:
|
||||||
rtmp = 'rtmpdump -r %s --swfVfy %s' % (media_url, player_url)
|
rtmp = 'rtmpdump -r %s --swfVfy %s' % (media_url, player_url)
|
||||||
|
else:
|
||||||
|
rtmp = 'rtmpdump -r %s' % media_url
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.logger.warning('Your media object does not have a "swf_player" attribute. SWF verification will be '
|
self.logger.warning('Your media object does not have a "swf_player" attribute. SWF verification will be '
|
||||||
'disabled and may prevent correct media playback.')
|
'disabled and may prevent correct media playback.')
|
||||||
|
|
@ -125,6 +126,7 @@ class MediaPlayer(object):
|
||||||
|
|
||||||
print ':: Streaming from %s' % media_url
|
print ':: Streaming from %s' % media_url
|
||||||
print ':: to %s %s' % (player_name, args)
|
print ':: to %s %s' % (player_name, args)
|
||||||
|
print ':: %s' % rtmp
|
||||||
p1 = Popen(rtmp.split(), stdout=PIPE)
|
p1 = Popen(rtmp.split(), stdout=PIPE)
|
||||||
Popen([player_name, args], stdin=p1.stdout, stderr=PIPE)
|
Popen([player_name, args], stdin=p1.stdout, stderr=PIPE)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue