A Bash Script To Watch Live TV Streams

Hi,

In this post I’ll introduce a very simple and basic Bash script, which uses VLC and a plain text file to let you watch Live TV streams of your favorite channels.

First of all, make sure you have VLC installed in your system.

Now to the script:

1
2
3
4
5
6
#!/bin/bash
#a script to watch TV streams with vlc
list_file=~/.tvlist
channel=$1
channel_url=`grep -w "#$channel" $list_file | cut -f3 -d#`
vlc -f "$channel_url" 2> /dev/null  #run vlc in Full Screen mode and don't display warnings


Save the file (I’ll assume you’ll call it wtv) in /usr/local/bin/ (or anywhere else. saving it in /usr/local/bin/ will allow you to call it from anywhere).

Make the file executable: chmod +x wtv

The script assumes you have the file .tvlist in your home directory, with the following format:

#channel_name  #channel URL  #comments

A line per channel.

Here is an example file:

#bbc  #mms://a1482.v373745.c37374.g.vm.akamaistream.net/7/1482/37374/498f5ea4/clipdownloads.bbc.co.uk/windowsmedia-acl/news/n5ctrl/summaries/world/bb/video/world_bb.wmv

#jazeera #mms://88.191.45.161/channel13 #arabic

#cnn #mms://a779.l2584224778.c25842.g.lm.akamaistream.net/D/779/25842/v0001/reflector:24778

#jazeera_en #mms://skinkers-livestation-client-d0ac-aljazeer-en.wm.llnwd.net/skinkers_livestation_client_d0ac_aljazeer_en

#islam_channel #mms://webcast.islamchannel.tv/IslamVideo

#haroon #mms://ib2.islambox.tv/harunyahyatv #haroon yahia tv


Save this file as .tvlist in your home directory (or wherever you want, but remember to modify the script).

Now you can run the script like this:

wtv cnn

The script is very basic, it assumes that the user gives it legal input. I may modify it in the future, but this is good for my needs for now. Any ideas will be appreciated.

P.S.

I’m thinking of making a large database of such streams and providing a script/program which will fetch the channels from this database. I don’t know if I’ll have time to do and maintain this alone, so please let me know if you’re interested to help. (It can be a Bash,  Python, CSh script, or a C, C++ program).

Enjoy :)

If you enjoyed this post, make sure you subscribe to my RSS feed!

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

No related posts.

Tags: , , , ,

Monday, February 9th, 2009 Command Line

2 Comments to A Bash Script To Watch Live TV Streams

  • tudor says:

    cool script i have only recently fully converted to ubuntu, i have a mediaportal windows pc, so i can config all my network streams with this. Next step maybe is for an interactive shell script so typing 1 would open bbc1 etc, sort of like the british tv thing you can get
    thanks though its a great start

  • ken says:

    none of these are working :( Do you know other live tv streams which are working for sure in VLC? Thanks.

  • Leave a Reply

    my email
    my photo
    Hi,
    My name is Amir Watad. I have a BSc. in biomedical engineering from The Biomedical Engineering school , Technion , Israel, and a BSc. in electrical engineering from The Electrical Engineering school , Technion , Israel.
    I'm a Verification Engineer in Mellanox Technologies Ltd.
    I love Linux, the Command Line and the OpenSource Community.
    I used to write Poems (Arabic) when I was able to find time for this.
    February 2009
    S M T W T F S
    « Jan   Mar »
    1234567
    891011121314
    15161718192021
    22232425262728
    SEO Powered by Platinum SEO from Techblissonline

    Twitter links powered by Tweet This v1.6.1, a WordPress plugin for Twitter.