[+all Plugins] Ihad enigma2 Plugin Tutorial

  • Hi
    could some one please help me


    i am trying to made some change on "lesson 08 Download a picture" Tutorial "
    at first i want to rename the downloaded picture then i want to use " pngquant -force 256 " command to make change on downloaded picture before show it .


    sorry for my English

    • Official Post
    Python
    class getPicfromUrl(object):
    	def __init__(self, session, url=None, path=None):
    ...


    edit value here:

    Code
    def main(session, **kwargs):
    	getPicfromUrl(session,"http://www.somewhere/images/bla.png", "/tmp/yourname.png")
  • thanks
    but
    " http://www.tehrantraffic.com/trafficmap/ShowImage.asp "
    cannot be show by "lesson 08 Download a picture" Tutorial " so i use this sh file



    #!/bin/sh



    echo $LINE
    echo Tehran Traffic Map Downloader
    echo Please Wait
    echo $LINE


    wget http://www.tehrantraffic.com/trafficmap/ShowImage.asp -O /tmp/Tehran.png > /dev/null 2>&1
    pngquant -force 256 /tmp/Tehran.png > /dev/null 2>&1
    rm -rf /tmp/Tehran.png > /dev/null 2>&1
    mv -f /tmp/Tehran-fs8.png /tmp/Tehran.png > /dev/null 2>&1


    echo $LINE
    echo Downloaded , Now You Can See Tehran.png Traffic Map In /tmp !
    echo ******
    echo $LINE


    exit 0


    to convert and see the picture


    could you please help me how to do it in py ?

  • I got problem with displaying PNG on SubsDownloader widget.


    Try to convert (in bash or python) downloaded PNG to JPG.

    • Official Post

    http://docs.python.org/library/os.html


    read this page, to translate your shell to python

  • Thanks, but i don't know anything about python.


    It would be great if someone can do this modify.

  • Quote

    Originally posted by KAMSAT10
    Glimpser, i am just a little bit better than you in python. Combining lessons 7&8 i made this for you and myself ;), i believe we both should thank Emanuel for his great tutorial.


    :hurra:


    I must appriciate your swift and effective respond to my problem & it works completly.
    thank you so much for care enough to respond so quickly. again



    And I also want to thank emanuel for his usefull tutorial & sugestion.

  • Erstmal viele Dank für das Tut!


    Habe gleich ne Frage:
    Ich habe ein script, welches meinen Kartenleser neustartet.


    Kann ich z.B. in Kapitel 2 kann ich nach
    from Plugins.Plugin import PluginDescriptor
    einen befehl definieren
    cmd = "/usr/script/start.sh"


    und dann in der Massage aufrufen? z.b.:
    def myMsg(self):
    print "\n[HalloWorldMsg] OK pressed \n"
    self.session.open([cmd],MessageBox,_("re-start wird ausgeführt"), MessageBox.TYPE_INFO)


    oder wie kann ich mein script einbinden? Möchte nicht die Konsole öffnen lassen sondern einfach Startscreen und Bestätigung.


    Vielen Dank für eure Unterstützung.


    mar72der

  • i want to remove tmp file before exit but i cannot
    can some one help me what is the problem ?


    def cancel(self):
    print "[PictureScreen] - cancel\n"
    self.remove("/tmp/file.tmp")
    self.close(None)



    without "self.remove("/tmp/tehran.tmp")" it work but file.tmp will remain in tmp


    what is the correct format ?

  • import shutil


    simple version

    Code
    shutil.rmtree("/tmp/file.tmp")


    or with error output


    Code
    def deleteTempDir(self):
            try:
                shutil.rmtree("/tmp/file.tmp")
            except Exception, e:
                print "[myplugin] ERROR deleting temp file:", e

    dau bleibt dau, daran kann der beste dev nichts ändern<br><br>

  • wie lassen sich checkboxen realisieren ?

  • schau dir mal unter components in der filelist.py die klasse multifileselectlist an

    dau bleibt dau, daran kann der beste dev nichts ändern<br><br>

  • Hello!
    Thank you for the tutorial, really useful!!!


    I have a question, I have modified lession 05 in order to run my script:


    Bash
    #!/bin/sh
    ssh -i /home/root/.ssh/privatekey root@192.168.1.1 '/jffs/switch A 1 on v; exit'


    and if I run the script it actually starts connects to the ssh server, log in (with privatekey) and run the command correctly.


    If I modify the lesson 05 in order to run the script.. the script starts, but it blocks because it says that 192.168.1.1 is not in the know_host file..
    How can this be possible since if I run the script it works and if i try to connect using ssh root@192.168.1.1 does not ask me to add to known_host?


    Thank you for your support,
    dk


    EDIT: Solved I copied known_hosts in /.ssh/

    Edited once, last by d82k ().

  • Das Tutorial ist echt nützlich. EIn sehr gute Dokumentation der enigma2-API.


    Aber: Könnte bitte mal jemand das Plugin als _all.ipk (arch="all";) packen?


    Python ist plattformübergreifend und nicht alle haben eine Box mit einer mipsel-Architektur. (Ich habe ppc.)


    Edit: Selbst gemacht. Sollte funktionieren.
    Edit2: Klappt wohl doch nicht.


    Edit3: Jetzt klappt es wirklich! Juhu!

  • Hello,
    Thanks for this useful tutorial!
    I have a question:
    I want to write a plugin that copy file at given times of the day (configurable). Should I to handle this at the level of plugin code, or should I handle this using a Plugin + cron job?


    Thanks again