Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Commit

Permalink
Added icefilms-shows and icefilms-episodes
Browse files Browse the repository at this point in the history
Shows is like movies, gives you a two part ID for the show.
You pass that to episodes and it lists them all for you with IDs.
You pass the ID to sources.
  • Loading branch information
psycotica0 committed Nov 21, 2011
1 parent 8d0afed commit ff306d2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions icefilms-episodes
@@ -0,0 +1,18 @@
#!/bin/sh

# This script takes a show ID (which has two parts for some reason) and lists the IDs of the episodes
show_id="$1"

episode_list_url="http://www.icefilms.info/tv/series/$show_id"

episode_list="$(curl -s "$episode_list_url")"

echo "$episode_list" | ruby -rnokogiri -e '
Nokogiri::parse(STDIN.read).at("span.list").search("a").each do |item|
if item["href"]
id = item["href"].sub(/[^0-9]*([0-9]+).*/,"\\1")
# Use to_i to only accept the numeric ids
puts id + " " + item.content if id.to_i != 0
end
end
'
19 changes: 19 additions & 0 deletions icefilms-shows
@@ -0,0 +1,19 @@
#!/bin/sh

# This script takes a prefix for a show and finds IDs for shows with that prefix
prefix="$1"

first_letter="$(echo "$prefix" | cut -c 1 | tr 'a-z' 'A-Z')"

show_list_url="http://www.icefilms.info/tv/a-z/$first_letter"

show_list="$(curl -s "$show_list_url")"

echo "$show_list" | ruby -rnokogiri -e '
Nokogiri::parse(STDIN.read).at("span.list").search("a").each do |item|
if item.content.downcase.start_with?(ARGV[0].downcase)
id = item["href"].sub(/[^0-9]*([0-9]+\/[0-9]+).*/,"\\1")
puts id + " " + item.content
end
end
' "$prefix"

0 comments on commit ff306d2

Please sign in to comment.