📜 ⬆️ ⬇️

Workflow Viewer Series for Alfred

At the end of my previous article, I began to talk about how I was watching TV shows, but I decided that this was a topic for a separate note.


For those who do not know what Alfred

Alfred is Spotlight on steroids. He knows how little more than everything that Spotlight can do, plus, starting from the second version, he supports writing, as well as using workflows written by other people . That is, functionality extensions samopisnymi scripts. To write them, several scripting languages ​​are supported:


  • bash
  • zsh
  • php
  • ruby
  • python
  • perl
  • osascript
  • javascript

This article will discuss one of these extensions.


Looking ahead a bit, I want to show what we have in the end ...
When I find time to relax and turn on the serial, I launch Alfred, enter the "serials" and get back the list of downloaded ones.


Beauty, is not it?


ls -R serials folders
./ ../   [  ]/ [Alexfilm]/ []/  [Lostfilm]/  [Lostfilm]/  [Lostfilm]/ [Newstudio]/ ./  [  ]: ./ ../ 3 / 4 / 5 / ./  [  ]/3 : ./ ../ Breaking.Bad.s03e04.rus.eng.Kybik.v.Kybe.avi Breaking.Bad.s03e05.rus.eng.Kybik.v.Kybe.avi Breaking.Bad.s03e06.rus.eng.Kybik.v.Kybe.avi Breaking.Bad.s03e07.rus.eng.Kybik.v.Kybe.avi Breaking.Bad.s03e08.rus.eng.Kybik.v.Kybe.avi Breaking.Bad.s03e09.rus.eng.Kybik.v.Kybe.avi Breaking.Bad.s03e10.rus.eng.Kybik.v.Kybe.avi Breaking.Bad.s03e11.rus.eng.Kybik.v.Kybe.avi Breaking.Bad.s03e12.rus.eng.Kybik.v.Kybe.avi Breaking.Bad.s03e13.rus.eng.Kybik.v.Kybe.avi ./  [  ]/4 : ./ ../ Breaking.Bad.s04e01.k3.avi Breaking.Bad.s04e02.k3.avi Breaking.Bad.s04e03.k3.avi Breaking.Bad.s04e04.k3.avi Breaking.Bad.s04e05.k3.avi Breaking.Bad.s04e06.k3.avi Breaking.Bad.s04e07.k3.avi Breaking.Bad.s04e08.k3.avi Breaking.Bad.s04e09.k3.avi Breaking.Bad.s04e10.k3.avi Breaking.Bad.s04e11.k3.avi Breaking.Bad.s04e12.k3.avi Breaking.Bad.s04e13.k3.avi ./  [  ]/5 : ./ ../ Vo.vse.tyazkie.(5.sezon.01.seriya.iz.16).2012.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.02.seriya.iz.16).2012.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.03.seriya.iz.16).2012.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.04.seriya.iz.16).2012.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.05.seriya.iz.16).2012.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.06.seriya.iz.16).2012.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.07.seriya.iz.16).2012.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.08.seriya.iz.16).2012.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.09.seriya.iz.16).2013.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.10.seriya.iz.16).2013.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.11.seriya.iz.16).2013.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.12.seriya.iz.16).2013.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.13.seriya.iz.16).2013.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.14.seriya.iz.16).2013.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.15.seriya.iz.16).2013.x264.WEB-DL.720p.Kubik.v.Kube.mkv Vo.vse.tyazkie.(5.sezon.16.seriya.iz.16).2013.x264.WEB-DL.720p.Kubik.v.Kube.mkv ./[Alexfilm]: ./ ../ The.Code.E03.WEB-DLRip.Rus.Eng.AlexFilm.avi The.Code.E04.WEB-DLRip.Rus.Eng.AlexFilm.avi The.Code.E05.WEB-DLRip.Rus.Eng.AlexFilm.avi The.Code.E06.WEB-DLRip.Rus.Eng.AlexFilm.avi ./[]: ./ ../ 3 / 4 / ./[]/3 : ./ ../ Chuck.s03e01.HDRip.avi Chuck.s03e02.HDRip.avi Chuck.s03e03.HDRip.avi Chuck.s03e04.HDRip.avi Chuck.s03e05.HDRip.avi Chuck.s03e06.HDRip.avi Chuck.s03e07.HDRip.avi Chuck.s03e08.HDRip.avi Chuck.s03e09.HDRip.avi Chuck.s03e10.HDRip.avi Chuck.s03e11.HDRip.avi Chuck.s03e12.HDRip.avi Chuck.s03e13.HDRip.avi Chuck.s03e14.HDRip.avi Chuck.s03e15.HDRip.avi Chuck.s03e16.HDRip.avi Chuck.s03e17.HDRip.avi Chuck.s03e18.HDRip.avi Chuck.s03e19.HDRip.avi ./[]/4 : ./ ../ Chuck.s04e01.HDRip.avi Chuck.s04e02.HDRip.avi Chuck.s04e03.HDRip.avi Chuck.s04e04.HDRip.avi Chuck.s04e05.HDRip.avi Chuck.s04e06.HDRip.avi Chuck.s04e07.HDRip.avi Chuck.s04e08.HDRip.avi Chuck.s04e09.HDRip.avi Chuck.s04e10.HDRip.avi Chuck.s04e11.HDRip.avi Chuck.s04e12.HDRip.avi Chuck.s04e13.HDRip.avi Chuck.s04e14.HDRip.avi Chuck.s04e15.HDRip.avi Chuck.s04e16.HDRip.avi Chuck.s04e17.HDRip.avi Chuck.s04e18.HDRip.avi Chuck.s04e19.HDRip.avi Chuck.s04e20.HDRip.avi Chuck.s04e21.HDRip.avi Chuck.s04e22.HDRip.avi Chuck.s04e23.HDRip.avi Chuck.s04e24.HDRip.avi ./ [Lostfilm]: ./ ../ Mr.Robot.S02E03.1080p.rus.LostFilm.TV.mkv ./ [Lostfilm]: ./ ../ Dark.Matter.S02E04.720p.WEB.rus.LostFilm.TV.mp4 ./ [Lostfilm]: ./ ../ Wayward.Pines.S02E09.1080p.rus.LostFilm.TV.mkv ./[Newstudio]: ./ ../ Kingdom.s02e17.HDTV.720p.NewStudio.TV.mkv 

That is, the title and subtitle are taken from directory names. For example, the last line from the list above is the folder “Chuck [VGTRK]” with the subfolders of the seasons. If the folder name does not contain square brackets, its item in the Alfred list will not have a subtitle.


When we select the item of interest, the player starts up (in my case, VLC ) and begins to play the first unvisited series from the selected section. When playback ends, it closes itself (VLC has the --play-and-exit parameter). After that, the script offers to delete the scanned episode, asks how much you liked it on the five-point scale and notes it viewed with the corresponding rating on myshows.me . Notifies of success / failure. And, if the notification states that everything is fine, by clicking on it you can go straight to the page of the episode you just watched. Since version 1.5 , workflow does not require an account for myshows.me to fully function (meaning the corresponding functionality limitations).


For notifications, the terminal-notifier is used , which is included in the workflow.
The dependencies are the requests and alfred-workflow packages for python. Both are also included in the workflow.


Before use, workflow will offer to specify:



Bonuses


The following only works if you specify credentials with myshows.me


In addition to watching the series, made the opportunity to see a list of already published, but not yet watched from the account on myshows.me.


Unwatched


And also, the list of those that will be released relatively soon. Again using api myshows.me and a list of subscriptions.


Mr. Robot


TBBT


Entering the title of the series after the keyword, you can filter the output, and on the choice of the item in any of them, the page of the corresponding episode opens.


Link to workflow .
Implemented auto-update using GitHub Releases.


')

Source: https://habr.com/ru/post/305346/


All Articles