Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated way to import preexisting list via this plugin? #26

Closed
PaperOrb opened this issue Jun 8, 2022 · 12 comments
Closed

Automated way to import preexisting list via this plugin? #26

PaperOrb opened this issue Jun 8, 2022 · 12 comments
Labels
feature request New feature or request

Comments

@PaperOrb
Copy link

PaperOrb commented Jun 8, 2022

I'm sure many of us already had lists we kept of our movies/games/etc before looking at this plugin. Is there an automated way to import those lists into obsidian using this plugin? It looks great btw, thank you for making this.

@mProjectsCode
Copy link
Owner

@PaperOrb thanks :)

No there currently is no way to bulk import entries.
I could implement a bulk import by ID, but idk how useful that would be.

@mProjectsCode mProjectsCode added the feature request New feature or request label Jun 8, 2022
@GarDrastic
Copy link

It wouldn't cover bulk-importing, but perhaps an additional command: "add Media DB YAML to active note" or similar. Search relevant API as usual, and it'd then write (or overwrite as appropriate) into the YAML of the current note. (That may be far enough afield of what @PaperOrb is thinking that this should be a separate-related FR)

@PaperOrb
Copy link
Author

PaperOrb commented Jun 8, 2022

For my particular use case, I have a spreadsheet of media. We can already import each row as a separate note with autogenerated yaml based off of the columns via https://github.com/farling42/obsidian-import-json. People that literally just kept a list of stuff could also easily use external programs to turn their list into a CSV to work with farlings plugin.

With that in mind, I think @GarDrastic has the right idea, but with the caveat that it doesn't overwrite preexisting YAML, but rather appends to it. Also if this were to be implemented, I'd recommend setting it up to append media DB YAML to notes in folder rather than just the active note (for instance, I have several hundred notes I have to do this with).

edit: searching stuff by ID wouldn't work with myanimelist unless you already stored the numeric IDs inside your list. Also anything you typoed may not work (haven't used the media db plugin firsthand yet). So on that note, maybe also move anything that fails to find a result to a separate folder if possible for further processing, or maybe a cheaper operation would be appending a "#process-this-12345" tag to such files.

@mProjectsCode
Copy link
Owner

I see what you mean, but this is going to be difficult. If you e.g. have Star Wars Episode IV in your list and you want the plugin to find it automatically, then the results are going to be
image

And none of the options is actually what you want since the movie is named just Star Wars on OMDB.

@PaperOrb
Copy link
Author

PaperOrb commented Jun 9, 2022

Makes sense. Perhaps a semi-automated middle ground could be populating the API search with the title for each media note in a folder so the user doesn't have to type every title in. The plugin could pause on the dropdown part to let the user manually pick the show or give them a chance to redo the search before moving onto the next note?

mProjectsCode added a commit that referenced this issue Jun 10, 2022
@mProjectsCode
Copy link
Owner

@PaperOrb
I implemented your idea. You can test it if you want by cloning the repo and building the plugin yourself. (You need to right-click a folder to open the import modal)
I want to test it some more, before making a release.
Also, it is missing documentation.

@PaperOrb
Copy link
Author

PaperOrb commented Jun 11, 2022

@PaperOrb I implemented your idea. You can test it if you want by cloning the repo and building the plugin yourself. (You need to right-click a folder to open the import modal) I want to test it some more, before making a release. Also, it is missing documentation.

I'm amazed you did this and got it out so soon. It seems to be doing great with my anime list right now. A few things I noticed which you probably did as well:

  1. the cancel button just skips to the next show in the folder rather than actually cancelling out of the modal so you can go do something else. had to exit obsidian to get it to stop.
  2. entirely dependent on using your mouse right now (hotkeys like tab/enter won't proceed to the next show. you need to click a show title, then scroll down until the ok button appears and click it). Hotkeys could make testing+using this a heck of a lot faster ;)
  3. it generates entirely new media files rather than appending to the old ones, meaning your old data would need to be manually merged with the new file (for instance, I have some notes about certain media as well as an ETA field for when the sequel might drop). If you did decide to make it append, files could end up having duplicate yaml fields like the title, so the documentation could mention to check what data the API pulls ahead of time so users can change their spreadsheet/CSV column names to something unique before using the obsidian-import-JSON to create the "seed" files.

@mProjectsCode
Copy link
Owner

@PaperOrb

Hey, i did implement a cancel button that cancels the entire import and a skip button that only skips the current note.
Also, you can now append the original file and it will copy the metadata as well as the file content.
But I don't quite know how to make the modal keyboard accessible.

@PaperOrb
Copy link
Author

@PaperOrb

Hey, i did implement a cancel button that cancels the entire import and a skip button that only skips the current note. Also, you can now append the original file and it will copy the metadata as well as the file content. But I don't quite know how to make the modal keyboard accessible.

Awesome, I'll check it out today or tomorrow. As for the modal hotkeys, I asked over in the plug-dev channel on the discord in case this is something you feel like implementing. From what joethei said, you can use https://marcus.se.net/obsidian-plugin-docs/api/classes/Scope to register hotkeys on modal buttons, and the hotkeys should be unregistered after the modal closes. Here's some examples from his own code on using it: https://github.com/joethei/obsidian-rss/blob/223c2d0941357a6036e0e8bd57010169fb800d66/src/modals/ItemModal.ts#L46

@mProjectsCode
Copy link
Owner

Here's some examples from his own code on using it: https://github.com/joethei/obsidian-rss/blob/223c2d0941357a6036e0e8bd57010169fb800d66/src/modals/ItemModal.ts#L46

That looks good. I am going to try that tomorrow if I find the time.

@mProjectsCode
Copy link
Owner

I am still having some problems with it but for now, I have the arrow keys to navigate up and down in the list, the right arrow to select that result (I wanted to use space but that also closes the modal for some reason...) and enter to confirm.
Space or escape will cancel everything.
How does that sound?

mProjectsCode added a commit that referenced this issue Jun 14, 2022
@PaperOrb
Copy link
Author

I'm not through my entire anime backlog yet, but from my testing thus far it looks good. Some small typos in the modal: mata data and meta data should be metadata.

The hotkeys you setup are great imo. There's one minor issue where if there's too many search results (which has been pretty often in my case), you'll need to mousewheel scroll back to the top to see the topmost result. I'm not sure if there's a way to make the modal default to being scrolled to the very top for each new show or not.

For the documentation, it might be good to mention that users should split their shows up into separate folders for processing--that way if they decide to stop mid-session, they can more easily resume adding shows from where they left off. Otherwise, they'll start from the very beginning of their shows list the next time.

All that said, thanks for this nice addition. It looks fully functional ;)

mProjectsCode added a commit that referenced this issue Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants