-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c181e5a
commit 5e67543
Showing
8 changed files
with
190 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/usr/bin/env node | ||
import build from '../src/index.js'; | ||
|
||
await build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env node | ||
import chalk from 'chalk'; | ||
import program from 'commander'; | ||
import moment from 'moment-timezone'; | ||
import { table } from 'table'; | ||
import locations from '../src/config/index.js'; | ||
import { getShowtimes } from '../src/scraper.js'; | ||
import { daysFromNow } from '../src/lib/datetime.js'; | ||
import { toDisplayTime } from '../src/lib/utils.js'; | ||
|
||
program | ||
.version(process.env.npm_package_version) | ||
.option('-l, --location [loc]', 'Which location to display showtimes for', 'chicago') | ||
.parse(process.argv); | ||
|
||
const { kinos, timezone } = locations[program.location]; | ||
if (! kinos) { | ||
throw `Invalid location: "${program.location}"`; | ||
} | ||
|
||
const showtimes = await getShowtimes(kinos); | ||
const rows = [['Time', 'Kino', 'Title']].concat(showtimes | ||
.filter(daysFromNow(0, timezone)) | ||
.filter(({ showtime }) => { | ||
return showtime.isAfter(moment().subtract(1, 'hours')) | ||
}) | ||
.map(({ showtime, title, location }) => { | ||
return [toDisplayTime(showtime), chalk.cyan(location), chalk.cyanBright.bold(title)]; | ||
})); | ||
|
||
console.log(chalk.cyan.bold(' Today')) | ||
console.log(table(rows)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.