BeetsPluginXtractor icon indicating copy to clipboard operation
BeetsPluginXtractor copied to clipboard

WSL support

Open Bestfast opened this issue 10 months ago • 0 comments

Hi, I hacked some WSL support in the plugin, it's basically a one-liner

+++ "b/H:\\Users\\Salvatore\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\beetsplug\\xtractor/command.py"
@@ -246,8 +246,8 @@ class XtractorCommand(Subcommand):
         self._say("Input: {0}".format(input_path))
         self._say("Output: {0}".format(output_path))
         self._say("Profile: {0}".format(profile_path))
-
-        cmd_and_args = [extractor_path, input_path, output_path, profile_path]
+        self._say("Opt arg: {0}".format(self.config["opt_arg"]))
+        cmd_and_args = [extractor_path, "runp", "essentia_streaming_extractor_music", input_path, output_path, profile_path]
         self._say("Executing: {0}".format(' '.join(f'"{a}"' for a in cmd_and_args)))
         proc = Popen(cmd_and_args, stdout=PIPE, stderr=PIPE)
         stdout, stderr = proc.communicate()
@@ -284,7 +284,6 @@ class XtractorCommand(Subcommand):
             id=identifier,
             ext="json"
         )
-
         return os.path.join(self._get_extraction_output_path(), output_file)
 
     def _get_input_path_for_item(self, item: Item):
@@ -338,13 +337,9 @@ class XtractorCommand(Subcommand):
         if not self.config[extractor_key].exists():
             raise KeyError("Key '{}' is not defined".format(extractor_key))
 
-        extractor_path = self.config[extractor_key].as_filename()
-
-        if not os.path.isfile(extractor_path):
-            raise FileNotFoundError("Extractor({}) is not found!".format(
-                extractor_path))
+        extractor_path = self.config[extractor_key]
 
-        return extractor_path
+        return str(extractor_path)
 
     def show_version_information(self):
         self._say("{pt}({pn}) plugin for Beets: v{ver}".format(

the current config looks like this:

    auto: no
    dry-run: no
    write: yes
    threads: 12
    force: no
    quiet: no
    keep_output: yes
    keep_profiles: yes
    output_path: "G:\\Music\\Audiodata"
    essentia_extractor: 'Ubuntu.exe'
    opt_arg: 'runp essentia_streaming_extractor_music'
    extractor_profile:
        highlevel:
            svm_models:
                - /usr/share/mpplus-essentia/svm_models/danceability.history
                - /usr/share/mpplus-essentia/svm_models/gender.history
                - /usr/share/mpplus-essentia/svm_models/genre_rosamerica.history
                - /usr/share/mpplus-essentia/svm_models/mood_acoustic.history
                - /usr/share/mpplus-essentia/svm_models/mood_aggressive.history
                - /usr/share/mpplus-essentia/svm_models/mood_electronic.history
                - /usr/share/mpplus-essentia/svm_models/mood_happy.history
                - /usr/share/mpplus-essentia/svm_models/mood_sad.history
                - /usr/share/mpplus-essentia/svm_models/mood_party.history
                - /usr/share/mpplus-essentia/svm_models/mood_relaxed.history
                - /usr/share/mpplus-essentia/svm_models/voice_instrumental.history
                - /usr/share/mpplus-essentia/svm_models/moods_mirex.history

all of it is very, very scuffed but works, so if someone was ever interested in providing proper WSL support, this could be a starting point. I'd be interested in eventually do that myself, but sadly I don't have that much time on my end.

Bestfast avatar Feb 09 '25 12:02 Bestfast