Skip to content

Commit

Permalink
fix for new release go code
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinwatt committed Feb 17, 2011
1 parent 23ab438 commit cd75c4a
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 50 deletions.
6 changes: 3 additions & 3 deletions configfile.go
Expand Up @@ -449,11 +449,11 @@ func (c *ConfigFile) GetInt(section string, option string) (value int, err os.Er
}


// GetFloat has the same behaviour as GetString but converts the response to float.
func (c *ConfigFile) GetFloat(section string, option string) (value float, err os.Error) {
// GetFloat has the same behaviour as GetString but converts the response to float64.
func (c *ConfigFile) GetFloat(section string, option string) (value float64, err os.Error) {
sv, err := c.GetString(section, option);
if err == nil {
value, err = strconv.Atof(sv)
value, err = strconv.Atof64(sv)
}

return value, err;
Expand Down
12 changes: 6 additions & 6 deletions httpget.go
Expand Up @@ -5,6 +5,7 @@ import (
"strings"
"io"
"io/ioutil"
"os"
)

type readClose struct {
Expand All @@ -14,13 +15,12 @@ type readClose struct {

func hasPort(s string) bool { return strings.LastIndex(s, ":") > strings.LastIndex(s, "]") }

func Get(url string) string {
var b []byte;
resp,_,_ := http.Get(url)
b , _ = ioutil.ReadAll(resp.Body)
func Get(url string) (string, os.Error) {
//var b []byte;
resp,_,err := http.Get(url)
b , _ := ioutil.ReadAll(resp.Body)
resp.Body.Close();

return string(b);
return string(b),err
}

func URLUnescape(edurl string) string {
Expand Down
5 changes: 4 additions & 1 deletion store.go
Expand Up @@ -61,7 +61,10 @@ func (s *URLStore) Put(url, key *string) os.Error {
}
s.urls.Set(*key, *url)
s.mu.Unlock()
_ = s.dirty <- true
select {
case s.dirty <- true:
default:
}
return nil
}

Expand Down
39 changes: 20 additions & 19 deletions urlpaser.go
Expand Up @@ -15,25 +15,26 @@ func (up *URLParse) urlparser(c chan string, tf chan map[string]string) {
re,_ := regexp.Compile("<([^>]|\n)*>|\t|\r");
parsedlink:= make(map[string]string)
for i := 0; i < up.size; i++ {
pas := Get(<-c);
pas = ed2k.ReplaceAllString(pas,">\ned2k://");
pas = re.ReplaceAllString(pas,"\n");
pasarray := strings.Split(pas,"\n",-1);
for is := 1; is < len(pasarray); is++ {
if strings.HasPrefix(pasarray[is],"ed2k://") {
stringindex:=strings.Index(pasarray[is],"\"")
var edurl string
if stringindex < 1{
edurl = pasarray[is];
edurl = URLUnescape(edurl);
}else{
edurl = pasarray[is][0:stringindex];
edurl = URLUnescape(edurl);
}
spedurl := strings.Split(edurl,"|",-1)
if len(spedurl) > 5 && len(spedurl[4]) > 20 {
key:=spedurl[4]
parsedlink[key]=edurl;
if pas,err := Get(<-c); err == nil {
pas = ed2k.ReplaceAllString(pas,">\ned2k://");
pas = re.ReplaceAllString(pas,"\n");
pasarray := strings.Split(pas,"\n",-1);
for is := 1; is < len(pasarray); is++ {
if strings.HasPrefix(pasarray[is],"ed2k://") {
stringindex:=strings.Index(pasarray[is],"\"")
var edurl string
if stringindex < 1{
edurl = pasarray[is];
edurl = URLUnescape(edurl);
}else{
edurl = pasarray[is][0:stringindex];
edurl = URLUnescape(edurl);
}
spedurl := strings.Split(edurl,"|",-1)
if len(spedurl) > 5 && len(spedurl[4]) > 20 {
key:=spedurl[4]
parsedlink[key]=edurl;
}
}
}
}
Expand Down
71 changes: 50 additions & 21 deletions vv
@@ -1,28 +1,57 @@

# Chuck
http://www.simplecd.org/id/2147500409
#戏里戏外.Episodes
http://www.simplecd.org/id/2147500420
# the good wife
http://www.simplecd.org/id/2147500890
#-The.Mentalist
http://www.simplecd.org/id/2147500883
# House
http://www.simplecd.org/id/2147500489
#》(The Mentalist Season3)更新第12集缺11[中文字幕][RMVB]
http://www.simplecd.org/id/2147500681
#Running Wilde Season1
http://www.simplecd.org/id/2147486408
#Shameless
http://www.simplecd.org/id/2147500418
#The middle
http://www.simplecd.org/id/2147487317
#Grey's Anatomy Season7
http://www.simplecd.org/id/2147486995
# The Office
http://www.simplecd.org/id/2147486411
#Fringe
http://www.simplecd.org/id/2147486442
# BBC: The Story of Maths
http://www.simplecd.org/id/2147500894
#hustle
http://www.simplecd.org/id/2147500763
#Lie to me
http://www.simplecd.org/id/2147500416
# The Cape
http://www.simplecd.org/id/2147499824
# Perfect Couples
http://www.simplecd.org/id/2147499822
# 30rock
http://www.simplecd.org/id/2147486439
#Harrys law
http://www.simplecd.org/id/2147499902
# Community
http://www.simplecd.org/id/2147500452
#TBBT4
http://www.simplecd.org/id/2147487001
#《左右不逢源 第二季》(The Middle Season 2)
http://www.verycd.com/topics/2853333/
http://mirror.simplecd.org/id/2853333
#《抵抗分子 第一季》
http://www.verycd.com/topics/2870596/
http://mirror.simplecd.org/id/2870596
# Outsourced
http://www.verycd.com/topics/2855886/
# 疯狂逸事 第一季
http://bbs.sfileydy.com/viewthread.php?tid=328954&extra=page%3D1
# [A-F]【S-Files出品】【美剧】【火线警告第四季-Burn.Notice.Season4
http://bbs.sfileydy.com/viewthread.php?tid=324355&extra=page%3D1
#【富贵与爱情第一季-Running.Wilde.S01】【BT04 ED08 I04】
http://bbs.sfileydy.com/viewthread.php?tid=330464&extra=page%3D1
http://www.simplecd.org/id/2147500417
#《疯狂老爸箴言录 第一季》
http://www.verycd.com/topics/2853064/
http://www.simplecd.org/id/2147500701
#《超感神探 第三季》
http://www.verycd.com/topics/2854180/
http://www.simplecd.org/id/2854180
#《非凡家庭 第一季
http://www.verycd.com/topics/2855311/
# outsourced
http://www.verycd.com/topics/2855886/
#《打工仔买房记》
http://www.verycd.com/topics/2859465/
http://www.simplecd.org/id/2854275
# [欧美] 《摩登家庭 第二季》(Modern Family S2)破烂熊字幕组
http://www.verycd.com/topics/2852806/
# 《灵异之城 第四季》(Eureka Season 4)
http://www.verycd.com/topics/2835125/
# [欧美] 《极速前进 第十七季》(The Amazing Race Season 17
http://www.verycd.com/topics/2854901/
http://www.simplecd.org/id/2147500443

0 comments on commit cd75c4a

Please sign in to comment.