How to run streamripper and mplayer in a split-screen X terminal, via a single script

5,227

Although some terminal programs have support for splitting, you won't be able to access this functionality from the shell which is running in a different layer and doesn't have access to the software displaying it.

What you can do is use a terminal multiplexer such as GNU Screen or tmux that allow you to run multiple shells in "panes" inside a console.

Screen has been around since the dawn of time and works, but lately the project has falled into dis-repair and it's not being well maintained. Tmux is kind of a new player on the scene but the code is very clean and mature, it has a few more features than screen, and it's a good deal easier to learn and configure. Even though I still use screen out of force of habit, I highly recomend you use tmux for this.

You should be able to write a script that launches a tmux session, runs your streamripper code in one pane, waits for a condition, then adds another pane to the same session, displays it as a split screen, then runs mplayer in the new pane.

Share:
5,227

Related videos on Youtube

Peter.O
Author by

Peter.O

Updated on September 18, 2022

Comments

  • Peter.O
    Peter.O over 1 year

    I want to run streamripper in its own X Terminal (window), then split the terminal horizontally, and then run mplayer in the lower half.
    This is simple enough to do manually, but getting a script to do it eludes me.

    mplayer cannot be allowed to run immediately. It needs to wait for stream data, so a test for this would be better than "wait x seconds" (which is effectively what the manual method does.

    If the terminal is significant to this, anything will do, but I currently have installed konsole, gnome-terminal, and terminator (in Ubuntu)

  • tcoolspy
    tcoolspy almost 13 years
    If I have time later I'll add some sample code for a script that does something like this in tmux.
  • Peter.O
    Peter.O almost 13 years
    I'm quite new to screen, but I have tried it. My impression is that even when the console is closed, any running shell app keeps running. Is there some way to avoid this behaviour (maybe it is just a simple screen option), because I don't want to inadvertently have streamripper chugging away "windowless" because I forgot it was running as a screen session.. It can chew up a lot of data over a few days...
  • Peter.O
    Peter.O almost 13 years
    I've just read your info about tmux...I'll have a look at it...
  • tcoolspy
    tcoolspy almost 13 years
    @fred: I'm not sure about screen since I would never dream of killing a screen session if the terminal goes way, but I'm pretty sure I saw something like that when I was reviewing tmux docs. Basically an action to run when the session gets detached. You could always script this too ... it's easy to get a list of detached sessions and you could use a cron job to clean them up or warn you about them so you could choose to let them run or reconnect to close them.
  • Peter.O
    Peter.O almost 13 years
    Thanks... It seems that I got that minor phobia from when I first experimented with screen, when I actually wanted a detachment... I've briefly tried both screen and tmux again with this in mind.. and it seems fine; as you mentioned. It requires actual and obvious action on my part to either kill or detach the session,
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 13 years
    @fred splitvt provides terminal splitting without the other features of screen.
  • Peter.O
    Peter.O almost 13 years
    @gilles: Thanks, splitv is interesting, but I think it won't suit my particular requirement of being able to stop and start mplayer at will.. splitvt seems to be a one-hit-wonder; it just exits back to the parent terminal window... Even if it can do more, I may as well focus on tmux, which I'm having a hell of a time to get working; I haven't found the knack of running commands to individual windows from outside of tmux... yet.. I'll sleep on it :)
  • tcoolspy
    tcoolspy almost 13 years
    @fred: I know there are some questions on here that demonstrate both running commands and sending keystrokes to specific panes in tmux from a script. You might search around a little. I'll try to put something specific together for you if I can get time.