监视剪贴板,自动下载的脚本。支持很多种flash网站和很多种网盘。

软件和网站开发以及相关技术探讨
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

监视剪贴板,自动下载的脚本。支持很多种flash网站和很多种网盘。

#1

帖子 eexpress » 2010-12-24 22:36

代码: 全选

☛ cat bin/clip.pl 
#!/usr/bin/perl

use Gtk2 "-init"; 
use Encode;
$SIG{CHLD} = 'IGNORE';
$last="";
my $clip = Gtk2::Clipboard -> get(Gtk2::Gdk::Atom -> intern("PRIMARY", 0));
$clip -> signal_connect("owner-change" => \&deal);

Gtk2 -> main;
exit 0;

#----------------------------------
sub deal{
$_= $clip -> wait_for_text,"primary";
@url=m"http://[^\s]*"g;
if($#url<0){print "none url\n";return 1;}
foreach(@url){
my $t;
s/\W+$//;
next if $last eq $_;
$last=$_;
#----------------------------------
if(/v.youku.com/ || /tudou.com\/playlist/ || /v.ku6.com/ || /6.cn\/watch/ || /tv.sohu.com/){
	$t="下载flash资源";
	if(fork()==0){`xterm -e ~/bin/flash-down.pl $_`;exit;}
}
if(m"http://u.115.com/file/\w+"){
	$t="下载115资源";
	if(fork()==0){`xterm -e ~/bin/115_client $&`;exit;}
}
if(/rapidshare.com/ || /hotfile.com.*html/){
	$t="保存slimrat资源";
	if(fork()==0){`xterm -e ~/bin/slimrat $_`;exit;}
}
#----------------------------------
if($t){
print "$t ===> $_\n";
$t=decode("utf8",$t);
`$ENV{HOME}/bin/msg elvis.png  $t $&`;
} else {print "unrecognized url\n"; return 1;}
}
}
准备好你们的xterm(最好有xterm4.pl和xterm的热键隐藏进制)。省得鼠标乱划,开出无数的窗口。
● 鸣学
头像
ChenFengyuan
帖子: 770
注册时间: 2008-03-23 0:39

Re: 监视剪贴板,自动下载的脚本

#2

帖子 ChenFengyuan » 2010-12-24 22:41

:em70 SF
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 监视剪贴板,自动下载的脚本

#3

帖子 eexpress » 2010-12-24 22:50

胡说的药丸。我99%的脚本都是直接贴的。
● 鸣学
头像
ChenFengyuan
帖子: 770
注册时间: 2008-03-23 0:39

Re: 监视剪贴板,自动下载的脚本

#4

帖子 ChenFengyuan » 2010-12-25 0:19

:em11 更新
头像
icyomik
帖子: 76
注册时间: 2010-10-30 17:52

Re: 监视剪贴板,自动下载的脚本。支持很多种flash网站和很多种网盘。

#5

帖子 icyomik » 2010-12-25 11:48

能监视剪贴板?真不错,可惜,不懂Perl,漂过。
个人博客:http://blog.jtwo.me/
女友淘宝:http://icykiss.taobao.com/
你有什么不开心的事情,说出来让大家开心一下。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 监视剪贴板,自动下载的脚本。支持很多种flash网站和很多种网盘。

#7

帖子 eexpress » 2010-12-27 13:28

-@url=m"http://[^\s]*"g;
+@url=m"(?:http|mms|rtsp)://[^\s]*"g;


+if(/^mms/ || /^rtsp/){
+ if(fork()==0){`xterm -e mplayer $_`;exit;}
+}

增加了直接听电台的。
● 鸣学
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 监视剪贴板,自动下载的脚本。支持很多种flash网站和很多种网盘。

#9

帖子 eexpress » 2010-12-27 16:06

代码: 全选

 $last="";
+$enable=1;
+use File::Basename qw/basename dirname/;
+chdir dirname (-l $0?readlink $0:$0);
 my $clip = Gtk2::Clipboard -> get(Gtk2::Gdk::Atom -> intern("PRIMARY", 0));
 $clip -> signal_connect("owner-change" => \&deal);
 
+my $status_icon = Gtk2::StatusIcon->new;
+$status_icon->signal_connect('button-press-event',\&tray);
+$status_icon->set_from_file("clip0.png");
+$status_icon->set_visible(1);
+
 Gtk2 -> main;
 exit 0;
+#----------------------------------
+sub tray{
+$enable=$enable?0:1;
+$status_icon->set_from_file($enable?"clip0.png":"clip1.png");
+}
 
 #----------------------------------
 sub deal{
+return 0 if ! $enable;
 $_= $clip -> wait_for_text,"primary";
加到tray了。点下可以切换监视与否。


xterm可以自己改成gnome-terminal或者其他的嘛。
附件
clip.tar
(10 KiB) 已下载 96 次
56.png
● 鸣学
头像
leeaman
帖子: 30702
注册时间: 2007-02-02 18:14
系统: debian sid

Re: 监视剪贴板,自动下载的脚本。支持很多种flash网站和很多种网盘。

#10

帖子 leeaman » 2010-12-27 16:09

神,再努力,弄个迅雷出来 :em11
醉了星星,醉月亮●●●●●The Long Way To Go(*^_^*)
风间星魂
帖子: 490
注册时间: 2009-06-20 23:53

Re: 监视剪贴板,自动下载的脚本。支持很多种flash网站和很多种网盘。

#11

帖子 风间星魂 » 2010-12-27 17:42

问下神,fork后的flash_down.pl在那?还是我理解有问题? :em06
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 监视剪贴板,自动下载的脚本。支持很多种flash网站和很多种网盘。

#12

帖子 eexpress » 2010-12-27 20:34

http://git.ubuntu.org.cn/?a=blob&p=eexp ... sh-down.pl
or
http://code.google.com/p/flash-down/
在论坛有,可咋搜索不到了呢。

改了2个图标。
附件
clip0.png
clip0.png (993 Bytes) 查看 3967 次
clip0.png
clip0.png (993 Bytes) 查看 3967 次
clip10.png
clip10.png (1.12 KiB) 查看 3967 次
clip1.png
clip1.png (239 Bytes) 查看 3967 次
clip1.png
clip1.png (239 Bytes) 查看 3969 次
clip0.png
clip0.png (993 Bytes) 查看 3969 次
● 鸣学
头像
leeaman
帖子: 30702
注册时间: 2007-02-02 18:14
系统: debian sid

Re: 监视剪贴板,自动下载的脚本。支持很多种flash网站和很多种网盘。

#13

帖子 leeaman » 2010-12-27 20:36

晕,ee牌奶嘴 :em05
醉了星星,醉月亮●●●●●The Long Way To Go(*^_^*)
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 监视剪贴板,自动下载的脚本。支持很多种flash网站和很多种网盘。

#14

帖子 eexpress » 2010-12-27 21:46

死黑脸

重作2个。
附件
clip1.png
clip1.png (22.42 KiB) 查看 1871 次
clip0.png
clip0.png (26.86 KiB) 查看 1871 次
● 鸣学
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 监视剪贴板,自动下载的脚本。支持很多种flash网站和很多种网盘。

#15

帖子 eexpress » 2010-12-28 16:58

内嵌图片版本
附件
clip.tar
(20 KiB) 已下载 142 次
● 鸣学
回复