migaku-official / Migaku-Dictionary-Addon

Migaku Dictionary allows users to lookup word definitions, export definitions to their cards in real-time, hear word audio and see word frequency, etc. If you have an issue please report it in the "Issues" tab. Reponses to issues can be slow on GitHub, for faster support consider joining our Discord server through our Patreon page.
GNU General Public License v3.0
64 stars 24 forks source link

Card Exporter: Audio pasting not implemented for linux #42

Closed marcuscastelo closed 3 years ago

marcuscastelo commented 4 years ago

Type:

Environment:

I'm going to open a PR to resolve the issue:

Description: Currently there's no implementation for audio pasting on linux, even though everything else is already implemented

https://github.com/mass-immersion-approach/MIA-Dictionary-Addon/blob/48c2aebeb0e42dd36414ebb911c3c0cf83916f5a/src/midict.py#L742-L759

I'm not sure what kind of special treatment mac needs, so I didn't change it's code. But with few modifications, I could make it work on my environment:

        elif clip.endswith('.mp3') or clip.endswith('.mp3\n'):
                if isLin:
                    path = clip.replace("file://", '', 1)
                    temp, mp3 = self.moveAudioToTempFolder(path)
                    if mp3: 
                        self.image.emit([temp, '[sound:' + mp3 + ']', mp3]) 
                else:
                    if isMac:
                        try:
                            clip = str(self.mw.app.clipboard().mimeData().urls()[0].url())
                        except:
                            return
                    if clip.startswith('file:///') and clip.endswith('.mp3'):
                        try:
                            if isMac:
                                path = clip.replace('file://', '', 1)
                            else:
                                path = clip.replace('file:///', '', 1)
                            temp, mp3 = self.moveAudioToTempFolder(path)
                            if mp3:
                                self.image.emit([temp, '[sound:' + mp3 + ']', mp3]) 
                        except:
                            return
edulim commented 4 years ago

I actually have a patch that enables support for more image and audio formats as well as enabling that shortcut for linux. I might open a PR tomorrow, but I still need to do some tests.

marcuscastelo commented 4 years ago

@edulim I think it would be nice to also fix #41 in your PR, if you don't mind ofc. It's a simple case sensitivity issue.

KieranBrannigan commented 3 years ago

Thank you for supporting Migaku.

We have closed this issue since this it is >6 months old; if you feel that this issue is still a problem in the latest version, please comment below and we will reopen and begin investigating this issue.

We apologise that recently we didn't have the manpower to maintain these repos properly, but we aim to maintain them better from here on out.