Linux script to show airtimes in terminal

ghost44 wrote 9 years ago: 1

Have a question regarding to make a script that shows airtimes on selected shows like in terminal in Linux like this

Mr Robot

Next EP: Date/TIme

American Horror Stories

Next EP: Date/Time

I think you guys know what im after, im no scripting guru but if someone just can point me in the right direction maybe?

/ghost


gazza911 wrote 9 years ago: 1

Here you go, I've done it all for you (although feel free to update it & re-release it)

http://pastebin.com/LN1QufS9

All you need to do:

1. Copy the text into a new script file (NAME.sh)

2. chmod 755 NAME.sh

(Optionally) Add it to the path

Then call it like NAME.sh show1, show2, etc as shown here


gazza911 wrote 9 years ago: 1

Oops, I thought that I'd updated it, but I guess not.

I've made it so that you can enter in either the TVMaze ID or name (see the readme).

P.S I suggest you do some caching with this

badaboom wrote 9 years ago: 1

Hi gazza911

Indeed it's a good idea and it works well ! thanks again.

By doing some caching do you mean using the .bash_history file or something like that ?


gazza911 wrote 9 years ago: 1

badaboom wrote:
Hi gazza911
Indeed it's a good idea and it works well ! thanks again.
By doing some caching do you mean using the .bash_history file or something like that ?

I meant like to a database, but I guess it would depend on the actual usage of it;

If you're just using it for yourself to easily check when the next episodes are, you probably wouldn't need it.

If you're going to use it in a Linux Application where others might use it, you'd use a database to prevent the same show being requested from the API many times per day - returning the cached result instead - as it's unlikely to change that frequently.

badaboom wrote 9 years ago: 1

Ho yeah for my simple usage, I 'll stick with bash history or even create an alias .

The rest is out of my league for sure but thanks for the reply I appreciate the explanation anyway mate.

Try 30 days of free premium.