예제 #1
0
func browseArchive(browseArchiveFlag, filterFlag string, isP2PFlag bool, perPageFlag, pageFlag int) {
	if isP2PFlag {
		fmt.Println("Due to API limitations it is impossible to browse the P2P archive.")
		os.Exit(1)
	} else {
		matched, err := regexp.MatchString("^[0-9]{4}-[0-9]{2}$", browseArchiveFlag)
		if err == nil && matched {
			data, err := xrel.GetLatestReleases(perPageFlag, pageFlag, filterFlag, browseArchiveFlag)
			ok(err, "Failed to browse the scene archive: ")
			if len(data.List) == 0 {
				fmt.Println("No releases found.")
				os.Exit(1)
			}
			printSceneReleases(data, false, false)
		} else {
			fmt.Println("Please use the following format: --browseArchive=YYYY-MM")
		}
	}
}
예제 #2
0
func showLatest(filterFlag string, isP2PFlag bool, perPageFlag, pageFlag int) {
	if isP2PFlag {
		data, err := xrel.GetP2PReleases(perPageFlag, pageFlag, "", "", "")
		ok(err, "Failed to get latest p2p releases: ")
		if len(data.List) == 0 {
			fmt.Println("No p2p releases found.")
			os.Exit(1)
		}
		printP2PReleases(data, false, false)
	} else {
		data, err := xrel.GetLatestReleases(perPageFlag, pageFlag, filterFlag, "")
		ok(err, "Failed to get latest releases: ")
		if len(data.List) == 0 {
			fmt.Println("No releases found.")
			os.Exit(1)
		}
		printSceneReleases(data, false, false)
	}
}