Thursday, March 14, 2013

Playing videos intelligently with the Raspberry Pi

This is a script designed to intelligently and quickly find and play any of your videos.
This is the first script in my AUI (Alternative User Interface) Series.

I found myself getting frustrated with delving through lots of different folders in order to find a tv show or movie. To keep things well organized requires a hierarchical structure and a lot of work, which also makes it harder to browse to the file in the current GUI environment.

This script aims to locate and play your videos intelligently (right now it uses omxplayer but it could be easily ported to use vlc)

It uses regular expressions and a database to quickly find your movie or tv show.

Ex.
playvideo Movie title
will quickly find and play Movie title

playvideo -r -f Show title
will quickly find and play a random "Show title" episode

playvideo -s 01 -e 01 Show title
will quickly find and play "Show title" Season 1 Episode 1

To install, download the zip here and run the InstallAUISuite.sh file located in the Install folder. It will ask you the media location in the install script.
For example, mine is /media/ExternalHD/movies

You can also choose to manually install but if so, make sure you run with the -set option. ex. playvideo -set /media/ExternalHD/movies

For the next part of my AUI Series, autonomous downloads, click here.

The man page of playvideo is shown below:

NAME

playvideo - Locate and play a video[s]  

SYNOPSIS

playvideo [OPTIONS]... [FILENAME]  

DESCRIPTION

playvideo was developed to speed up/ease the playing of videos using omxplayer on the rasperry pi. It can play movies using a single search term or play tv shows using a season and episode search term. It is based off common video naming conventions and supports mp4, avi, mkv, mov, mpg, flv, m4v, and mp3 files. It also supports randomization. It is currently in Beta and kind of a hack. Any useful suggestions are welcome. It is important to run playvideo the first time with the -set option to create the database (especially if you are using external media). Note: If you used InstallAUISuite.sh, then this has already been done for you.

OPTIONS

-set, -Set MEDIA_ROOT
       Sets up the user parameters and creates a locate db for the media root. Ex. if all your videos are located in /media/Drive1/videos you would run:

      playvideo -set /media/Drive1/videos
-season, -Season, -s, -S NN
       Selects the asked file based off the given season number NN which has to be a two digit number to follow current conventions. Doesn't require an episode number.

      Ex. playvideo -Season 02 Show title

-episode, -Episode, -e, -E N/NN
       Selects the asked file based off the given episode number N or NN which can be a one or two digit number to follow current conventions. Requires a season number to be set as well.

      Ex. playvideo -S 02 -E 01 Show title

-random, -r
       Randomizes the output list of videos.

-first, -f
       Plays the first video from the list. Can be used with the random flag.

-multi, -m
       Plays all of the given list based on the query. Requires CTRL+C to quit given that it runs omxplayer individually for each file.


-continue, -c N
       Continues to play N number of matches. If given a season and episode, it will continue playing the next episodes in order until N episodes have been reached. If given the multiple flag, it will play matches until N has been reached.


-help, -h, --help
       Displays this page.


       The script can now handle names without quotes by replacing spaces with the regex * expression.

      Ex. playvideo Movie title


       The Set up function will also set up a cron job to update the db every day for new files. This will be done in the background and is fairly quick.
 

AUTHOR

Steven Hickson (help@stevenhickson.com) 

Consider donating to further my tinkering.


Places you can find me

No comments:

Post a Comment