LinHES Forums http://forum.linhes.org/ |
|
MPEG4 CD script w/ file selection http://forum.linhes.org/viewtopic.php?f=3&t=5823 |
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/divx.sh or a new button could be added to /usr/share/mythtv/knoppmyth.xml Code: #!/bin/bash mount /cdrom let x=0 # Cycle through the files on the CDROM for mediafile in $(ls -1 /cdrom) do x=${x}+1 filelist[x]=$mediafile # Creating a string of the format <filenumber> <filename> .... dialogOptions=${dialogOptions}' '${x}' "'${filelist[x]}'" ' done 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 retval=$? case $retval in 0) /usr/bin/mplayer -fs -vo xv -cache 8192 /cdrom/${filelist[selected]} esac 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" Code: 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: Code: dialogOptions=$(ls -1 | awk '{printf("%d \"%s\" ", NR, $0)}') and then: Code: selectedFile=$(ls -1 | sed -n ${selected}p)
But then again my brain is evil. |
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 Code: const GdkColor BLUE1 = { 0, 0x0000, 0x4C90, 0xB2A7 }; The next I squeezed in after line 1416 (if you've made the above addition) Code: gtk_clist_set_background(clist, rownum, (GdkColor *) &BLUE1); And a new RC file: Code: 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. Keys: 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/divx.sh 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 http://www.phpbb.com/ |