I think your command is not working correctly because “0” is still a “value” to the script and the %if{A,B,C} essentially says Does A have any value? If so, do B. Hopefully this helps!
No problem. One thing that has gotten me a few times is the paths: settings when having various albumtypes so to speak. (admittedly I’m still a beginner at beets). But make sure whatever path(s) you have set up either all match your format, or that your album is being correctly categorized to the right path setting. (I’ve definitely run into that problem before) Hopefully you figure it our, or someone else has more insight on it!
Nice. Glad you found something that works. Just something to keep an eye out for, if my memory serves, I stopped using rewrite and switched to substitute. The documentation says it doesn’t rewrite the tag, but I believe upon using any commands on already imported files will actually write the “Web” tag as opposed to “Digital Media” in your media tag. If that’s fine with you, then disregard and enjoy!