当前位置: 首页>>代码示例>>Golang>>正文


Golang dna.Log函数代码示例

本文整理汇总了Golang中dna.Log函数的典型用法代码示例。如果您正苦于以下问题:Golang Log函数的具体用法?Golang Log怎么用?Golang Log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: stopVPN

func stopVPN(vpnAppName dna.String, cmd *exec.Cmd) {
	cmdErr := cmd.Process.Kill()
	if cmdErr != nil {
		dna.Log(vpnAppName, "cannot shut it down properly. Error:", cmdErr.Error())
	} else {
		dna.Log(vpnAppName, "was shut down!")
	}
}
开发者ID:olragon,项目名称:dna,代码行数:8,代码来源:update_lyricfind.go

示例2: ExampleURLBuilder

func ExampleURLBuilder() {
	logURL := func(descStr, url dna.String) {
		dna.Log(descStr+dna.String(" ").Repeat(23-descStr.Length()), url)
	}
	urlb := NewURLBuilder()
	urlb.SetTimestamp(time.Date(2014, time.February, 4, 12, 12, 12, 12, time.UTC))
	logURL("ARTIST INFO:", urlb.GetArtistInfo(49674))
	logURL("CHECKVERSION:", urlb.GetCheckVersion())
	dna.Log("--------------------------------------------------------")
	logURL("LIST OF GENRES:", urlb.GetListOfGenres("song"))
	logURL("LIST OF TOPICS:", urlb.GetListOfTopics(1, 30))
	dna.Log("--------------------------------------------------------")
	logURL("PLAYLIST INFO:", urlb.GetPlaylistInfo(12255234))
	logURL("PLAYLISTS BY ARTIST:", urlb.GetPlaylistsByArtist(49674, 1, 30))
	logURL("PLAYLISTS BY GENRE:", urlb.GetPlaylistsByGenre(0, 1, 30))
	logURL("PLAYLISTS BY SEARCHING:", urlb.GetPlaylistsBySearching("tell", 1, 30))
	logURL("PLAYLISTS BY TOPIC:", urlb.GetPlaylistsByTopic(51))
	logURL("PLAYLISTS RELATED:", urlb.GetPlaylistsRelated(12336694))
	dna.Log("--------------------------------------------------------")
	logURL("SONG INFO:", urlb.GetSongInfo(2854574))
	logURL("SONG LYRIC:", urlb.GetSongLyric(2909727))
	logURL("SONGS BY ARTIST:", urlb.GetSongsByArtist(49674, 50, 30))
	logURL("SONGS BY GENRE:", urlb.GetSongsByGenre(5015, 34, 30))
	logURL("SONGS BY SEARCHING:", urlb.GetSongsBySearching("man", 1, 30))
	logURL("SONGS OF PLAYLIST", urlb.GetSongsOfPlaylist(12095591))
	dna.Log("--------------------------------------------------------")
	logURL("VIDEO INFO:", urlb.GetVideoInfo(2876055))
	logURL("VIDEOS BY ARTIST:", urlb.GetVideosByArist(49674, 1, 30))
	logURL("VIDEOS BY GENRE:", urlb.GetVideosByGenre(5142, 1, 30))
	logURL("VIDEOS BY SEARCHING:", urlb.GetVideosBySearching("man", 1, 30))
	logURL("VIDEOS RELATED:", urlb.GetVideosRelated(12336694))
	// Output:
	// ARTIST INFO:            http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-artist-detail&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&artistid=49674&time=1391515932000&token=a6ffbbb6da2b822f647829ff6215c210
	// CHECKVERSION:           http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=check-version&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&time=1391515932000&token=31842a81519047f5dd477b54608eb2d7
	// --------------------------------------------------------
	// LIST OF GENRES:         http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-list-genre&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&type=song&time=1391515932000&token=c1b31f50c1ea19250898a1a2e14ca60b
	// LIST OF TOPICS:         http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-list-topic&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&pageindex=1&pagesize=30&time=1391515932000&token=d7abea98a130db44bce09600f25cb316
	// --------------------------------------------------------
	// PLAYLIST INFO:          http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-playlist-info&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&playlistid=12255234&time=1391515932000&token=f1f0b8e4827086b37c3c3accee79017f
	// PLAYLISTS BY ARTIST:    http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-playlist-by-artist&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&artistid=49674&pageindex=1&pagesize=30&time=1391515932000&token=2be9e5d0c3fd1325d2a7ee2426922d5b
	// PLAYLISTS BY GENRE:     http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-playlist-by-genre&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&genreid=0&pageindex=1&pagesize=30&time=1391515932000&token=ec761c1865e50560e61c5036fca893ce
	// PLAYLISTS BY SEARCHING: http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=search-playlist&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&keyword=tell&pageindex=1&pagesize=30&time=1391515932000&token=5370cbfb8040183ad5570b999c813c83
	// PLAYLISTS BY TOPIC:     http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-playlist-by-topic&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&topicid=51&time=1391515932000&token=ff8f012db0d705b3cdf2698ec16536a7
	// PLAYLISTS RELATED:      http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-playlist-related&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&playlistid=12336694&time=1391515932000&token=5c8efd0df7e283a58c28b943b85e1262
	// --------------------------------------------------------
	// SONG INFO:              http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-song-info&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&songid=2854574&time=1391515932000&token=b1db67e99010e541ea910e997350a75d
	// SONG LYRIC:             http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-lyric&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&songid=2909727&time=1391515932000&token=c752ab44e4f60177474b3ff554c380f3
	// SONGS BY ARTIST:        http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-song-by-artist&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&artistid=49674&pageindex=50&pagesize=30&time=1391515932000&token=cb00833e14a158c8eae098be2834e166
	// SONGS BY GENRE:         http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-song-by-genre&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&genreid=5015&pageindex=34&pagesize=30&time=1391515932000&token=21bd96e68c4179d0459f5692e0144ca0
	// SONGS BY SEARCHING:     http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=search-song&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&keyword=man&pageindex=1&pagesize=30&time=1391515932000&token=3ba6c692cd09ef54ee196bc8e3798078
	// SONGS OF PLAYLIST       http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-song-by-playlistid&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&playlistid=12095591&time=1391515932000&token=9e461944fa434c9e197b5bae1ad9cc3f
	// --------------------------------------------------------
	// VIDEO INFO:             http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-video-detail&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&videoid=2876055&time=1391515932000&token=ad13b3cee157e1ab1dfa337ec47ab20e
	// VIDEOS BY ARTIST:       http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-video-by-artist&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&artistid=49674&pageindex=1&pagesize=30&time=1391515932000&token=c1641290c36d3a36590df55cbad083dc
	// VIDEOS BY GENRE:        http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-video-by-genre&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&genreid=5142&pageindex=1&pagesize=30&time=1391515932000&token=270c039a73d299c688d8b3b086ae1e7e
	// VIDEOS BY SEARCHING:    http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=search-video&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&keyword=man&pageindex=1&pagesize=30&time=1391515932000&token=4bce7e9c8333ba31076c3cb1a2b85544
	// VIDEOS RELATED:         http://api.m.nhaccuatui.com/mobile/v5.0/[email protected]_service&action=get-video-related&deviceinfo={"DeviceID":"90c18c4cb3c37d442e8386631d46b46f","OsName":"ANDROID","OsVersion":"10","AppName":"NhacCuaTui","AppVersion":"5.0.1","UserInfo":"","LocationInfo":""}&videoid=12336694&time=1391515932000&token=57aa7164a27ac3dacb25526d7f4a3cbc
}
开发者ID:olragon,项目名称:dna,代码行数:58,代码来源:urlbuilder_test.go

示例3: getSongLrc

func getSongLrc(song *Song) {
	result, err := http.Get(song.LrcUrl)
	if err == nil {
		lrc, derr := DecryptLRC(result.Data)
		if derr == nil {
			song.Lrc = lrc
		} else {
			dna.Log("ERR WHILE DECRYPT SONG ", song.Id)
			dna.Log("-----\n")
		}
	}
}
开发者ID:olragon,项目名称:dna,代码行数:12,代码来源:song.go

示例4: ExampleURLBuilder

func ExampleURLBuilder() {
	// Prevent ACCESS_TOKEN_KEY getting updated
	ACCESS_TOKEN_KEY = "1c3102056acd3c12440bd05af8b9c560"
	AccessTokenKeyRenewable = false
	urlb := NewURLBuilder()
	dna.Log("MOVIE  :", urlb.GetMovie(5585))
	dna.Log("EPISOLE:", urlb.GetEpisole(4807, 5))
	dna.Log("CHANNEL:", urlb.GetChannel(8))
	// Output:
	// MOVIE  : https://api.hdviet.com/movie/play?movieid=5585&accesstokenkey=1c3102056acd3c12440bd05af8b9c560&sign=849ac3a1bac4ad70ef424c63d8285d7e
	// EPISOLE: https://api.hdviet.com/movie/play?movieid=4807&accesstokenkey=1c3102056acd3c12440bd05af8b9c560&ep=5&sign=d2bb08aaa5b11ecbe4d58b45b5705890
	// CHANNEL: https://api.hdviet.com/channel/play?channelid=8&accesstokenkey=1c3102056acd3c12440bd05af8b9c560&sign=9f08c9663c064bd6713ded7f8bd4cfd6
}
开发者ID:olragon,项目名称:dna,代码行数:13,代码来源:url_builder_test.go

示例5: ExampleDecryptLRC

func ExampleDecryptLRC() {
	var data dna.String = "0BAF2564A1C1AF9E3AC9A5F6FDC42CA0EBA4A3584FD54C91CF3983538CC761B0EB54E77BFF3994C6188C1C26FEB004C745119E11A53E618DA62754364E842D97900E0F531E872BA76652FAE77EB2FD764DBE11966FA1BF4A96C86BC28F33754B60BF102E9CEF0578531B41315B6398F8A6B35234881FEFC172134FF8B2832D6BEE9A757846AB4020B32E8505730204154480DD0938EE69427D2E42EB48787E9BAD63FAEC9EFA15E0619B6EE55993B824A85F9D2E1E957BCB8EA6B9C1AF45B6C0F607D6D32FFC7A12316829F8B063F86B52C168A2830AECE58E518D8D43D5E9FCE9F771CF716D9741926199613733D2BDEB0FA696FD00910A422DFCCC80E376454DCDEE45439C9F7C52A9453354720BAC5FE03B74C70F4EF98900B82E3A66B4A25F822417107B84F0A77A6DB454896D4F5C969DFF721A494BE8576A7716BE23B3B40203DD07B29DB241F808B2D55629F3C31F13FE780A93F333DA92E227BC6DAEA733F25B8EAF2ACEE2DA5C2F7526103F515B515BDDC57827E45D330096DC1036DA68D723D879A42D5B35CEA9E88CD819121ED9D01D68FFBD40AF2D36073125A344B66B4476F53A91B5E0E2F10E29B44AB1CF0E5D8077DE71FD85B4787EE4DF3AA18C03323A9C4AF8B2E75E049F4FDD470B56C60FCF029422C4D0A12995CC367238E4A6544DF27607CBB0EB8394DC7D320F074F8B323D961EB152999E8E680BBF0B8B2CA5AC435907CAA9B4D3BC1A105B7C02D3CC9EBA76BAA1F33DCBD19D087D7D49B177239991C54E7E600D6CA23298BDA9B32DEACB370BB05192D68F8A372AC376337017AC65B08CBAB24A75615B89E9D23C24B36A47312FA7915E842EAE7BB89C8A7D60ED8A8208B2B53A41664DBA6D0F66511F3BB80A21E0F812554F3FAC8D966332B6B76FA52E3FD3F065D8DD2C287FDEC06C5FCAD9DCC5E9319D3D119A1E23F45077080576D09F1233E7C1AB8C9DA3C898CA5BCBA2443C8077BFAEE2816C3BF54B4A3F51AADDA5BF72DF791C508761411210DA2E1513F3B36393E62692179DF39D563EDED84002EFE51E7DB3F1006473ECE8BE34B86D5FB313AB1E84E3D40E4C9328D7EBF6A2961EC56642222172708DB17006AA31C30C3E206FB2AFA3CEDFA615FF188A581844930C40AD3DDFACA2C238FEEA2349191AF8379F0BAFA487ED7CDBBD38726E9EC6CE137B33FC5C8620F053134291EA9C1AD4A447C2B8D00FB13C05AFC92746F88EFD2E35B39A18F1B3586A6AD1DC12B1DCA0D5B553CD4CC31E63340DD769DC8C1F40A785D42F16C36E1C29DC4EB464770FCA54586BD4563B83E15381167DECB63962359CCC836FBB367C78186D45BDDA8254952C76C30EDEBA5EFA0DB538C4969CF6EE4EAD7FC6B08D1B8E6DA1BCFFD2B38806926663A24B9CB004C1D3695B7072A4C95AEC078AF6FCC292F53B860A4E3E86656833B75F8661F381742A3D628F8B444257E81609566D76D6BBAC87817530065F8222237DAB1C0B39D4080177D558ABBCC991A0519A9703F2A43486EECEBC9BE02578287995A9183C04E353E5DEBB746E2EAAC8316DF517B00E8CFDB73F947F2A9B339915FA6D58EFFAAB9A219C57C20D696E582E5D084DAFA0A250B8A2B0CE9FF9D0D170399EA553D4A6E10A7F4653C030909E2F0261CDA09893E567682069F1C58EF848DC17B583B0E2522730944A931697E4FEEA8313E5B2D8DF708936EBC59677A446515597772076CF11AC3C86A540CFDEE5F425972E1CE8F71083C64F2B046F03BC44E9ABECFFF58223C61A43C3A6D011FE06CE82BF431ECC3ADBA29F747E6814400DDA77BCC4C1EB9AD60B395EBE7763CEC569B6EC6CF0958237CB0F61F5FB838D553CE66CADEF376EF4D63C52AF894D05CD283BCE855AF9D4F7B435B45238516C277C844376A5AE30F2F4486099DEFB1958954E4884ED1DEB5CDA6F87FCB3DC60042770A12ADB100AF2E88A32AB7C13F46B57C78C06D32FAFD449D1A131F01C8A712AAF93D78C2F35EA77AF260454D071A0A0C64B06EA8C813E73298EE9FDF0A1A7CBB7291841B01F1CC12EE0C5978FC7B51C4AAD36B169F8193ACAF09F2983296E3DF6BB590BF1D70D98006B9BEDA0705752AC0C9C000B5A8E9560E4A460C15A1096DDFEA465BC0D8BD4E28A01A41437DC987243EF973643D51AAA323AC6258E99666786EF58DB080CA6ED888E31D9D53504C6886977F9BFB12C82CF2A44366086D1B90F427BA80ED7350FD4D503CFBE03099F3509BB55FE0A257BD93FC868C29F1839609B1408B1C0A03B533A591843B7B08317AE7DC048147B950A885EF72EA39B3455073AE90E8C4DBCED8E17A0D28D7261AC5A715F3D4A6836BFB298A9E817F25169DF2A9157D541D201A115BFDB08E69D92FBFA6D2AAFF8F21BAE49142E63450BF4472645394D8D77DF7A4DB447D3A4D624F6647E0EDCB23C8F121720B9C22FD04DE869B65B6D44C98E89D86A1D1A150EAAF40E6811E53849E5FD8D6A599C9D12EC701FBE1280F9A8AA8E55744A96899B234547F04D59D4B23C9203073F6DE922A57A9D6BE70CBDAAC8D5B31637BB9B58EC87B22ACAFE390C48C853457B97E9E810C2AC03EBB74D9F7B660E4BA608ADD89FE6AC974C371054716B7068D2DA576A5436CA16B291B76F00F4A35CDBE58BB04387062930E89ED31F419337E8549E1DEE2BA17D4AA9B0206AEDA4017C47987E812853ED9BEC37C2ACA941147AF0627BDB893D90D8CB7CA1D363A2087D0652B70BCD4407A706C55FEBB77B916996023E04253F796F0818C4338B90E6471C912D22CA1FCFDAB2ADB0964EC9EB9D853DED8D1F62E0CBD19E1851E6BEB48D527174F6C3E3BD88E5E3FC11A440CBAEFFB7845F08BA75F0E08F0670AD934FDA161470B49A44E3ABDC709534BD28C0E02225B60CEE57151B5240608068F7E1C4314394B81C941904371E58038D3FDCA479A3857A6778C0D75C51E8625682AD9E25960E0073F4E96CCB8A6759C247A537B08A16BA49ABAC0793603D1CD4883C9DE90B2A3B5C998453868DE295B16FF22FB6F1D56222339F11AC6FAEF006507035B8AECAF1DB546307B63040"

	lrc, err := DecryptLRC(data)
	if err == nil {
		if lrc.Match(`Không gian quanh đây`) == true && lrc.Match(`rồi cũng sẽ quen dần`) == true {
			dna.Log("Success")
		} else {
			dna.Log("Failed")
		}
	}
	// Output:
	// Success
}
开发者ID:olragon,项目名称:dna,代码行数:14,代码来源:decryptlrc_test.go

示例6: startVPN

func startVPN(vpnAppName, vpnAppUrl dna.String) chan *exec.Cmd {
	c := make(chan *exec.Cmd)
	dna.Log("Starting", vpnAppName)
	go func() {
		cmd := exec.Command(vpnAppUrl.String())
		c <- cmd
		err := cmd.Run()
		if err != nil {
			dna.Log(err.Error())
		}
	}()

	return c
}
开发者ID:olragon,项目名称:dna,代码行数:14,代码来源:update_lyricfind.go

示例7: convertCategoryToStringArray

func convertCategoryToStringArray(catStr dna.String) dna.StringArray {
	var cats []Category
	var ret = dna.StringArray{}
	err := json.Unmarshal([]byte(string(catStr)), &cats)
	if err != nil {
		dna.Log(catStr)
		dna.Log(err.Error())
		panic("Invalid category string input")
	} else {
		for _, cat := range cats {
			ret.Push(cat.Name)
		}
	}
	return ret
}
开发者ID:olragon,项目名称:dna,代码行数:15,代码来源:album.go

示例8: DumpFiles

func DumpFiles() {
	var ret = dna.StringArray{}
	for _, table := range GetAlbumTables().Concat(GetSongTables()).Concat(GetVideoTables()) {
		ret.Push(`"` + table + `"`)
	}
	dna.Log(ret.Join(","))
}
开发者ID:olragon,项目名称:dna,代码行数:7,代码来源:ref.go

示例9: amRecovery

func amRecovery() {
	// Recovering failed ambum ids
	db, err := sqlpg.Connect(sqlpg.NewSQLConfig(SqlConfigPath))
	dna.PanicError(err)
	siteConf, err := LoadSiteConfig("am", SiteConfigPath)
	siteConf.NConcurrent = 30
	dna.PanicError(err)

	// r := NewRange(20987, 30000)
	ids := amGetErrIds("./log/http_error.log", 1)
	tmp := ids.Unique()
	ids = &tmp
	if ids.Length() > 0 {
		state := NewStateHandlerWithExtSlice(new(am.APIAlbum), ids, siteConf, db)
		Update(state)
	} else {
		dna.Log("No need to recover file")
	}

	// Recover failed SQL statements
	RecoverErrorQueries(SqlErrorLogPath, db)

	CountDown(3*time.Second, QuittingMessage, EndingMessage)
	db.Close()
}
开发者ID:olragon,项目名称:dna,代码行数:25,代码来源:update_allmusic.go

示例10: UpdateNhacvui

// UpdateNhacvui gets lastest items from nhacvui.vn.
// The update process goes through 5 steps:
// 	Step 1: Initalizing db connection, loading site config and state handler.
// 	Step 2: Updating new songs.
// 	Step 3: Updating new albums.
// 	Step 4: Updating new videos from FoundVideos var.
// 	Step 5: Recovering failed sql statements.
func UpdateNhacvui() {
	db, err := sqlpg.Connect(sqlpg.NewSQLConfig(SqlConfigPath))
	dna.PanicError(err)
	siteConf, err := LoadSiteConfig("nv", SiteConfigPath)
	dna.PanicError(err)

	state := NewStateHandler(new(nv.Song), siteConf, db)
	Update(state)
	//  update album
	state = NewStateHandler(new(nv.Album), siteConf, db)
	Update(state)

	if nv.FoundVideos.Length() > 0 {
		state = NewStateHandlerWithExtSlice(new(nv.Video), nv.FoundVideos, siteConf, db)
		Update(state)
	} else {
		dna.Log("No videos found!")
	}

	RecoverErrorQueries(SqlErrorLogPath, db)

	time.Sleep(3 * time.Second)
	db.Close()

}
开发者ID:olragon,项目名称:dna,代码行数:32,代码来源:update_nhacvui.go

示例11: ExampleGetAPIArtist

func ExampleGetAPIArtist() {
	_, err0 := GetAPIArtist(496741)
	if err0 == nil {
		panic("SongArtist id 496741 has to have an error")
	} else {
		if err0.Error() != "NCT - Artist ID:496741 not found" {
			panic("Wrong error message")
		}
	}
	artist, err := GetAPIArtist(49674)
	if err == nil {
		dna.LogStruct(artist)
	} else {
		dna.Log(err.Error())
	}
	if artist.Avatar != "" {
		artist.Avatar = "http://avatar.nct.nixcdn.com/singer/avatar/2013/12/16/7/f/f/7/1387176808800.jpg"
	}
	// Output:
	// Id : 49674
	// Name : "Đàm Vĩnh Hưng"
	// Avatar : "http://avatar.nct.nixcdn.com/singer/avatar/2014/13/7E4149A9_2.jpg"
	// NSongs : 0
	// NAlbums : 0
	// NVideos : 0
	// ObjType : "ARTIST"
}
开发者ID:olragon,项目名称:dna,代码行数:27,代码来源:api_test.go

示例12: UpdateSongFreaks

// UpdateSongFreaks gets lastest songs,albums,artists and videos from songfreaks.com
// The update process goes through 4 steps:
// 	Step 1: Initalizing db connection, loading site config and state handler.
// 	Step 2: Finding new songs, insert new albums,artists and videos if found.
// 	Step 3: Updating found new albums in Step 2.
// 	Step 4: Recovering failed sql statements in Step 2.
func UpdateSongFreaks() {
	db, err := sqlpg.Connect(sqlpg.NewSQLConfig(SqlConfigPath))
	dna.PanicError(err)
	siteConf, err := LoadSiteConfig("sf", SiteConfigPath)
	siteConf.NConcurrent = 20
	dna.PanicError(err)

	// Update new songs
	state := NewStateHandler(new(sf.APISongFreaksTrack), siteConf, db)
	state.TableName = "sfsongs"
	Update(state)

	// Update "ratings", "songids", "review_author", "review" of song
	ids := &[]dna.Int{}
	query := dna.Sprintf("SELECT id FROM sfalbums where checktime > '%v' AND array_length(songids, 1) is NULL", time.Now().Format("2006-01-02"))
	// dna.Log(query)
	err = db.Select(ids, query)
	if err != nil {
		dna.PanicError(err)
	}
	idsSlice := dna.IntArray(*ids)
	if idsSlice.Length() > 0 {
		state = NewStateHandlerWithExtSlice(new(sf.APISongFreaksAlbum), &idsSlice, siteConf, db)
		Update(state)

	} else {
		dna.Log("No new albums found")
	}

	// Recover failed sql statements
	RecoverErrorQueries(SqlErrorLogPath, db)

	CountDown(3*time.Second, QuittingMessage, EndingMessage)
	db.Close()
}
开发者ID:olragon,项目名称:dna,代码行数:41,代码来源:update_songfreaks.go

示例13: ExampleGetAPIAlbum

func ExampleGetAPIAlbum() {
	album, err := GetAPIAlbum(86682)

	if err == nil {
		if album.Plays < 44450 {
			panic("Plays has to be greater than 44450")
		}
		album.Plays = 44450
		for _, song := range album.SongList {
			song.Plays = 10129
		}
		var length = len(album.SongList)
		album.SongList = nil
		if album.Coverart == "" {
			panic("WRong covert")
		}
		album.Coverart = "http://media3.keeng.vn:8082/medias/images/images_thumb/f_medias_6/album/image/2014/01/10/27a4cdcbb7f60aa123529a49d76888708ec8872d_103_103.jpg"
		dna.LogStruct(album)
		dna.Log("Lenght :", length)
	} else {
		panic("Error has to be nil")
	}
	// Output:
	// Id : 86682
	// Title : "Chờ Hoài Giấc Mơ"
	// Artists : "Akio Lee ft Akira Phan"
	// Coverart : "http://media3.keeng.vn:8082/medias/images/images_thumb/f_medias_6/album/image/2014/01/10/27a4cdcbb7f60aa123529a49d76888708ec8872d_103_103.jpg"
	// Url : "http://keeng.vn/album/Cho-Hoai-Giac-Mo-Akio-Lee/2K2O4QG8.html"
	// Plays : 44450
	// SongList : []ke.APISong(nil)
	// Lenght : 5

}
开发者ID:olragon,项目名称:dna,代码行数:33,代码来源:post_test.go

示例14: ExampleGetUsersWithInitialId

func ExampleGetUsersWithInitialId() {
	UsersMagnitude = 10
	users, err := GetUsersWithInitialId(1)
	if err != nil {
		dna.PanicError(err)
	} else {
		if len(users.List) != 9 {
			dna.Log("Complete")
		} else {
			dna.Log("Not complete")
		}
	}
	// Output:
	// Complete

}
开发者ID:olragon,项目名称:dna,代码行数:16,代码来源:user_test.go

示例15: amGetErrIds

func amGetErrIds(inputFile dna.String, mode dna.Int) *dna.IntArray {
	var ret = dna.IntArray{}
	b, err := ioutil.ReadFile(inputFile.String())
	if err != nil {
		panic(err)
	}
	data := dna.String(string(b))
	lines := data.Split("\n")
	for _, line := range lines {
		switch mode {
		case 1:
			idArr := line.FindAllStringSubmatch(`([0-9]+) Post.+no such host`, 1)
			if len(idArr) > 0 {
				ret.Push(idArr[0][1].ToInt())
			}
			idArr = line.FindAllStringSubmatch(`Timeout.+at id :([0-9]+)`, 1)
			if len(idArr) > 0 {
				ret.Push(idArr[0][1].ToInt())
			}
		case 2:
			ret.Push(line.ToInt())
		}
	}
	if mode == 1 {
		err = ioutil.WriteFile(inputFile.String(), []byte{}, 0644)
		if err != nil {
			dna.Log("Cannot write to file1:", err.Error())
		}

	}
	ret = ret.Unique()
	return &ret
}
开发者ID:olragon,项目名称:dna,代码行数:33,代码来源:update_allmusic.go


注:本文中的dna.Log函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。