Skip to content

Commit fcae4c1

Browse files
Adds files for the Dataview Movie Shelf
1 parent fc8937b commit fcae4c1

File tree

2 files changed

+404
-0
lines changed

2 files changed

+404
-0
lines changed

dataview-movie-shelf/README.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Dataview: Movie Shelf
2+
3+
## Overview
4+
5+
`Dataview: Movie Shelf` is a custom JavaScript view for the Dataview plugin in Obsidian. This script allows you to create an interactive movie shelf that displays and filters your media collection (movies and series) based on type, status, rating, genre, and platform. The view uses local storage to preserve your filter selections across sessions, providing a seamless and personalized browsing experience.
6+
7+
## Features
8+
9+
- Display and filter your media collection by type, status, rating, genre, and platform.
10+
- Preserves filter selections using local storage.
11+
- Provides an interactive and user-friendly interface for managing your movie shelf.
12+
13+
## Prerequisites
14+
15+
1. [Dataview](https://blacksmithgu.github.io/obsidian-dataview/) plugin installed and enabled in Obsidian.
16+
2. JavaScript queries enabled in the Dataview plugin settings.
17+
3. [Obsidian Minimal theme](https://minimal.guide/home) installed and enabled.
18+
19+
## Installation
20+
21+
1. Ensure that the Dataview plugin is installed and enabled in your Obsidian vault.
22+
2. Ensure that the Obsidian Minimal theme is installed and enabled in your Obsidian vault.
23+
3. Download the `view.js` file and place it in your desired location within your vault.
24+
4. Create or edit a note where you want to include the movie shelf view.
25+
5. At the top of your note, add the following helper classes to enhance the formatting for posters:
26+
27+
```markdown
28+
---
29+
cssclasses:
30+
- cards
31+
- cards-cover
32+
- cards-2-3
33+
- table-max
34+
---
35+
```
36+
37+
6. Add the following code block to the note to embed the custom view:
38+
39+
````markdown
40+
```dataviewjs
41+
const pages = dv.pages('#media');
42+
43+
await dv.view('path/to/view/folder', {
44+
container: this.container,
45+
pages: pages
46+
})
47+
```
48+
````
49+
50+
Replace `path/to/view/folder` with the actual path to the `view.js` folder in your vault.
51+
52+
## How It Works
53+
54+
The `Dataview: Movie Shelf` script initializes a table with filter options for type, status, rating, genre, and platform. It stores the selected filter options in local storage, ensuring that your preferences are remembered across sessions. The table dynamically updates to show the filtered results based on the selected criteria.
55+
56+
### Code Functionality
57+
58+
- **Initialization**: The script initializes local storage if not already set and retrieves stored filter settings.
59+
- **Filter Configuration**: It creates filter selectors for type, status, rating, genre, and platform, populating them with options and setting event listeners to update the view and local storage on change.
60+
- **Rendering**: The script renders the media table based on the selected filter criteria and updates the view dynamically.
61+
62+
### Inline Comments
63+
64+
The script is heavily commented to explain each part of the code, making it easy to understand and customize.

0 commit comments

Comments
 (0)