View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 7 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Sat Aug 27, 2005 8:11 pm 
Offline
Joined: Thu Apr 28, 2005 4:00 pm
Posts: 37
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'


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 12, 2005 5:47 pm 
Offline
Joined: Fri Sep 19, 2003 7:05 pm
Posts: 5088
Location: Fontana, Ca
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....

_________________
cesman

When the source is open, the possibilities are endless!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 12, 2005 9:33 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
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. :) :twisted: :D :mrgreen:


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 12:37 pm 
Offline
Joined: Thu Apr 28, 2005 4:00 pm
Posts: 37
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 :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 25, 2005 12:42 pm 
Offline
Joined: Thu Apr 28, 2005 4:00 pm
Posts: 37
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.


Top
 Profile  
 
PostPosted: Sat Nov 11, 2006 2:31 pm 
Offline
Joined: Wed Aug 23, 2006 3:07 pm
Posts: 339
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?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 12, 2006 4:24 pm 
Offline
Joined: Tue Mar 22, 2005 9:18 pm
Posts: 1393
Location: Brisbane, Queensland, Australia
You can add it to any menu you like, it is just a matter of personal taste.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu