Efter diverse rokader hemma kom kontoret med MythTV servern att angränsa till sovrummet med platt tv. Så in med dvi kabel i tv och kör med bärbar och vnc som fjärr. Mythtv över vnc suger något enormt så jag började titta på mjukvarulösningar på fjärr utan att hitta något som passade. Såg sedan att man kunde öppna upp Myth för fjärrstyrning via telnet. Snickrade ihop en asful fjärr i python och gtk. Funkar utan några installationer i Ubuntu. För windows får man installera ptk och python men det funkar också. Om intresse finns kan jag lägga ut källkoden som består av två filer. Rappt och snabbt, så det är väl funktionaitet utan finess......
Ok har inte fått till hur man får till det i windows men källkoden kommer här. Två filer mythremote.py och mythremote.glade läggs i samma bibliotek. Lägg in din egen frontend med namn eller ip i mythremote.py på raden som börjar med "HOST = ". Startas från terminal med python mythremote.py alternativt att man gör mythremote.py körbart då kan man dubbelklicka och välja kör. I mythfrontend går man in under inställningar och generellt. I generellt väljer man sidan som heter generellt. I den finns en klickruta för fjärrstyrning. Klicka i den och starta om frontend så funkar fjärren.
mythremote.py
#!/usr/bin/env python import sys import telnetlib HOST = "bossen" # This is the name or ip adress of the frontend to control # Enable remote control of your frontend under settings general general where # you mark the box for remote control tn = telnetlib.Telnet(HOST,port=6546) try: import pygtk pygtk.require("2.0") except: pass try: import gtk import gtk.glade except: sys.exit(1) class mythremoteGTK: def __init__(self): #Set the Glade file self.gladefile = "mythremote.glade" self.wTree = gtk.glade.XML(self.gladefile) #Create our dictionay and connect it dic = { "on_quit_clicked" : self.btnquit_clicked, "on_menu_clicked" : self.btnmenu_clicked, "on_play_clicked" : self.btnplay_clicked, "on_pause_clicked" : self.btnpause_clicked, "on_rec_clicked" : self.btnrec_clicked, "on_i_clicked" : self.btni_clicked, "on_up_clicked" : self.btnup_clicked, "on_down_clicked" : self.btndown_clicked, "on_left_clicked" : self.btnleft_clicked, "on_right_clicked" : self.btnright_clicked, "on_volup_clicked" : self.btnvolup_clicked, "on_voldown_clicked" : self.btnvoldown_clicked, "on_ok_clicked" : self.btnok_clicked, "on_1_clicked" : self.btn1_clicked, "on_2_clicked" : self.btn2_clicked, "on_3_clicked" : self.btn3_clicked, "on_4_clicked" : self.btn4_clicked, "on_5_clicked" : self.btn5_clicked, "on_6_clicked" : self.btn6_clicked, "on_7_clicked" : self.btn7_clicked, "on_8_clicked" : self.btn8_clicked, "on_9_clicked" : self.btn9_clicked, "on_0_clicked" : self.btn0_clicked, "on_stop_clicked" : self.btnstop_clicked} self.wTree.signal_autoconnect(dic) def btnquit_clicked(self, widget): sys.exit() def btnmenu_clicked(self, widget): tn.write(b"key m\n") def btnstop_clicked(self, widget): tn.write(b"key escape\n") def btnplay_clicked(self, widget): tn.write(b"play speed normal\n") def btnpause_clicked(self, widget): tn.write(b"play speed pause\n") def btnrec_clicked(self, widget): tn.write(b"key r\n") def btni_clicked(self, widget): tn.write(b"key i\n") def btnup_clicked(self, widget): tn.write(b"key up\n") def btnup_clicked(self, widget): tn.write(b"key up\n") def btnleft_clicked(self, widget): tn.write(b"key left\n") def btndown_clicked(self, widget): tn.write(b"key down\n") def btnright_clicked(self, widget): tn.write(b"key right\n") def btnok_clicked(self, widget): tn.write(b"key enter\n") def btnchup_clicked(self, widget): tn.write(b"play channel up\n") def btnchdown_clicked(self, widget): tn.write(b"play channel down\n") def btnvolup_clicked(self, widget): tn.write(b"key f11\n") def btnvoldown_clicked(self, widget): tn.write(b"key f10\n") def btn1_clicked(self, widget): tn.write(b"key 1\n") def btn2_clicked(self, widget): tn.write(b"key 2\n") def btn3_clicked(self, widget): tn.write(b"key 3\n") def btn4_clicked(self, widget): tn.write(b"key 4\n") def btn5_clicked(self, widget): tn.write(b"key 5\n") def btn6_clicked(self, widget): tn.write(b"key 6\n") def btn7_clicked(self, widget): tn.write(b"key 7\n") def btn8_clicked(self, widget): tn.write(b"key 8\n") def btn9_clicked(self, widget): tn.write(b"key 9\n") def btn0_clicked(self, widget): tn.write(b"key 0\n") if __name__ == "__main__": hwg = mythremoteGTK() gtk.main()
mythtremote.glade
<?xml version="1.0"?> <glade-interface> <!-- interface-requires gtk+ 2.16 --> <!-- interface-naming-policy project-wide --> <widget class="GtkWindow" id="window1"> <property name="visible">True</property> <child> <widget class="GtkTable" id="table1"> <property name="visible">True</property> <property name="n_rows">11</property> <property name="n_columns">3</property> <property name="homogeneous">True</property> <child> <widget class="GtkButton" id="stop"> <property name="label" translatable="yes">stop</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_stop_clicked"/> </widget> </child> <child> <widget class="GtkButton" id="play"> <property name="label" translatable="yes">play</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_play_clicked"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> </packing> </child> <child> <widget class="GtkButton" id="rec"> <property name="label" translatable="yes">rec</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_rec_clicked"/> </widget> <packing> <property name="left_attach">2</property> <property name="right_attach">3</property> </packing> </child> <child> <widget class="GtkButton" id="pause"> <property name="label" translatable="yes">pause</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_pause_clicked"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> </packing> </child> <child> <widget class="GtkButton" id="1"> <property name="label" translatable="yes">1</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_1_clicked"/> </widget> <packing> <property name="top_attach">7</property> <property name="bottom_attach">8</property> </packing> </child> <child> <widget class="GtkButton" id="4"> <property name="label" translatable="yes">4</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_4_clicked"/> </widget> <packing> <property name="top_attach">8</property> <property name="bottom_attach">9</property> </packing> </child> <child> <widget class="GtkButton" id="7"> <property name="label" translatable="yes">7</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_7_clicked"/> </widget> <packing> <property name="top_attach">9</property> <property name="bottom_attach">10</property> </packing> </child> <child> <widget class="GtkButton" id="2"> <property name="label" translatable="yes">2</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_2_clicked"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">7</property> <property name="bottom_attach">8</property> </packing> </child> <child> <widget class="GtkButton" id="5"> <property name="label" translatable="yes">5</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_5_clicked"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">8</property> <property name="bottom_attach">9</property> </packing> </child> <child> <widget class="GtkButton" id="8"> <property name="label" translatable="yes">8</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_8_clicked"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">9</property> <property name="bottom_attach">10</property> </packing> </child> <child> <widget class="GtkButton" id="0"> <property name="label" translatable="yes">0</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_0_clicked"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">10</property> <property name="bottom_attach">11</property> </packing> </child> <child> <widget class="GtkButton" id="3"> <property name="label" translatable="yes">3</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_3_clicked"/> </widget> <packing> <property name="left_attach">2</property> <property name="right_attach">3</property> <property name="top_attach">7</property> <property name="bottom_attach">8</property> </packing> </child> <child> <widget class="GtkButton" id="6"> <property name="label" translatable="yes">6</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_6_clicked"/> </widget> <packing> <property name="left_attach">2</property> <property name="right_attach">3</property> <property name="top_attach">8</property> <property name="bottom_attach">9</property> </packing> </child> <child> <widget class="GtkButton" id="9"> <property name="label" translatable="yes">9</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_9_clicked"/> </widget> <packing> <property name="left_attach">2</property> <property name="right_attach">3</property> <property name="top_attach">9</property> <property name="bottom_attach">10</property> </packing> </child> <child> <widget class="GtkButton" id="quit"> <property name="label" translatable="yes">quit remote</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_quit_clicked"/> </widget> <packing> <property name="left_attach">2</property> <property name="right_attach">3</property> <property name="top_attach">10</property> <property name="bottom_attach">11</property> </packing> </child> <child> <widget class="GtkButton" id="volup"> <property name="label" translatable="yes">volume +</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_volup_clicked"/> </widget> <packing> <property name="top_attach">1</property> <property name="bottom_attach">2</property> </packing> </child> <child> <widget class="GtkButton" id="voldown"> <property name="label" translatable="yes">volume -</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_voldown_clicked"/> </widget> <packing> <property name="top_attach">2</property> <property name="bottom_attach">3</property> </packing> </child> <child> <widget class="GtkButton" id="i"> <property name="label" translatable="yes">i</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_i_clicked"/> </widget> <packing> <property name="left_attach">2</property> <property name="right_attach">3</property> <property name="top_attach">1</property> <property name="bottom_attach">2</property> </packing> </child> <child> <widget class="GtkButton" id="menu"> <property name="label" translatable="yes">menu</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_menu_clicked"/> </widget> <packing> <property name="left_attach">2</property> <property name="right_attach">3</property> <property name="top_attach">2</property> <property name="bottom_attach">3</property> </packing> </child> <child> <widget class="GtkButton" id="up"> <property name="label" translatable="yes">up</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_up_clicked"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">3</property> <property name="bottom_attach">4</property> </packing> </child> <child> <widget class="GtkButton" id="ok"> <property name="label" translatable="yes">ok</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_ok_clicked"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">4</property> <property name="bottom_attach">5</property> </packing> </child> <child> <widget class="GtkButton" id="left"> <property name="label" translatable="yes">left</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_left_clicked"/> </widget> <packing> <property name="top_attach">4</property> <property name="bottom_attach">5</property> </packing> </child> <child> <widget class="GtkButton" id="down"> <property name="label" translatable="yes">down</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_down_clicked"/> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> <property name="top_attach">5</property> <property name="bottom_attach">6</property> </packing> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <placeholder/> </child> <child> <widget class="GtkButton" id="right"> <property name="label" translatable="yes">right</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <signal name="clicked" handler="on_right_clicked"/> </widget> <packing> <property name="left_attach">2</property> <property name="right_attach">3</property> <property name="top_attach">4</property> <property name="bottom_attach">5</property> </packing> </child> </widget> </child> </widget> </glade-interface>
Redigerat av psGandalf, 20 januari 2010 - 21:26.