chhoumann / quickadd

QuickAdd for Obsidian
https://quickadd.obsidian.guide
MIT License
1.48k stars 135 forks source link

[FEATURE REQUEST] List Link the Cast #582

Open Xtremefaith opened 10 months ago

Xtremefaith commented 10 months ago

I want to capture person notes on individuals when generating movie notes from the movie.js script. I don't know JS very well but I thought this would have happened from the linkifyList() function but apparently doesn't (unless I'm doing something wrong). Currently this is my frontmatter template:

---
type: movie
poster: {{VALUE:Poster}} 
imdb: https://www.imdb.com/title/{{VALUE:imdbID}}
scoreimdb: {{VALUE:imdbRating}} 
length: {{VALUE:Runtime}} 
genre: {{VALUE:Genre}} 
year: {{VALUE:Year}} 
cast: {{VALUE:Actors}}
director: "[[{{VALUE:Director}}]]"
rating: 0
status: 
link: 
---

This produces the following movie note:

image

Notice how the Director is linked as expected, but the cast is just a plain CSV text. Ideally I would like a list of associated notes that can be recognized on the local graph as seen in the example below

image

I've tried a few variations of adjustments myself but nothing seems to work as expected so not sure if this is a feature request or just a plea for help. Hopefully what I'm requesting at least makes sense.

ellnix commented 10 months ago

The feature already exists, this is more of a support request. Your error was using {{VALUE:Actors}} which is just a CSV of the actors without linkifyList applied to them.

Instead please use {{VALUE:actorLinks}}, which is just {{VALUE:Actors}} with linkifyList applied to it.

You can see all of the similar "transformed" template values in movies.js:

    QuickAdd.variables = {
        ...selectedShow,
        actorLinks: linkifyList(selectedShow.Actors.split(",")),
        genreLinks: linkifyList(selectedShow.Genre.split(",")),
        directorLink: linkifyList(selectedShow.Director.split(",")),
        fileName: replaceIllegalFileNameCharactersInString(selectedShow.Title),
        typeLink: `[[${selectedShow.Type === "movie" ? "Movies" : "Series"}]]`,
        languageLower: selectedShow.Language.toLowerCase(),
    }

As you can see, there is also a directorLink you could use instead of creating the link manually. I hope this helped :smile:

image

P. S.: The vault name is not intended to offend anyone, that's just a near-vanilla obsidian vault I keep to test stuff.