Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

LOAD "LINUX",8,1 -- Topic on #LinuxGER


devel / comp.lang.tcl / Re: Control a media player programmatically

SubjectAuthor
* Control a media player programmaticallyHelmut Giese
+- Control a media player programmaticallyScott Pitcher
`* Control a media player programmaticallyet99
 `- Control a media player programmaticallyet99

1
Control a media player programmatically

<36alki1jvi6b255stt28qqr5im10gjqnk5@4ax.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12381&group=comp.lang.tcl#12381

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: hgi...@ratiosoft.com (Helmut Giese)
Newsgroups: comp.lang.tcl
Subject: Control a media player programmatically
Date: Tue, 07 Nov 2023 22:42:06 +0100
Organization: ratiosoft
Lines: 15
Message-ID: <36alki1jvi6b255stt28qqr5im10gjqnk5@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="8602d40008331755c16bb911156fd9c8";
logging-data="1275347"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DbUuQuDWPxtqC6zlFpVrJ"
Cancel-Lock: sha1:FzAhXcFqaSQeHN1jmhj91N9C/jo=
X-Newsreader: Forte Free Agent 1.93/32.576 English (American)
 by: Helmut Giese - Tue, 7 Nov 2023 21:42 UTC

Hello out there,
does anybody know of an example that controls a media player (any
media player) programmatically? Not from a mobile phone or an IR
device, but from a program running on the same machine.
Preferably on Windows - but given the VM technology I think I could
work with a Linux example, too.
It needn't even be in Tcl (although it would of course be greatly
preferred) - I think I could translate it from most languages to Tcl.
I started with MPlayer (http://www.mplayerhq.hu). My first attempts
with small snippets were encouraging but when it came to the real
stuff MPlayer only stutttered and didn't advance (this was on
Windows).

Any tip or advice will be greatly appreciated
Helmut

Re: Control a media player programmatically

<20231108095431.716bb46a@workshoppc.svpts>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12382&group=comp.lang.tcl#12382

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: sco...@svptechnicalservices.com.au (Scott Pitcher)
Newsgroups: comp.lang.tcl
Subject: Re: Control a media player programmatically
Date: Wed, 8 Nov 2023 09:55:09 +1100
Organization: SVP TECHNICAL SERVICES
Lines: 33
Message-ID: <20231108095431.716bb46a@workshoppc.svpts>
References: <36alki1jvi6b255stt28qqr5im10gjqnk5@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="d0730184ec5df9ea6d1e8e625c51fe8f";
logging-data="1302227"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX187uKP9MyLmS/DB2dX8OWv66KoYGNSellk="
Cancel-Lock: sha1:96XMD5iTle0bsKLN3wtcmLRi1Fs=
X-Newsreader: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
 by: Scott Pitcher - Tue, 7 Nov 2023 22:55 UTC

On Tue, 07 Nov 2023 22:42:06 +0100
Helmut Giese <hgiese@ratiosoft.com> wrote:

> Hello out there,
> does anybody know of an example that controls a media player (any
> media player) programmatically? Not from a mobile phone or an IR
> device, but from a program running on the same machine.
> Preferably on Windows - but given the VM technology I think I could
> work with a Linux example, too.
> It needn't even be in Tcl (although it would of course be greatly
> preferred) - I think I could translate it from most languages to Tcl.
> I started with MPlayer (http://www.mplayerhq.hu). My first attempts
> with small snippets were encouraging but when it came to the real
> stuff MPlayer only stutttered and didn't advance (this was on
> Windows).
>
> Any tip or advice will be greatly appreciated
> Helmut

Hi Helmut,

Did you have a look at mplayer's "-slave" mode?

http://www.mplayerhq.hu/DOCS/tech/slave.txt

Kind regards,
Scott

--

Re: Control a media player programmatically

<uiehi1$1835r$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12383&group=comp.lang.tcl#12383

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: et9...@rocketship1.me (et99)
Newsgroups: comp.lang.tcl
Subject: Re: Control a media player programmatically
Date: Tue, 7 Nov 2023 15:34:25 -0800
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <uiehi1$1835r$1@dont-email.me>
References: <36alki1jvi6b255stt28qqr5im10gjqnk5@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 7 Nov 2023 23:34:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="70bad4227ef0993a2e456b0855ca150d";
logging-data="1313979"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Vds0yLHeP5u9PZkL7Vy7W"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:c2hf7iWjIMVobHC2YucN+gI86xc=
In-Reply-To: <36alki1jvi6b255stt28qqr5im10gjqnk5@4ax.com>
Content-Language: en-US
 by: et99 - Tue, 7 Nov 2023 23:34 UTC

On 11/7/2023 1:42 PM, Helmut Giese wrote:
> Hello out there,
> does anybody know of an example that controls a media player (any
> media player) programmatically? Not from a mobile phone or an IR
> device, but from a program running on the same machine.
> Preferably on Windows - but given the VM technology I think I could
> work with a Linux example, too.
> It needn't even be in Tcl (although it would of course be greatly
> preferred) - I think I could translate it from most languages to Tcl.
> I started with MPlayer (http://www.mplayerhq.hu). My first attempts
> with small snippets were encouraging but when it came to the real
> stuff MPlayer only stutttered and didn't advance (this was on
> Windows).
>
> Any tip or advice will be greatly appreciated
> Helmut

I control the vlc media player from tcl. I use the portable version which you can get (for windows) at portableapps.com. Then I install it on my C drive using the portableapps installer. Then in the following folder,

C:\PortableApps\VLCPortable\App\vlc\lua\http\requests

There's a readme.txt file that shows how to send http requests for most of the commands such as play, pause, skipto, etc.

Most of the commands are sent to the status.xml file, here's a tcl example where I seek +/- one second using the mousewheel.

set ::playerhost localhost ;# can send to other machines on a lan also
proc do_wheel1 {args} {
set direction [lindex $args end]
if { $direction > 0 } {
http_geturl_auth "http://$::playerhost:8080/requests/status.xml?command=seek&val=-1s"
} else {
http_geturl_auth "http://$::playerhost:8080/requests/status.xml?command=seek&val=%2B1s"
}
}

Here's one for pause:

http_geturl_auth "http://$::playerhost:8080/requests/status.xml?command=pl_pause"

There is some setup needed in the vlc program. The most recent versions needs a username and password, which I setup in the vlc program under (choose all settings)

interfaces->main interfaces-> lua

for a password of xyz and you send a blank username (I think that's required). Here's the code I use for the above http sends:

package require base64
proc http_geturl_auth {url {user {}} {pass xyz}} {
return [geturl_auth $url $user $pass]
} proc geturl_auth {url username password} {
set auth "Basic [base64::encode $username:$password]"
set headerl [list Authorization $auth]
set tok [http::geturl $url -headers $headerl -timeout 200]
return $tok
}

That should be enough to get you started if you want to use vlc from tcl/tk.

This might be helpful also:

https://wiki.videolan.org/Control_VLC_via_a_browser/

Re: Control a media player programmatically

<uifvo5$1jm6j$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12389&group=comp.lang.tcl#12389

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: et9...@rocketship1.me (et99)
Newsgroups: comp.lang.tcl
Subject: Re: Control a media player programmatically
Date: Wed, 8 Nov 2023 04:42:45 -0800
Organization: A noiseless patient Spider
Lines: 76
Message-ID: <uifvo5$1jm6j$1@dont-email.me>
References: <36alki1jvi6b255stt28qqr5im10gjqnk5@4ax.com>
<uiehi1$1835r$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 8 Nov 2023 12:42:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="70bad4227ef0993a2e456b0855ca150d";
logging-data="1693907"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+d0PrLn49UiYYp3h63aD/8"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:gJJePgDzT/vkNSDm/628S7RcmYI=
Content-Language: en-US
In-Reply-To: <uiehi1$1835r$1@dont-email.me>
 by: et99 - Wed, 8 Nov 2023 12:42 UTC

On 11/7/2023 3:34 PM, et99 wrote:
> On 11/7/2023 1:42 PM, Helmut Giese wrote:
>> Hello out there,
>> does anybody know of an example that controls a media player (any
>> media player) programmatically? Not from a mobile phone or an IR
>> device, but from a program running on the same machine.
>> Preferably on Windows - but given the VM technology I think I could
>> work with a Linux example, too.
>> It needn't even be in Tcl (although it would of course be greatly
>> preferred) - I think I could translate it from most languages to Tcl.
>> I started with MPlayer (http://www.mplayerhq.hu). My first attempts
>> with small snippets were encouraging but when it came to the real
>> stuff MPlayer only stutttered and didn't advance (this was on
>> Windows).
>>
>> Any tip or advice will be greatly appreciated
>> Helmut
>
> I control the vlc media player from tcl. I use the portable version which you can get (for windows) at portableapps.com. Then I install it on my C drive using the portableapps installer. Then in the following folder,
>
> C:\PortableApps\VLCPortable\App\vlc\lua\http\requests
>
> There's a readme.txt file that shows how to send http requests for most of the commands such as play, pause, skipto, etc.
>
> Most of the commands are sent to the status.xml file, here's a tcl example where I seek +/- one second using the mousewheel.
>
> set ::playerhost localhost ;# can send to other machines on a lan also
> proc do_wheel1 {args} {
>     set direction [lindex $args end]
>     if { $direction > 0 } {
>         http_geturl_auth "http://$::playerhost:8080/requests/status.xml?command=seek&val=-1s"
>     } else {
>         http_geturl_auth "http://$::playerhost:8080/requests/status.xml?command=seek&val=%2B1s"
>     }
> }
>
> Here's one for pause:
>
> http_geturl_auth "http://$::playerhost:8080/requests/status.xml?command=pl_pause"
>
>
> There is some setup needed in the vlc program. The most recent versions needs a username and password, which I setup in the vlc program under (choose all settings)
>
> interfaces->main interfaces-> lua
>
> for a password of xyz and you send a blank username (I think that's required). Here's the code I use for the above http sends:
>
> package require base64
> proc http_geturl_auth {url {user {}} {pass xyz}} {
>     return  [geturl_auth $url $user $pass]
> }
> proc geturl_auth {url username password} {
>     set auth "Basic [base64::encode $username:$password]"
>     set headerl [list Authorization $auth]
>     set tok [http::geturl $url -headers $headerl -timeout 200]
>     return $tok
> }
>
> That should be enough to get you started if you want to use vlc from tcl/tk.
>
> This might be helpful also:
>
> https://wiki.videolan.org/Control_VLC_via_a_browser/
>
>

Forgot one more setting,

https://wiki.videolan.org/Documentation:Modules/http_intf/#VLC_2.0.0_and_later

need to check web and enter http in the text box below that as seen.

And this can all work with the regular installed version, but I don't exactly know where all the directories are, but you should still be able to find the requests folder.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor