Ergebnis 1 bis 7 von 7
  1. #1
    Senior Mitglied
    Registriert seit
    27.03.2018
    Beiträge
    101
    Thanks (gegeben)
    22
    Thanks (bekommen)
    8
    Total Downloaded
    511,4 KB
    Total Downloaded
    511,4 KB
    ReceiverDanke

    Programming problem: Value is not overwritten

    Hi,

    I would like to change a value in the /etc/enigma2/settings file with python code.

    Current state: config.x.y.z=false


    The my program code:

    config.x.y.z = ConfigYesNo(default = False)

    config.x.y.z.value = True

    config.x.y.z.save()

    configfile.save()


    The value is not overwritten to True!

    Why?

    What do I do wrong?

    •   Alt Advertising

       

  2. #2
    Avatar von Papi2000
    Registriert seit
    20.04.2013
    Beiträge
    24.820
    Thanks (gegeben)
    4679
    Thanks (bekommen)
    9076
    Total Downloaded
    596,61 MB
    Total Downloaded
    596,61 MB
    ReceiverDanke
    Box 1:
    GB Q4K-SC / UE4K-SC / UE4K-C
     
     
    Box 2:
    GigaBlue Q-SSC / Q+-SSC
     
     
    Box 3:
    DM900uhd-SS / Vu+Duo
     
     
    Box 4:
    ZGemma H7/H9 SF8008
     
     
    Box 5:
    diverse andere . . .
     
     
    Don't change the file, but the value in the memory, and then make a sync.
    The /etc/enigma2/settings is read once at start of the system. The values change in memory, and while shutdown the content is written ti the file (just like the EPG-Data).
    Grüßle
    Ralf
    ---------------------------------------------
    Gigablue Quad4K-mixed, UE4K, Trio4K, Quad_Plus-SSC, UE_Plus-SC, X2/X3-SC, UltraUE-SC, ...
    Astra 19.2E UniCable & KabelBW, oATV/teamBlue
    (u.a.: DM900uhd,Vu+Duo,ZGemma H9Twin & H7S), PC-DVB-S/C/T, Xtreamer, BDP5200, Philips 24PFS4022/12, 65OLED855/12,UE32C5700, RPi3+
    ---- Einen Receiver kann sich jeder kaufen - Eine stabile E²-Box muß man sich verdienen! ----



  3. Thanks alec-cs bedankten sich
  4. #3
    Senior Mitglied
    Registriert seit
    27.03.2018
    Beiträge
    101
    Thanks (gegeben)
    22
    Thanks (bekommen)
    8
    Themenstarter
    Total Downloaded
    511,4 KB
    Total Downloaded
    511,4 KB
    ReceiverDanke
    Thanks!

    Okay, I don't change the file directly.
    Why isn't my example code working?

    If I use ConfigText(), it works...
    If I use ConfigYesNo, it doesn't work...


    I want to save the settings to a file. I'd like to save some parameters and then back it up at other times.
    Do you already have such a backup program or an example program?

    Where can I look at this or can you give an example?

    Look forward to your reply.

  5. #4
    Senior Mitglied
    Registriert seit
    27.03.2018
    Beiträge
    101
    Thanks (gegeben)
    22
    Thanks (bekommen)
    8
    Themenstarter
    Total Downloaded
    511,4 KB
    Total Downloaded
    511,4 KB
    ReceiverDanke
    Sorry...

    I would say that the code works, but the 'config.x.y.z' taken from the file is string not variable.

    So:

    x = 'config.x.y.z'
    x.value = True

    How can I do that?

    "x" be variable and i can use the value...
    How?

    I would like to use x dynamically with the data from the file.

  6. #5
    Senior Mitglied Avatar von s3n0
    Registriert seit
    02.01.2017
    Ort
    Slovakia
    Beiträge
    1.460
    Thanks (gegeben)
    91
    Thanks (bekommen)
    418
    Total Downloaded
    323,0 KB
    Total Downloaded
    323,0 KB
    ReceiverDanke
    Box 1:
    Vu+ Zero 4K
     
     
    Box 2:
    Vu+ Solo SE V2
     
     
    Box 3:
    Formuer F4-TURBO
     
     
    You have to show the code uhm ... how else can anyone advise you ?

    Show us the part of the python code in which you declare a function from the Enigma modules (config) at the beginning - for reading and writing. Also show part of the code where you are already storing or reading data via "config".

    Very good examples can be found on github server, from other enigma-plugin developers. Or you can directly study the plugins built into OpenATV image, such as:
    - OpenATV 6.3 github example for Picture Player plugin: enigma2/lib/python/Plugins/Extensions/PicturePlayer/ui.py
    - source code of the plugin main screen (user interface): enigma2/ui.py at 6.3 * openatv/enigma2 * GitHub

    There you can see how the "config" of enigma is declared and how it is used.

    I also develop plugins for Enigma in Python. Unfortunately, I can not show my python code on my github profile (because of a confidentiality agreement).

  7. Thanks alec-cs bedankten sich
  8. #6
    Senior Mitglied
    Registriert seit
    27.03.2018
    Beiträge
    101
    Thanks (gegeben)
    22
    Thanks (bekommen)
    8
    Themenstarter
    Total Downloaded
    511,4 KB
    Total Downloaded
    511,4 KB
    ReceiverDanke
    Thanks!

    I just wanted to simplify my program code.

    I wanted to use variable names from text. So I could cycle through the config lines all the time.

    Now:
    config.x.y.z1 = ConfigYesNo(default = False)
    config.x.y.z1.value = True
    config.x.y.z1.save()

    config.x.y.z2 = ConfigYesNo(default = False)
    config.x.y.z2.value = True
    config.x.y.z2.save()

    I would have liked this:

    x = ['config.x.y.z1','config.x.y.z2']

    for item in x:
    item = ConfigYesNo(default = False)
    item.value = True
    item.save()

    Maybe, somehow...

    I don't have to write as many program lines.
    I wanted to simplify...

    Thanks again.

    Alec

  9. #7
    Senior Mitglied Avatar von s3n0
    Registriert seit
    02.01.2017
    Ort
    Slovakia
    Beiträge
    1.460
    Thanks (gegeben)
    91
    Thanks (bekommen)
    418
    Total Downloaded
    323,0 KB
    Total Downloaded
    323,0 KB
    ReceiverDanke
    Box 1:
    Vu+ Zero 4K
     
     
    Box 2:
    Vu+ Solo SE V2
     
     
    Box 3:
    Formuer F4-TURBO
     
     
    I still don't understand what you want to do.

    I don't know what x, y, z are all about - what are they ? Are there any methods ? What are the objects ? How and where you defined them - I don't see, sorry.

    /////// EDIT :

    For your case, it would be better to use the "ConfigEnableDisable" class rather than the "ConfigYesNo" class. Other types for "config" can be found in the python code:
    enigma2/config.py at 6.3 * openatv/enigma2 * GitHub
    You can also find examples of use for specific types on the Internet.

    I guess I understand what you want to do. You want to define multiple configuration items in a loop.

    The question is, why exactly this way ? Isn't it better to use your own configuration file and save it to your plugin folder? Or if it is not a plugin, but a script, store your data file, for example, in the "/etc/enigma2" folder. To do this, you would have done an algorithm for loading and saving data in the data file.

    Beware of frequent rewriting of flash memory - protection from flash memory damage due to its longer lifetime - less memory cell rewriting. If you write a config once a day, it doesn't matter. But if you need to write data more than 100x throughout the day, it means unnecessary wear of internal flash memory in the set top box.

    Or what about using just one complete line for "config" instead of multiple configuration items? You can choose the shape yourself. It may look like something. You will manage the algorithm for loading a lot of data from one configuration line and also for storing it into one line (type "ConfigText" instead of "ConfigYesNo").

    I still don't know exactly what you need (where you want to deploy it, what is the purpose of your code or your plugin). Accordingly, it is more accurate to consult.


Stichworte

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:49 Uhr.
Powered by vBulletin® Version 4.2.5 (Deutsch)
Copyright ©2024 Adduco Digital e.K. und vBulletin Solutions, Inc. Alle Rechte vorbehalten.
Resources saved on this page: MySQL 5,56%
Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)
vBulletin Skin By: PurevB.com