Remove broken cctv support and test
[clive.git] / lib / clive / HostFactory.pm
blob3214c0908d689469a98196f14d7fd8d653167154
1 # -*- coding: ascii -*-
2 ###########################################################################
3 # clive, command line video extraction utility.
5 # Copyright 2009 Toni Gundogdu.
7 # This file is part of clive.
9 # clive is free software: you can redistribute it and/or modify it under
10 # the terms of the GNU General Public License as published by the Free
11 # Software Foundation, either version 3 of the License, or (at your option)
12 # any later version.
14 # clive is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 # details.
19 # You should have received a copy of the GNU General Public License along
20 # with this program. If not, see <http://www.gnu.org/licenses/>.
21 ###########################################################################
22 package clive::HostFactory;
24 use warnings;
25 use strict;
27 use clive::Error qw(CLIVE_OK);
29 my @_hosts = (
30 [ "Youtube", qr|youtube.com|i,
31 # Sat Dec 11 2010: webm_*, 3gp_144p support found in Youtube.pm, website
32 # no longer seems to list them, however. Listing here only those formats
33 # that seem to still work.
34 "default|flv_240p|flv_360p|flv_480p|mp4_360p|mp4_720p|mp4_1080p|mp4_3072p"],
35 [ "Youtube", qr|last.fm|i, "see youtube formats" ],
36 [ "Google", qr|video.google.|i, "default|mp4" ],
37 [ "Sevenload", qr|sevenload.com|i, "default" ],
38 [ "Break", qr|break.com|i, "default" ],
39 [ "Liveleak", qr|liveleak.com|i, "default" ],
40 [ "Evisor", qr|evisor.tv|i, "default" ],
41 [ "Dailymotion", qr|dailymotion.com|i, "default|hq|hd" ],
42 [ "Vimeo", qr|vimeo.com|i, "default|hd" ],
43 [ "Spiegel", qr|spiegel.de|i, "default|vp6_928|vp6_576|vp6_64|h264_1400"
45 [ "Golem", qr|golem.de|i, "default|ipod|high" ],
46 [ "Ehrensenf", qr|ehrensenf.de|i, "default" ],
47 [ "Clipfish", qr|clipfish.de|i, "default" ],
48 [ "Funnyhub", qr|funnyhub.com|i, "default" ],
49 [ "Myubo", qr|myubo.com|i, "default" ],
50 [ "Buzzhumor", qr|buzzhumor.com|i, "default" ],
53 sub new {
54 my ( $class, $url ) = @_;
55 foreach (@_hosts) {
56 my ( $host, $re ) = @{$_};
57 if ( $url =~ /$re/ ) {
58 my $req = "clive/Host/$host.pm";
59 $class = "clive::Host::$host";
60 require $req;
61 return $class->new(@_);
66 sub dumpHosts {
67 my $self = shift;
68 foreach (@_hosts) {
69 my ( $host, $re, $fmts ) = @{$_};
70 printf( "%s\t%s\n", $1, $fmts )
71 if ( $re =~ /xsm:(.*?)\)/ && $re !~ /last\.fm/ );
73 exit(CLIVE_OK);
78 # The hour's getting late.