GithubHelp home page GithubHelp logo

isamert / orgmdb.el Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 1.0 760 KB

An Emacs/org-mode watchlist manager and OMDb API client

License: GNU General Public License v3.0

Emacs Lisp 100.00%
emacs movies org-mode

orgmdb.el's Introduction

orgmdb.el

Tools for managing your watchlist in org-mode and some functions for interacting with OMDb API.

Installing

Download the orgmdb.el and put it into your load path, then you can use it by (require 'orgmdb).

Another option is to use use-package and quelpa:

(use-package orgmdb
  :ensure t
  :quelpa (orgmdb
           :fetcher github
           :repo "isamert/orgmdb.el"))

Planned to be released on MELPA.

Demo

Displaying detailed movie information

https://user-images.githubusercontent.com/8031017/154753759-5ddaca00-3245-433f-9c3a-13c1c48f5c01.gif

Filling movie metadata

https://user-images.githubusercontent.com/8031017/154753756-5108bb8d-4dd0-457c-95df-9bae7a7ad17c.gif

Opening a local video

https://user-images.githubusercontent.com/8031017/154756033-318e5482-67e5-4ae4-a40e-c29375faed58.gif

Configuration

You need get yourself an API key to be able to use this package, see OMDb website. After getting yourself an API key, you can start using.

(setq orgmdb-omdb-apikey "YOUR-API-KEY")

Interactive usage

orgmdb.el offers several actions that you can call upon a movie/show/episode objects. These actions can be accessed by calling orgmdb-act function. A movie/show object is simply an org header with a tag, like the following:

* Crouching Tiger, Hidden Dragon (2000) :movie:
* Succession (2018-) :series:

You can put your cursor on one of the headers and call orgmdb-act. From the menu, you can select Fill movie properties to pull movie metadata under the :PROPERTIES: drawer of the selected header. From now on, you can use other actions defined under the orgmdb-act menu.

An episode object is a special one, because it can be either a header containing an episode marker object (meaning something like S02E05) with an :episode: tag:

* Succession (2018-) :series:
** S01E08 - Prague :episode:

or it can be simply an episode marker object:

* Succession (2018-) :series:
- ...
- I watched S01E08 yesterday and it was cool.
-           ^^^^^^ here is our episode marker object

In both cases, if your cursor is on the episode object, orgmdb-act will understand the context and show the actions accordingly.

Here are the actions and their simple explanations:

Fill properties
Fill the metadata of the current object. See `orgmdb-fill-property-list` variable to control which properties gets filled in.
Show detailed info
Open a nicely formatted org buffer and display a detailed info of the current object with a small poster of it.
Select an episode...
Select an episode of the currently focused show and act on it.
Open local video
Find the local video file containing the current movie/show/episode. It searches video files under orgmdb-video-dir and looks for files with orgmdb-video-file-extensions extensions. orgmdb-player-function is used for opening the video file.

Defining new actions

You can define new actions for movie/show/episode objects using orgmdb-defaction function. See the following example:

(orgmdb-defaction
 :name 'show-info
 ;; ^ Define a unique name for this action
 :definition "Show title of the currently selected object"
 ;; ^ User-facing definition of the action
 :on '(movie show episode)
 ;; ^ On what objects this action should appear?
 :act (cl-function
       (lambda (type &key title imdb-id episode &allow-other-keys)
         (message "The title is %s, imdb-id is %s" title imdb-id))))

Library usage

(let ((movie (orgmdb :title "in the mood for love")))
  (format "Movie name: %s, Year: %s, Plot: %s"
          (orgmdb-title movie)
          (orgmdb-year movie)
          (orgmdb-plot movie)))
(orgmdb :title "thinking of ending things" :year 2020)

;; This returns something like this:
((Title . "I'm Thinking of Ending Things")
 (Year . "2020")
 (Rated . "R")
 (Released . "04 Sep 2020")
 (Runtime . "134 min")
 (Genre . "Drama, Thriller")
 (Director . "Charlie Kaufman")
 (Writer . "Charlie Kaufman (written for the screen by), Iain Reid (based on the book by)")
 (Actors . "Jesse Plemons, Jessie Buckley, Toni Collette, David Thewlis") (Plot . "Full of misgivings, a young woman travels with her new boyfriend to his parents' secluded farm. Upon arriving, she comes to question everything she thought she knew about him, and herself.")
 (Language . "English, Spanish")
 (Country . "USA") ...)

orgmdb.el's People

Contributors

isamert avatar orgtre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

taingra

orgmdb.el's Issues

orgmdb--open-video assumes no spaces, no \, no ', ...

I noticed that this was packaged in Guix, and took a look at the source code.

More specifically, I noticed:

        (format "fd --absolute-path --type=file %s --glob '*%s*%s' %s"
                (concat "--extension " (s-join " --extension " orgmdb-video-file-extensions))
                it
                (if (not (s-blank? episode))
                    (concat (s-downcase episode) "*")
                  "")
                video-dir)))

The apparent (unverified!) issue with this code, is that it treats everything as a single string, without any quoting -- consider, e.g., the situation where 'video-dir' contains spaces (e.g. if it's ~/My Videos) or && (~/Videos && Other stuff).

One method to solve this, is to quote the arguments. However, I noticed Emacs has another method for starting processes, wherein every argument is passed as separate strings, which avoids quoting issues entirely, in https://www.gnu.org/software/emacs/manual/html_node/elisp/Asynchronous-Processes.html and https://www.gnu.org/software/emacs/manual/html_node/elisp/Synchronous-Processes.html (with :command and 'args' respectively).

wrong request url?

I got an error message in emacs:
Wrong authorization used for http://www.omdbapi.com/?apikey=xxxxxxx&t=I%27m%20Thinking%20of%20Ending%20Things&y=nil&type=movie
So I tried http://www.omdbapi.com/?apikey=xxxxxxx&t=I%27m%20Thinking%20of%20Ending%20Things&y=nil&type=movie in the browser and it failed to fetch, but http://www.omdbapi.com/?t=I%27m%20Thinking%20of%20Ending%20Things&y=nil&type=movie&apikey=xxxxxxx works for me.
Is it possible to fix this problem?

Fill movie properties from IMDb id?

I really like this package! Is there a way to fill movie properties using the unique IMDb id? I'm unable to get orgmdb identify the right entry in some cases, typically involving series episodes (example).

Error, can't do anything...

Contacting host: www.omdbapi.com:80
Decrypting /home/dave/.emacs.d/.local/etc/authinfo.gpg...done
error in process filter: epa-file-insert-file-contents: Opening input file: Decryption failed,
error in process filter: Opening input file: Decryption failed,

Export entry as bibtex

Great!

I was thinking when I saw this mode that it might be useful to have a yank-as-bibtex-entry creating a properly formatted snippet of a bibtex entry (which can be then pasted in an ebib buffer, or bib file etc.)

Tweak fill movie detail settings

Hello, it's not clear from your README how to adjust what property gets filled in with "Fill properties". I'd like to also download the cover and attach it to the header so it can be displayed when you expand the entry.

Is this possible?

I'm not very familiar with LISP so any direction would be helpful. Thanks...

I wanted to submit this as a feature request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.