MOD UI creates a temp of changed pedalboard

(corrected explanation)
Hi, maybe it’s about to ask to mod ui programmers…
When saving a pedalboard, mod creates another preset, adding a number.


-about this behaviour, MULTICH01-58150 has the real last changes respect to MULTICH01, that remains at first save.
This creates a number of pedalboards with same name but different contents…someone with same clue?
with a high number of custom saves, this could cause a heavy pedalboard orgy :smiley:

on Web UI, pedalboards temp copies (in this case “MULTICH01” are named the same, not with this sequential number, so is difficult to understand which to remove…

we know:

1 Like

@C0d3man, do you know how to fix this problem? :wink:

If it can help, i share an opinion: One (or two) of possible reasons because mod Ui behaves not very well with zynthian snapshot. Snapshot recalls the pedalboard name, directly? this obviously should work at best if pedalboard name is not changed by Mod :joy::joy:

  1. to workaround this (in case this is unsolvable by mod authors) how difficult is to force snapshot to save the pedalboard with priority to modification date instead of name? Hope you understand, my english here becomes hard :blush:
    I Try with a workflow:
  • Pedalboard name: xyz
  • pedalboard changed; re-saved in its web interface.
  • pedalboard name changed internally as xyz-20467
  • zynthian, before saving snapshot, checks pedalboard name and creation date first, then saves the one with newest date and containing part of previous pedalboard’s name…

Yes i know, if mod doesn’t produce copies of same pedalboard, would Be easier :wink:

@jofemodo

As falkTX explained in the MOD forum, this is a feature and not a bug: https://forum.moddevices.com/t/pedalboard-file-confusion/1446/2

What can “we” do? One option is to use inotify in the background and delete the “older” file and rename the newer one.

Regards, Holger

1 Like

I knew there was a simpliest solution :joy::joy:

I took a look at (https://github.com/zynthian/)mod-ui. It seems that “pedalboard-backups” can be avoided with a small patch to /zynthian/zynthian-sw/mod-ui/mod/host.py:

[Pls use the diff in the next article]

A simple hack. I will test it the next days - or someone else will give it a try?

Regards, Holger

Crap! Just learned that os.rmdir will not remove non-empty directories. You have to use shutil.rmtree. So the patch should look like:

--- host.py.orig        2017-09-01 08:12:12.999999937 +0100
+++ host.py     2017-09-01 12:03:00.869996954 +0100
@@ -1860,13 +1860,8 @@
 
             # if trypath already exists, generate a random bundlepath based on title
             if os.path.exists(trypath):
-                while True:
-                    trypath = os.path.join(lv2path, "%s-%i.pedalboard" % (titlesym, randint(1,99999)))
-                    if os.path.exists(trypath):
-                        continue
-                    bundlepath = trypath
-                    break
-
+                shutil.rmtree(trypath)
+                bundlepath = trypath
             # trypath doesn't exist yet, use it
             else:
                 bundlepath = trypath
1 Like

Wow… i would try soon. But i Hope in making no mistakes in changes…

In fact you have only to replace the while True: at line 1860 with the both lines marked with the + sign. Be aware of indentation - Python is very restrictive!

sorry i didn’t understand. i have to replace all minus marked rows with only the two with plus?

'cause in this moment MOD does not work anymore (loads, shows patch list but hangs) and no web interface works

[update]
Mod reinstalled, works again, but before re-messing up… i wait :smiley:

anyway… i tried some things… after having saved the original host.py
to me nothing happened. After that i restored original host and tried some other things, such as reduce the random number to max 2 digits (01,09) …
By now a strange thing happens: Mod preloads empty at startup unconditionally :open_mouth: without being present on default snapshot.
Could be a good idea, having any snapshot with it loaded with more speed…
but i believe is a bug…

P.S: just in case : what about giving sequential numbering instead of random? function “randint” does this, which one is sequential? in this way at least the newest one is recognizable on list :wink:

regards

Crapcrapcrapcrapcrapcrap!

I don’t know why, but it seems not to be as easy as I thought. I tried several hours to get MOD-UI to overwrite the current pedalboard - it does not work. I removed all the code from the save() function and got an error when saving. I don’t know why.

def save(self, title, asNew):
    lv2path = os.path.expanduser("~/.pedalboards/")
    bundlepath = os.path.join(lv2path, "%s.pedalboard" % title)
    self.pedalboard_name     = title
    self.pedalboard_empty    = False
    self.pedalboard_modified = False
    self.save_state_to_ttl(bundlepath, title, title)
    save_last_bank_and_pedalboard(0, bundlepath)
    return bundlepath

Enough frustration for today.

Regards, Holger

1 Like

Yes, it was my same feeling last night at 3am :joy::roll_eyes:… Even python is totally unfamiliar to me. Changing random Number with sequential, maybe is a bit easier, maybe… i can’t figure how much easier… But seems that any change to code produces a Save error.

I know… :confounded:

After hadding the whole day kickbacks of several different types for different projects, I thought that a little bit more frustration with Python would be a nice ending of this day :smile:

But I think I got it working. Can you try?

cd /zynthian/zynthian-sw
mv mod-ui mod-ui.orig
git clone https://github.com/dcoredump/mod-ui
reboot

If you want go back, simply remove my mod-ui clone and rename the original one back.

Regards, Holger

ehm… i had to go back… mod web interface didn’t load, most of times zynthian freezed at default sound control page… etc… did it worked for you :open_mouth: ?

:disappointed_relieved: Yep - it does…

Ahhhh - F*CK! I forgot to push… plz try again…

same behaviour…:frowning:

Whaaaaaat??? There should be something like that inside mod-ui/mod/host.py (line 1849):

def save(self, title, asNew):
    titlesym = symbolify(title)[:16]

    # Save over existing bundlepath
    if self.pedalboard_path and os.path.exists(self.pedalboard_path) and os.
path.isdir(self.pedalboard_path) and \
        self.pedalboard_path.startswith(LV2_PEDALBOARDS_DIR) and not asNew:
        bundlepath = self.pedalboard_path

    # Save new
    else:
        lv2path = os.path.expanduser("~/.pedalboards/")
        trypath = os.path.join(lv2path, "%s.pedalboard" % titlesym)

        # if trypath already exists, generate a random bundlepath based on title
        if os.path.exists(trypath):
            while True:
                trypath = os.path.join(lv2path, "%s.pedalboard" % (titlesym))
                if os.path.exists(trypath):
                    rmtree(trypath)

The rmtree(trypath) is the new version…

Ok, i Will check in depth, later… but i don’t Remember i’ve read this, after cloning… Just in case will try to change manually… if it’s only this change