LinHES Forums

MPEG4 CD script w/ file selection
Page 1 of 1

Author:  Luthair [ Sat Aug 27, 2005 8:11 pm ]
Post subject:  MPEG4 CD script w/ file selection

I wrote this script to make playing mpeg4 discs easier, it pops an Xdialog menubox to allow you to select a file to play. Unfortunately Xdialog is all but unreadable on a standard television (I assume it would be fine on HDTV or monitors).

I attempted to create (or find) a GTK theme to increase legibility (offtopic, the Cthulhain fluxbox style is readable on TVs if anyone has been looking) but bg[NORMAL] doesn't affect GtkCLists (or at least Xdialogs implementation). My only other thought is to try to change the font but as my KnoppMyth box isn't attached to a monitor I can't read Xfontsel to get a XLFD font name. Another minor issue, the version of Xdialog included in R5A16 doesn't have ESC bound to the cancel button.

The codeblock could replace the contents of /usr/local/bin/ or a new button could be added to /usr/share/mythtv/knoppmyth.xml


mount /cdrom

let x=0
# Cycle through the files on the CDROM
for mediafile in $(ls -1 /cdrom)
  # Creating a string of the format <filenumber> <filename> ....
  dialogOptions=${dialogOptions}' '${x}' "'${filelist[x]}'" '

selected=`Xdialog --title "Media Selector" --stdout \
   --rc-file "bluebox.rc" --ok-label "PLAY" --cancel-label "RETURN"  --no-tags \
   --menubox "Choose a file" 0 0 0 $dialogOptions`

# If a file was selected in XDialog tell mplayer to play it

case $retval in
    /usr/bin/mplayer -fs -vo xv -cache 8192 /cdrom/${filelist[selected]}

umount /cdrom

The following makes the Xdialog prompt fit more with the default KnoppMyth theme. If you want to use it save the code block and add --rc-file "filename"

style 'blue_bg' {
        bg[NORMAL] = { 0.0, 0.3, 0.8 }
        fg[NORMAL] = { 0.0, 0.0, 0.0 }
        bg[SELECTED] = { 0.1, 0.1, 0.1 }
widget_class '*' style 'blue_bg'

Author:  cesman [ Mon Sep 12, 2005 5:47 pm ]
Post subject: 

Nice! The questions of course are can you make the text bigger and does it work with a remote? If we can get these resolved, I'll include it with the next release. The remote should be trivial....

Author:  tjc [ Mon Sep 12, 2005 9:33 pm ]
Post subject: 

My old timer brain says:
dialogOptions=$(ls -1 | awk '{printf("%d \"%s\" ", NR, $0)}')

and then:
selectedFile=$(ls -1 | sed -n ${selected}p)

But then again my brain is evil. :) :twisted: :D :mrgreen:

Author:  Luthair [ Sun Sep 25, 2005 12:37 pm ]
Post subject: 

I did find a way to fix the visibilty, unfortunately it isn't pretty, well the method anyway. I managed to set the background colour by modifying Xdialog source. I'll post what I've done incase someone else is interested but I might email the author the find out if it should be possible to change the background.

Both additions occur in the interface.c file, the first on line 1385

const GdkColor BLUE1 = { 0, 0x0000, 0x4C90, 0xB2A7 };

The next I squeezed in after line 1416 (if you've made the above addition)

 gtk_clist_set_background(clist, rownum, (GdkColor *) &BLUE1);

And a new RC file:

style 'blue_background' {
        bg[NORMAL] = { 0.0, 0.3, 0.8 }
style 'clist' {
        bg[SELECTED] = { 0.0, 0.3, 0.7 }
        fg[NORMAL] = { 0.1, 0.1, 0.1 }
        fg[SELECTED] = { 0.5, 0.5, 0.4 }
        font = "-*-*-bold-r-normal-*-*-180-*-*-*-*-*-*"
widget_class '*' style 'blue_background'
widget_class '*GtkCList*' style 'clist'

Just using the RC file works but I find the text a blurry on a white background.

tjc: this is the first and only bash script I've written so there are probably better solutions :)

Author:  Luthair [ Sun Sep 25, 2005 12:42 pm ]
Post subject: 

Oh, I forgot to mention remotes. I know it works using the ATI Remote with the kernel module.

Up/down: changes the selected row
Enter: Select current row
Esc: cancel

Xdialog v2.1.2 is required for escape to be bound to cancel.

Author:  borgednow [ Sat Nov 11, 2006 2:31 pm ]
Post subject:  Re: MPEG4 CD script w/ file selection

Luthair wrote:
The codeblock could replace the contents of /usr/local/bin/ or a new button could be added to /usr/share/mythtv/knoppmyth.xml

This is exactly what I was looking for, but is there any reason one can't add the button to the other menus instead of the knoppmyth.xml?

Author:  Girkers [ Sun Nov 12, 2006 4:24 pm ]
Post subject: 

You can add it to any menu you like, it is just a matter of personal taste.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group