Python_2  1.0
Functions | Variables
mplayertv Namespace Reference

Intended to play files using mplayer, and load subtitles automatically (ENG, POR and ESP). More...

Functions

def getLocale ()
 
def getOs ()
 
def getFormat (fbase, code1, code2)
 
def getOptions (base, ext)
 
def parseFileName (fname)
 
def getSubList (fbase)
 
def getParamList (player, path, ext, subtitles, movie, options)
 
def play (fplayer, path, ext, subtitles, movie, movieOriginal, lparam)
 
def getInitialDir ()
 
def selectFile ()
 
def getPlayer ()
 
def main (argv=None)
 

Variables

string __version__ = "$Revision: 1.71 $"
 
 ptype = os.P_WAIT
 
bool RECURSIVE = False
 
list languages = [['EN', '.HI'], ['PT', '_PT'], ['BR', '_BR'], ['ES', '.SP']]
 
list audio_file = [".flac", ".mp3", ".m4a", ".mpc", ".ogg", ".wav", ".wma"]
 
list video_file
 
string bindir = ""
 

Detailed Description

Intended to play files using mplayer, and load subtitles automatically (ENG, POR and ESP).

They can be switched during playback using the "j" key.

Subtitle files must have the same prefix of the movie file (without white spaces and weird characters, please) and a language code: my.movie.CD1.EN.srt, my.movie.CD1.PT.srt, my.movie.CD1.ES.sub, or my.movie.CD1.rar

The following empty files in the movie directory cause the script to pass the corresponding option to mplayer during playback: xvid, divx4, nocache, or fbyt (for a 4:3 aspect ratio).

Command Line Parameters – name of a file to play.

Note1: if more than one argument is passed, they are concatenated, because I suppose it is a file name with white spaces in this case.

Note2: it is possible to create a desktop icon and just drag the file to be played onto it. For windows, however, the desktop icon has to be edited, and "python" (supposed to be in the path) has to be appended before the "program name".

Author
Paulo Roma
Since
18/03/2007

Function Documentation

◆ getFormat()

def mplayertv.getFormat (   fbase,
  code1,
  code2 
)
Looks for a file in .sub or .srt format 

Keyword arguments:
fbase -- file path and base name (without extension)
code1 -- language code (BR,EN,ES,PT)
code2 -- alternative language code (_BR,.HI,.SP,_PT)

Referenced by getSubList().

◆ getInitialDir()

def mplayertv.getInitialDir ( )
Returns an initial directory for searching files.

References getOs().

Referenced by selectFile().

◆ getLocale()

def mplayertv.getLocale ( )

Referenced by getOs(), and main().

◆ getOptions()

def mplayertv.getOptions (   base,
  ext 
)
Gets option list, based on the presence of empty files

Referenced by main().

◆ getOs()

def mplayertv.getOs ( )

References getLocale().

Referenced by getInitialDir(), getPlayer(), main(), and selectFile().

◆ getParamList()

def mplayertv.getParamList (   player,
  path,
  ext,
  subtitles,
  movie,
  options 
)
Returns the parameter list.

Referenced by main().

◆ getPlayer()

def mplayertv.getPlayer ( )
Returns mplayer executable based on the OS.

References getOs().

Referenced by _07_alarme_class.main(), and main().

◆ getSubList()

def mplayertv.getSubList (   fbase)
Returns the subtitle parameter list.

References getFormat().

Referenced by main().

◆ main()

def mplayertv.main (   argv = None)

◆ parseFileName()

def mplayertv.parseFileName (   fname)
Breaks fname in path/base.ext

Referenced by main().

◆ play()

def mplayertv.play (   fplayer,
  path,
  ext,
  subtitles,
  movie,
  movieOriginal,
  lparam 
)
Plays the multimedia file.

References main().

Referenced by main().

◆ selectFile()

def mplayertv.selectFile ( )
Creates a tkFileDialog for selecting a file.

References getInitialDir(), and getOs().

Referenced by _07_alarme_class.main(), and main().

Variable Documentation

◆ __version__

string mplayertv.__version__ = "$Revision: 1.71 $"
private

◆ audio_file

list mplayertv.audio_file = [".flac", ".mp3", ".m4a", ".mpc", ".ogg", ".wav", ".wma"]

◆ bindir

string mplayertv.bindir = ""

◆ languages

list mplayertv.languages = [['EN', '.HI'], ['PT', '_PT'], ['BR', '_BR'], ['ES', '.SP']]

◆ ptype

mplayertv.ptype = os.P_WAIT

◆ RECURSIVE

bool mplayertv.RECURSIVE = False

◆ video_file

list mplayertv.video_file
Initial value:
1 = [".avi", ".flv", ".mkv", ".m4v", ".mov", ".mp4",
2  ".mpeg", ".mpg", ".nuv", ".ogm", ".VOB", ".wmv", ".ts"]