If you have a problem with the add-on add-on OpenInExternalEditor,Rename,Duplicate for Image,Audio,Video post in this thread. This way I get notified. If you make a new thread I might miss it.
Hello, Iām trying to open a card field in VSCode for Mac by setting the option to ācodeā or ācode --waitā with no luck. The textfield flashes but nothing happens. The only way it works is if I set āopen -tā in the options, but then VSCode doesnāt save back to the field.
Iām running Anki 2.1.28 and VSCode 1.47.3 on MacOS 10.14.6.
Thanks for your help!
The add-on āOpenInExternalEditor,Rename,Duplicate for Image,Audio,Videoā is meant to edit image, audio, and video files in an image editor like paint or audio editor like audacity. I would never use VSCode for this.
If you want to edit the html source code in VSCode I would use External Editor, if you want to edit some latex maybe text editor for Latex, the selection or html source (FORK).
You write about āthe optionā but my add-on has about 20 different config options so I donāt know what you mean. If you really want to use my add-on here I need more info like the whole config and exact steps you take and how this could work with VSCode.
Sorry Iām already using External Editor, I just posted in the wrong thread!
Hello, I want to edit image on Win10 with its built-in software"Photos" ,
but I canāt find its path, so I canāt add it to add-onās configuration.
Win10ās built-in software seems canāt to find their path.
Could you give me some help?
Thanks.
@hrdom: If you google for something like āwindows store app cliā you should find guides on how to find their path, see e.g. here.
But thatās not enough. The add-on passes the filename as a command line argument to the binary. But as far as I see app store apps often donāt take command line arguments. So even if you have find the path you might fail. I have no solution for this. I just use regular windows apps that I installed myself like paint .net.
Instead of my add-on maybe also have a look at Image Editor. I have never used this add-on but it seems to be independent from your local apps so that you donāt have the problem of calling an external binary.
Thank you.
Iāll have a look and decide to use regular windows apps if it has some problem.
Hello,
Iām using anki version 2.1.5 on Windows 10 and when I am trying to install your addon, itās says that either the code is invalid, or that itās not available for my version.
Is there a way to make it work ?
Thanks.
@benten: My add-on depends on features that were introduced in Anki 2.1.15. So 2.1.5 is too old. As an add-on uploader I can set compatibility info and I set on Ankiweb that only users with 2.1.15 or newer can install it. So you would need a newer Anki version to use my add-on.
Hi, i want to edit video and there is a video editing software on Windows 10, i donāt know if itās useful.Can you please recommend the software you use or give me some advice?
Thanks in advance.
[Bug report]
The image rename doesnāt handle Cyrillic characters. (Would submit a PR on Github, but it looks like the repo has been removedā¦) In any case, hereās the exception:
Traceback (most recent call last):
File "aqt/webview.py", line 526, in handler
File "aqt/editor.py", line 534, in <lambda>
File "/Users/alan/Library/Application Support/Anki2/addons21/1560623518/edit_insert_rename_duplicate.py", line 79, in <lambda>
editor.saveNow(lambda: func(editor, fname, type, field))
File "/Users/alan/Library/Application Support/Anki2/addons21/1560623518/rename.py", line 154, in rename
backup_changed_filenames(fname, newfilename)
File "/Users/alan/Library/Application Support/Anki2/addons21/1560623518/rename.py", line 123, in backup_changed_filenames
targetfile.write(f"{old}\t{new}")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 52-56: ordinal not in range(128)
[LATER]
I believe this addresses the exception (basically, just open the logging csv file with UTF-8 encoding.)
def backup_changed_filenames(old, new):
addon_dir_path = os.path.join(os.path.dirname(__file__))
renamed_file = os.path.join(addon_dir_path, "user_files", "renamed_files.csv")
with open(renamed_file, "a", encoding='utf-8') as targetfile:
targetfile.write(f"{old}\t{new}\n")
Also added a newline after each log entryā¦
@OjisanSeiuchi : Thanks for fixing this bug. I just uploaded a new version to ankiweb. If you find other problems or have other fixes please let me know. I removed the github repo because I often forgot to push changes I made and I figured no repo is better than a dated one (at least as long as you can get my most current version from ankiweb).
@ijgnd No worries - sometimes public repos can be a headache - different coding styles, trust factor, etc. Anyway, thanks for your contributions to the Anki community - really appreciate it. Happy holidays.
There is a bug in rename.py line 106 - Iām sorry I didnāt capture the stack trace; but the fix looks straightforward. The return type of mw.col.backend.find_and_replace()
is an OpChangesWithCount
and to increment that change count, must access its count
property, otherwise the increment assign operator fails. Hereās the entire method for _replace_all_sound_src()
: Functioning correctly on macOS/Anki 2.1.48. [LATER] - I guess thereās a similar issue with the corresponding img
method, too.
def _replace_all_sound_src(orig_name: str, new_name: str):
"new_name doesn't have whitespace, dollar sign, nor double quote"
old = f"[sound:{orig_name}"
new = f"[sound:{new_name}"
# Compatibility: 2.1.0+
n = mw.col.findNotes("[sound")
replaced_cnt = 0
if anki_point_version >= 28:
op_chg_cnt = mw.col.backend.find_and_replace(
nids=n,
search=old,
replacement=new,
regex=False,
match_case=False,
field_name=None,
)
replaced_cnt += op_chg_cnt.count
else:
replaced_cnt += findReplace(col=mw.col, nids=n, src=old, dst=new, regex=False, fold=False)
return replaced_cnt
@OjisanSeiuchi : Thanks for another fix. I just uploaded a new version. I made a small change so that old anki versions still work and tried to adjust it to the rename image function as you suggested.
I re-added the most recent code of this add-on to github at GitHub - ijgnd/anki21__OpenInExternalEditor_Rename_Duplicate_for_Image_Audio_Video . This should make it easier for you if you have any more improvements.
thereās maybe a problem with renaming in 2.1.55
reported in another thread by @ferophila : Is there an addon to reveal files in a file manger fom editor window? - #12 by ferophila
To narrow it down I posted two questions:
- Is there an addon to reveal files in a file manger fom editor window? - #13 by ijgnd
- Is there an addon to reveal files in a file manger fom editor window? - #14 by ijgnd
Maybe itās better to continue in this thread.
Is there a way to mass rename media files using as Input an Anki-field (e.g. sort field)?
not with my add-on. You could rename the files with a different tool e.g. using some regular expression and then update your notes in anki with the build-in search&replace feature that also supports regex. Iād certainly make a backup of all my files (and check that itās complete) before trying this ā¦
Is it possible to have a custom development?
How to contact you on this?
I need to mass re-name audio files.
The add-on should walk through an Anki-Card-Deck (Alternative: selected Anki-Notes in browser) and rename all sound-tags and itās corresponding files of a selectable anki-destination-field (selection by configuration file)
The new filename should be generated by a special Anki field calld ānewfilenameā.
Example: if the name of the sound tag and the corresponding filname is:
[sound:hypertts-d9d4315dcdea8dda366681a0e62a7dae5aaa2a7d6752a4f1044493e0.mp3]
and the content of the anki-field ānewfilenameā is
āmynewfilenameā, then it will be processed as follows:
- new filename: mynewfilename.mp3
- the sound tag of the anki-destination-field will be renamed to:
[sound:mynewfilename.mp3]
P.S. Best would be a general solution that also works with pictures.
@PulaArenaFighter : Your suggestion sounds useful. But at the moment I donāt have time. There are some coders that offer to write custom add-ons. E.g. in the forum thereās @abdo who can be hired via https://www.fiverr.com/abd_nh . I donāt know him though I already merged some of his code into another add-on of mine that he was paid to make by a third party.
I guess the source code of your proposed add-on will have very little overlap with the source code of my add-on so that maybe itās more future proof to make it into a standalone add-on.