• Home
  • Tools
    • Hardware >
      • Blog
      • Hardware Links
    • Software >
      • Blog
      • Software Links
  • Entertainment
    • Netcasts / Podcasts
    • Games >
      • Video Games >
        • Blog
      • Card / Tabletop >
        • Blog
      • RPGs >
        • Blog
    • Movies >
      • Blog
    • Music >
      • Blog
    • Books / Comics >
      • Blog
  • About
Geek Central

VLC in a Cron job on Linux

9/14/2012

1 Comment

 
Ok kiddos, I just setup Fedora on my Desktop and was looking into a way to make VLC be an "alarm clock" if you will. More like an alarm video player but hey who cares? I just wanted it to greet my inert, sleeping, lazy ass with awesomesauce in the morning. (Specifically, Empire Records Fan Edition in this case.)

So I made a bash script to handle this. One caveat, the script worked awesomely stand-alone. As a cron-job? Forget it. Cron's output of the console information was useful because vlc was barking about not finding a display to play to. So I set about looking for information through Google and a lot of it was old postings, so I felt it was possibly outdated so I checked only the last year and found some newer threads but nothing extremely useful. I looked over the older (3+ years old) threads and after lots of poking about and tinkering, found one that works as a cronjob and conveniently found it works as a regular executable script afterwards as well, so I can still easily debug any edits to the file linking.

#!/bin/bash

# DISPLAY=:0.0 is what allows vlc to display to the screen without error because your forcing it to a screen. Theoretically you should be able to output to an alternate screen on your local machine, potentially on another machine altogether.

DISPLAY=:0.0 vlc --rc-fake-tty -f file:///path/to/file/of/choice/or/link

That's it. Seriously. I lol'd at it's simplicity. Essentially, anything VLC can play, you just edit the line to accommodate that. I'm going to try a playlist because that would be easier to maintain seeing as I can make one in VLC and save it when I'm done, and just reference that in the script.

Ok, I mentioned in the comments of the script that you can output to another screen. Let me break that down for you:

DISPLAY is the variable your modifying.
DISPLAY:0.0 is set to your primary screen on your localhost.
DISPLAY:localhost.0 is the same thing. You could also set it to the hostname, but why would you???
DISPLAY:randomhostname.0 routes your output to the primary screen on another machine of choosing, can be useful if displaying information to someone else or sharing a video stream to someone else.

That being said, I do not believe it transmits audio, will test that later myself from my desktop to my laptop. It's late now, I must retire to my bedchambers. I will make an edit to this post later telling you of my results.

Edit: I found that doing it from the server to my machine was... unpleasant with VLC. The video stuttered, and no audio (I'm guessing it was playing locally.) However I could see this being useful with say a web browser and getting particular files and instead of using wget for everything you could use Chrome or Firefox instead. Just food for thought.

--Dustin Klingele (hackersarchangel)
1 Comment
vlc media player link
7/19/2013 07:06:51 pm

This is the most interesting and different site I really like your site,i suggest all my friends to visit your site and know more about research. Thank you keep on posting

Reply



Leave a Reply.

    Authors
    Kenneth Zieres

    Gamer, Tech, G33k, Nerd, Whatever tickles your fancy -_^

    Dustin Klingele
    Music is what moves me.
    As does the ability to tweak software and an OS to suit my needs.

    Archives

    October 2012
    September 2012

    Categories

    All
    Linux
    Multimedia

    RSS Feed

Powered by Create your own unique website with customizable templates.