Calling mplayer from flashgot - params problem

Ask for help about FlashGot, no registration needed to post
Post Reply
ticket

Calling mplayer from flashgot - params problem

Post by ticket »

I want to use flashgot to start up mplayer.
Ideally I would like place "[URL]" in flashgot's download manager command line arguments template, so mplayer gets called like this:

Code: Select all

mplayer "[URL]"
The quotes are needed to stop the bash shell from interpreting the URL string.
(for some reason bash breaks the string at every '&' character in the URL, and youtube URLs have a lot of '&' in them).
Unfortunately flashgot prevents the user typing in quotes, so a shell script is needed to do the job.
But if I try:

Code: Select all

#!/bin/bash
mplayer "$1"
bash still breaks up the string [URL] being passed to mplayer. What is the right way to do this?

Given the solution to the above, there is still some work to do - the URL contains a comment string near its end, beginning with '#'. The # and all what follows it needs to be stripped off, otherwise mplayer complains. Something like sed ought to be able to do this.
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.8) Gecko/2009032711 Ubuntu/8.10 (intrepid) Firefox/3.0.8
User avatar
therube
Ambassador
Posts: 7929
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: Calling mplayer from flashgot - params problem

Post by therube »

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b4pre) Gecko/20090423 SeaMonkey/2.0b1pre
ticket

Re: Calling mplayer from flashgot - params problem

Post by ticket »

Thanks theRube, (you rock!), the advice in that link worked fine, ie.

Code: Select all

 toggle the Preference item, [b]flashgot.media.guessName[/b] (to false)
I can now fire up mplayer this way:

Code: Select all

mplayer  [URL]
no need for quotes!

Two questions remain:

(1) Is there a reason why the setting of flashgot.media.guessName isn't set to false by default?

(2) Back to the original problem of firing up a script to run mplayer - how to get the [URL] not be broken by bash?
(but I appreciate this last question is more a linux command thing than a flashgot thing).
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.8) Gecko/2009032711 Ubuntu/8.10 (intrepid) Firefox/3.0.8
User avatar
therube
Ambassador
Posts: 7929
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: Calling mplayer from flashgot - params problem

Post by therube »

1) i suppose cause its "prettier" to get a file named "Guru Josh Project - Infinity 2008.flv" rather then "video.flv". and it works for most, most of the time.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b4pre) Gecko/20090423 SeaMonkey/2.0b1pre
ticket

Re: Calling mplayer from flashgot - params problem

Post by ticket »

Well, having 'guess name' true or false fails on this site when calling mplayer:

http://www.youtube.com/watch?v=4jTA42vYijs

when 'guess' is false (the setting that normally works), mplayer complains with :

LAF_header: AV_find_stream_info() failed

I am not sure if this is because of the URL it gets or if the stream that is found is an old flv format it can't render.
Curiously, if I enable greasemonkey with a script that finds the mp4 source in the web page, then flashgot provides two URLs, the second being the mp4 feed and mplayer is happy with the mp4 feed.

Is there a fix for flashgot to detect the mp4 stream on this sort of site?
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.9) Gecko/2009042113 Ubuntu/8.10 (intrepid) Firefox/3.0.9
ticket

Re: Calling mplayer from flashgot - params problem

Post by ticket »

That youtube video appears to produce a flv steam unsupported by mplayer.
If I past the URL directly into a command line window, mplayer complains with:

[flv @ 0x8837aa8]Unsupported video codec (7)

Somewhat surprising for the universal mplayer!

Still, it would be nice if flashgot could somehow detect the presence of the mp4 stream (which appears to be the same resolution as the flv stream).
Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.9) Gecko/2009042113 Ubuntu/8.10 (intrepid) Firefox/3.0.9
User avatar
therube
Ambassador
Posts: 7929
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: Calling mplayer from flashgot - params problem

Post by therube »

FlashGot doesn't see the MP4 till its "there", but it can see it - Feature request: download mp4 from YouTube.

That FLV is using H.264. MPlayer can play it, but you may need a more recent build. I've been using this (Windows) of late & it plays it no problem, Kovensky's MPlayer - MPlayer builds for Windows.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b4pre) Gecko/20090423 SeaMonkey/2.0b1pre
Post Reply