New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FilmOn Social TV: Adding support for uploaded videos #237

Merged
merged 3 commits into from Dec 9, 2013

Conversation

Projects
None yet
3 participants
@john-peterson
Contributor

john-peterson commented Dec 9, 2013

No description provided.

@john-peterson

This comment has been minimized.

Show comment
Hide comment
@john-peterson

john-peterson Dec 9, 2013

Contributor

Adding support for space in player path in non-win32 sys.platform

Problem

VLC can't be started in Cygwin because shlex.split split the command at spaces because the command is unquoted

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" justin.tv/streamerhouse worst
[cli][info] Starting player: /c/Program Files (x86)/VideoLAN/VLC/vlc
error: Failed to start player: None ([Errno 2] No such file or directory)

Solution

I'm afraid the first patch is no good. We can't quote the cmd here or it would result in values such as "player --arg" not getting split.

This describe that quoting the vlc command in _create_arguments is wrong because it also quote a user supplied command that may contain arguments as in this example

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" justin.tv/streamerhouse worst -p "vlc --arg"
[cli][info] Starting player: vlc --arg
error: Failed to start player: vlc --arg ([Errno 2] No such file or directory)

This problem is solved by quoting the vlc command in find_default_player instead

Contributor

john-peterson commented Dec 9, 2013

Adding support for space in player path in non-win32 sys.platform

Problem

VLC can't be started in Cygwin because shlex.split split the command at spaces because the command is unquoted

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" justin.tv/streamerhouse worst
[cli][info] Starting player: /c/Program Files (x86)/VideoLAN/VLC/vlc
error: Failed to start player: None ([Errno 2] No such file or directory)

Solution

I'm afraid the first patch is no good. We can't quote the cmd here or it would result in values such as "player --arg" not getting split.

This describe that quoting the vlc command in _create_arguments is wrong because it also quote a user supplied command that may contain arguments as in this example

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" justin.tv/streamerhouse worst -p "vlc --arg"
[cli][info] Starting player: vlc --arg
error: Failed to start player: vlc --arg ([Errno 2] No such file or directory)

This problem is solved by quoting the vlc command in find_default_player instead

@john-peterson

This comment has been minimized.

Show comment
Hide comment
@john-peterson

john-peterson Dec 9, 2013

Contributor

FilmOn Social TV: Adding support for uploaded videos

Problem

This command (to download http://www.filmon.us/video/32741) doesn't work because uploaded videos aren't supported

livestreamer filmon.us/video/32741 worst

Solution

The solution is to add support for this

RTMP URL

The RTMP URL is retrieved in Wireshark

Accessing http://www.filmon.us/video/32741 in Chrome return this in Wireshark with the display filter tcp.port == 1935

Property 'app' String 'streamer/'
Property 'swfUrl' String 'http://www.battlecam.com/application/themes/base/flash/MediaPlayer.swf'
Property 'tcUrl' String 'rtmp://204.107.26.75/streamer/'

closeStream() | Set Buffer Length 1,3000ms | play('mp4:resources/video/32741/v_3.mp4')

Exception

A non-existing video is detected

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/video/327410
error: /video/327410 don't exist

by detecting that http://www.filmon.us/video/327410 redirect to http://www.filmon.us/channels

Test

The upload stream works

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/video/32741 worst

The live stream still work despite refactoring in the upload stream patch

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/alkidavid worst
Contributor

john-peterson commented Dec 9, 2013

FilmOn Social TV: Adding support for uploaded videos

Problem

This command (to download http://www.filmon.us/video/32741) doesn't work because uploaded videos aren't supported

livestreamer filmon.us/video/32741 worst

Solution

The solution is to add support for this

RTMP URL

The RTMP URL is retrieved in Wireshark

Accessing http://www.filmon.us/video/32741 in Chrome return this in Wireshark with the display filter tcp.port == 1935

Property 'app' String 'streamer/'
Property 'swfUrl' String 'http://www.battlecam.com/application/themes/base/flash/MediaPlayer.swf'
Property 'tcUrl' String 'rtmp://204.107.26.75/streamer/'

closeStream() | Set Buffer Length 1,3000ms | play('mp4:resources/video/32741/v_3.mp4')

Exception

A non-existing video is detected

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/video/327410
error: /video/327410 don't exist

by detecting that http://www.filmon.us/video/327410 redirect to http://www.filmon.us/channels

Test

The upload stream works

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/video/32741 worst

The live stream still work despite refactoring in the upload stream patch

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/alkidavid worst
@john-peterson

This comment has been minimized.

Show comment
Hide comment
@john-peterson

john-peterson Dec 9, 2013

Contributor

FilmOn Social TV: Adding support for history videos

Problem

This command (to download http://www.filmon.us/video/history/hid/3688058) doesn't work because history videos aren't supported

livestreamer filmon.us/history/3688058 worst

Solution

The solution is to add support for this

Exception

A non-existing video is detected

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/history/36880580
error: history number 36880580 don't exist

by detecting that http://www.filmon.us/video/history/hid/36880580 redirect to "/"

URL

A history video can be accessed through its HTML interface URL

livestreamer filmon.us/video/history/hid/3688058

and a livestreamer shortcut URL

livestreamer filmon.us/history/3688058

Test

The history video works

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/history/3688058 worst
python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/video/history/hid/3688058 worst
Contributor

john-peterson commented Dec 9, 2013

FilmOn Social TV: Adding support for history videos

Problem

This command (to download http://www.filmon.us/video/history/hid/3688058) doesn't work because history videos aren't supported

livestreamer filmon.us/history/3688058 worst

Solution

The solution is to add support for this

Exception

A non-existing video is detected

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/history/36880580
error: history number 36880580 don't exist

by detecting that http://www.filmon.us/video/history/hid/36880580 redirect to "/"

URL

A history video can be accessed through its HTML interface URL

livestreamer filmon.us/video/history/hid/3688058

and a livestreamer shortcut URL

livestreamer filmon.us/history/3688058

Test

The history video works

python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/history/3688058 worst
python -c "import livestreamer_cli.main; livestreamer_cli.main.main()" filmon.us/video/history/hid/3688058 worst
Show outdated Hide outdated src/livestreamer_cli/output.py
# quote command because it can contain space
if cmd.find('"') < 0:
cmd = '"' + cmd + '"'
return shlex.split(cmd) + shlex.split(args)

This comment has been minimized.

@vadmium

vadmium Dec 9, 2013

I was going to say maybe use shlex.quote(), but then I realised you could probably cut out the middle man and do

return [cmd] + shlex.split(args)

if you got rid of the backslash escaping stuff for cmd further up.

PS: just noticed shlex.quote() is Python 3.3 only, but the real question is: Is there any point putting cmd through shlex.split() if you are quoting all the spaces in the first place?

@vadmium

vadmium Dec 9, 2013

I was going to say maybe use shlex.quote(), but then I realised you could probably cut out the middle man and do

return [cmd] + shlex.split(args)

if you got rid of the backslash escaping stuff for cmd further up.

PS: just noticed shlex.quote() is Python 3.3 only, but the real question is: Is there any point putting cmd through shlex.split() if you are quoting all the spaces in the first place?

@chrippa

This comment has been minimized.

Show comment
Hide comment
@chrippa

chrippa Dec 9, 2013

Owner

I'm afraid the first patch is no good. We can't quote the cmd here or it would result in values such as "player --arg" not getting split. It should already be possible to use a player path with spaces by quoting it yourself, e.g --player "'/c/Program Files (x86)/VideoLAN/VLC/vlc'".

@vadmium We must use shlex.split to support player values such as "player --arg".

Owner

chrippa commented Dec 9, 2013

I'm afraid the first patch is no good. We can't quote the cmd here or it would result in values such as "player --arg" not getting split. It should already be possible to use a player path with spaces by quoting it yourself, e.g --player "'/c/Program Files (x86)/VideoLAN/VLC/vlc'".

@vadmium We must use shlex.split to support player values such as "player --arg".

chrippa added a commit that referenced this pull request Dec 9, 2013

Merge pull request #237 from john-peterson/filmon_upload
FilmOn Social TV: Adding support for uploaded videos

@chrippa chrippa merged commit 279be1d into chrippa:develop Dec 9, 2013

1 check passed

default The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment